mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
replace deprecated g_type_class_add_private
use GNC_DEFINE_TYPE_WITH_CODE to preserve 2nd init parameter ..._get_type is being replaced by that provided by G_DEFINE_TYPE_WITH_PRIVATE
This commit is contained in:
parent
8545ca408c
commit
a0a0b30a87
@ -50,7 +50,7 @@ static gpointer parent_class = NULL;
|
|||||||
|
|
||||||
static void gnc_plugin_class_init (GncPluginClass *klass);
|
static void gnc_plugin_class_init (GncPluginClass *klass);
|
||||||
static void gnc_plugin_init (GncPlugin *plugin_page,
|
static void gnc_plugin_init (GncPlugin *plugin_page,
|
||||||
GncPluginClass *klass);
|
void *data);
|
||||||
static void gnc_plugin_finalize (GObject *object);
|
static void gnc_plugin_finalize (GObject *object);
|
||||||
|
|
||||||
|
|
||||||
@ -61,41 +61,12 @@ typedef struct GncPluginPrivate
|
|||||||
gpointer dummy;
|
gpointer dummy;
|
||||||
} GncPluginPrivate;
|
} GncPluginPrivate;
|
||||||
|
|
||||||
|
GNC_DEFINE_TYPE_WITH_CODE(GncPlugin, gnc_plugin, G_TYPE_OBJECT,
|
||||||
|
G_ADD_PRIVATE(GncPlugin))
|
||||||
|
|
||||||
#define GNC_PLUGIN_GET_PRIVATE(o) \
|
#define GNC_PLUGIN_GET_PRIVATE(o) \
|
||||||
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_PLUGIN, GncPluginPrivate))
|
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_PLUGIN, GncPluginPrivate))
|
||||||
|
|
||||||
|
|
||||||
/** Get the type of a gnc window plugin.
|
|
||||||
*/
|
|
||||||
GType
|
|
||||||
gnc_plugin_get_type (void)
|
|
||||||
{
|
|
||||||
static GType gnc_plugin_type = 0;
|
|
||||||
|
|
||||||
if (gnc_plugin_type == 0)
|
|
||||||
{
|
|
||||||
static const GTypeInfo our_info =
|
|
||||||
{
|
|
||||||
sizeof (GncPluginClass),
|
|
||||||
NULL, /* base_init */
|
|
||||||
NULL, /* base_finalize */
|
|
||||||
(GClassInitFunc) gnc_plugin_class_init,
|
|
||||||
NULL, /* class_finalize */
|
|
||||||
NULL, /* class_data */
|
|
||||||
sizeof (GncPlugin),
|
|
||||||
0, /* n_preallocs */
|
|
||||||
(GInstanceInitFunc) gnc_plugin_init,
|
|
||||||
};
|
|
||||||
|
|
||||||
gnc_plugin_type = g_type_register_static (G_TYPE_OBJECT,
|
|
||||||
GNC_PLUGIN_NAME,
|
|
||||||
&our_info, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
return gnc_plugin_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/** Initialize the class for the new gnucash plugin object. This will
|
/** Initialize the class for the new gnucash plugin object. This will
|
||||||
* set up any function pointers that override functions in the parent
|
* set up any function pointers that override functions in the parent
|
||||||
* class, and also installs the proprieties that are unique to this
|
* class, and also installs the proprieties that are unique to this
|
||||||
@ -110,8 +81,6 @@ gnc_plugin_class_init (GncPluginClass *klass)
|
|||||||
|
|
||||||
parent_class = g_type_class_peek_parent (klass);
|
parent_class = g_type_class_peek_parent (klass);
|
||||||
gobject_class->finalize = gnc_plugin_finalize;
|
gobject_class->finalize = gnc_plugin_finalize;
|
||||||
|
|
||||||
g_type_class_add_private(klass, sizeof(GncPluginPrivate));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -124,8 +93,10 @@ gnc_plugin_class_init (GncPluginClass *klass)
|
|||||||
* @param klass A pointer to the class data structure for this
|
* @param klass A pointer to the class data structure for this
|
||||||
* object. */
|
* object. */
|
||||||
static void
|
static void
|
||||||
gnc_plugin_init (GncPlugin *plugin_page, GncPluginClass *klass)
|
gnc_plugin_init (GncPlugin *plugin_page, void *data)
|
||||||
{
|
{
|
||||||
|
GncPluginClass *klass = (GncPluginClass*)data;
|
||||||
|
|
||||||
gnc_gobject_tracking_remember(G_OBJECT(plugin_page), \
|
gnc_gobject_tracking_remember(G_OBJECT(plugin_page), \
|
||||||
G_OBJECT_CLASS(klass));
|
G_OBJECT_CLASS(klass));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user