From 08168bec26b6f7d15474fb60fb946f62f5823748 Mon Sep 17 00:00:00 2001 From: Richard Cohen Date: Mon, 12 Jun 2023 19:10:51 +0100 Subject: [PATCH] Refactor: DECLARE_FINAL GncPluginCustomerImport < GncPlugin - fix the camel-snake hybrid name - except the name of the action, which is already used externally --- .../gnc-plugin-customer-import.c | 12 ++++++---- .../gnc-plugin-customer-import.h | 23 ++++--------------- 2 files changed, 12 insertions(+), 23 deletions(-) diff --git a/gnucash/import-export/customer-import/gnc-plugin-customer-import.c b/gnucash/import-export/customer-import/gnc-plugin-customer-import.c index f63a3aedd4..74344164bc 100644 --- a/gnucash/import-export/customer-import/gnc-plugin-customer-import.c +++ b/gnucash/import-export/customer-import/gnc-plugin-customer-import.c @@ -49,6 +49,8 @@ static void gnc_plugin_customer_import_cmd_test (GSimpleAction *simple, GVariant static GActionEntry gnc_plugin_actions [] = { + // should be "CustomerImportAction", but "customer_importAction" + // is already used externally in accelerator maps { "customer_importAction", gnc_plugin_customer_import_cmd_test, NULL, NULL, NULL }, }; /** The number of actions provided by this plugin. */ @@ -65,16 +67,16 @@ static const gchar *gnc_plugin_load_ui_items [] = * Object Implementation * ************************************************************/ -G_DEFINE_TYPE(GncPlugincustomer_import, gnc_plugin_customer_import, GNC_TYPE_PLUGIN) +G_DEFINE_TYPE(GncPluginCustomerImport, gnc_plugin_customer_import, GNC_TYPE_PLUGIN) GncPlugin * gnc_plugin_customer_import_new (void) { - return GNC_PLUGIN (g_object_new (GNC_TYPE_PLUGIN_customer_import, (gchar*) NULL)); + return GNC_PLUGIN (g_object_new (GNC_TYPE_PLUGIN_CUSTOMER_IMPORT, (gchar*) NULL)); } static void -gnc_plugin_customer_import_class_init (GncPlugincustomer_importClass *klass) +gnc_plugin_customer_import_class_init (GncPluginCustomerImportClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GncPluginClass *plugin_class = GNC_PLUGIN_CLASS(klass); @@ -82,7 +84,7 @@ gnc_plugin_customer_import_class_init (GncPlugincustomer_importClass *klass) object_class->finalize = gnc_plugin_customer_import_finalize; /* plugin info */ - plugin_class->plugin_name = GNC_PLUGIN_customer_import_NAME; + plugin_class->plugin_name = GNC_PLUGIN_CUSTOMER_IMPORT_NAME; /* widget addition/removal */ plugin_class->actions_name = PLUGIN_ACTIONS_NAME; @@ -93,7 +95,7 @@ gnc_plugin_customer_import_class_init (GncPlugincustomer_importClass *klass) } static void -gnc_plugin_customer_import_init (GncPlugincustomer_import *plugin) +gnc_plugin_customer_import_init (GncPluginCustomerImport *plugin) { } diff --git a/gnucash/import-export/customer-import/gnc-plugin-customer-import.h b/gnucash/import-export/customer-import/gnc-plugin-customer-import.h index 43fde78845..543053bd23 100644 --- a/gnucash/import-export/customer-import/gnc-plugin-customer-import.h +++ b/gnucash/import-export/customer-import/gnc-plugin-customer-import.h @@ -37,31 +37,18 @@ G_BEGIN_DECLS /* type macros */ -#define GNC_TYPE_PLUGIN_customer_import (gnc_plugin_customer_import_get_type()) -#define GNC_PLUGIN_customer_import(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GNC_TYPE_PLUGIN_customer_import, GncPlugincustomer_import)) -#define GNC_PLUGIN_customer_import_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GNC_TYPE_PLUGIN_customer_import, GncPlugincustomer_importClass)) -#define GNC_IS_PLUGIN_customer_import(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GNC_TYPE_PLUGIN_customer_import)) -#define GNC_IS_PLUGIN_customer_import_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GNC_TYPE_PLUGIN_customer_import)) -#define GNC_PLUGIN_customer_import_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GNC_TYPE_PLUGIN_customer_import, GncPlugincustomer_importClass)) +#define GNC_TYPE_PLUGIN_CUSTOMER_IMPORT (gnc_plugin_customer_import_get_type()) +G_DECLARE_FINAL_TYPE (GncPluginCustomerImport, gnc_plugin_customer_import, GNC, PLUGIN_CUSTOMER_IMPORT, GncPlugin) -#define GNC_PLUGIN_customer_import_NAME "gnc-plugin-customer-import" +#define GNC_PLUGIN_CUSTOMER_IMPORT_NAME "gnc-plugin-customer-import" /* typedefs & structures */ -typedef struct +struct _GncPluginCustomerImport { GncPlugin gnc_plugin; -} GncPlugincustomer_import; - -typedef struct -{ - GncPluginClass gnc_plugin; -} GncPlugincustomer_importClass; +}; /* function prototypes */ -/** - * @return The glib runtime type of an customer_import plugin page - **/ -GType gnc_plugin_customer_import_get_type (void); /** * @return A new GncPlugincustomer_import object