Skip to content

Commit

Permalink
Refactor: DECLARE_FINAL GncPluginExample < GncPlugin
Browse files Browse the repository at this point in the history
- Fix the name
  • Loading branch information
richardcohen committed Jun 14, 2023
1 parent c5d4f2b commit 2e59bda
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 20 deletions.
8 changes: 4 additions & 4 deletions libgnucash/gnc-module/example/gnc-plugin.example.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,16 @@ static guint gnc_plugin_n_actions = G_N_ELEMENTS(gnc_plugin_actions);
* Object Implementation *
************************************************************/

G_DEFINE_TYPE(GncPluginexample, gnc_plugin_example, GNC_TYPE_PLUGIN)
G_DEFINE_TYPE(GncPluginExample, gnc_plugin_example, GNC_TYPE_PLUGIN)

GncPlugin *
gnc_plugin_example_new (void)
{
return GNC_PLUGIN (g_object_new (GNC_TYPE_PLUGIN_example, (gchar*) NULL));
return GNC_PLUGIN (g_object_new (GNC_TYPE_PLUGIN_EXAMPLE, (gchar*) NULL));
}

static void
gnc_plugin_example_class_init (GncPluginexampleClass *klass)
gnc_plugin_example_class_init (GncPluginExampleClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS(klass);
GncPluginClass *plugin_class = GNC_PLUGIN_CLASS(klass);
Expand All @@ -82,7 +82,7 @@ gnc_plugin_example_class_init (GncPluginexampleClass *klass)
}

static void
gnc_plugin_example_init (GncPluginexample *plugin)
gnc_plugin_example_init (GncPluginExample *plugin)
{
}

Expand Down
21 changes: 5 additions & 16 deletions libgnucash/gnc-module/example/gnc-plugin.example.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,28 +38,17 @@ G_BEGIN_DECLS

/* type macros */
#define GNC_TYPE_PLUGIN_example (gnc_plugin_example_get_type())
#define GNC_PLUGIN_example(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GNC_TYPE_PLUGIN_example, GncPluginexample))
#define GNC_PLUGIN_example_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GNC_TYPE_PLUGIN_example, GncPluginexampleClass))
#define GNC_IS_PLUGIN_example(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GNC_TYPE_PLUGIN_example))
#define GNC_IS_PLUGIN_example_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GNC_TYPE_PLUGIN_example))
#define GNC_PLUGIN_example_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GNC_TYPE_PLUGIN_example, GncPluginexampleClass))
G_DECLARE_FINAL_TYPE (GncPluginExample, gnc_plugin_example, GNC, PLUGIN_EXAMPLE)

#define GNC_PLUGIN_example_NAME "gnc-plugin-example"
#define GNC_PLUGIN_EXAMPLE_NAME "gnc-plugin-example"

/* typedefs & structures */
typedef struct {
struct _GncPluginExample
{
GncPlugin gnc_plugin;
} GncPluginexample;

typedef struct {
GncPluginClass gnc_plugin;
} GncPluginexampleClass;
};

/* function prototypes */
/**
* @return The glib runtime type of an example plugin page
**/
GType gnc_plugin_example_get_type (void);

/**
* @return A new GncPluginexample object
Expand Down

0 comments on commit 2e59bda

Please sign in to comment.