use G_DEFINE_TYPE_WITH_PRIVATE to replace g_type_class_add_private

gnc_plugin_account_tree_get_type is being replaced by that provided by G_DEFINE_TYPE_WITH_PRIVATE
This commit is contained in:
Christoph Holtermann 2018-12-06 21:48:22 +01:00
parent e487527879
commit 07b797b996

View File

@ -79,37 +79,6 @@ typedef struct GncPluginAccountTreePrivate
/** A pointer to the parent class of a plugin page. */
static GObjectClass *parent_class = NULL;
/* Get the type of the account tree menu plugin. */
GType
gnc_plugin_account_tree_get_type (void)
{
static GType gnc_plugin_account_tree_type = 0;
if (gnc_plugin_account_tree_type == 0)
{
static const GTypeInfo our_info =
{
sizeof (GncPluginAccountTreeClass),
NULL, /* base_init */
NULL, /* base_finalize */
(GClassInitFunc) gnc_plugin_account_tree_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GncPluginAccountTree),
0, /* n_preallocs */
(GInstanceInitFunc) gnc_plugin_account_tree_init
};
gnc_plugin_account_tree_type = g_type_register_static (GNC_TYPE_PLUGIN,
"GncPluginAccountTree",
&our_info, 0);
}
return gnc_plugin_account_tree_type;
}
/* Create a new account tree menu plugin. */
GncPlugin *
gnc_plugin_account_tree_new (void)
@ -126,7 +95,6 @@ gnc_plugin_account_tree_new (void)
return GNC_PLUGIN (plugin);
}
static void
gnc_plugin_account_tree_main_window_page_changed (GncMainWindow *window,
GncPluginPage *plugin_page, gpointer user_data)
@ -148,6 +116,7 @@ gnc_plugin_account_tree_main_window_page_changed (GncMainWindow *window,
}
}
G_DEFINE_TYPE_WITH_PRIVATE(GncPluginAccountTree, gnc_plugin_account_tree, GNC_TYPE_PLUGIN)
/** Initialize the class for a new account tree plugin. This will set
* up any function pointers that override functions in the parent
@ -177,8 +146,6 @@ gnc_plugin_account_tree_class_init (GncPluginAccountTreeClass *klass)
plugin_class->actions = gnc_plugin_actions;
plugin_class->n_actions = gnc_plugin_n_actions;
plugin_class->ui_filename = PLUGIN_UI_FILENAME;
g_type_class_add_private(klass, sizeof(GncPluginAccountTreePrivate));
}