diff --git a/src/meta/meta-plugin.h b/src/meta/meta-plugin.h index afeea133e..f973ec6ce 100644 --- a/src/meta/meta-plugin.h +++ b/src/meta/meta-plugin.h @@ -312,63 +312,17 @@ struct _MetaPluginVersion META_PLUGIN_API_VERSION \ }; \ \ - static GType g_define_type_id = 0; \ + G_DEFINE_DYNAMIC_TYPE(ObjectName, object_name, META_TYPE_PLUGIN) \ \ - /* Prototypes */ \ - G_MODULE_EXPORT \ - GType object_name##_get_type (void); \ - \ - G_MODULE_EXPORT \ - GType object_name##_register_type (GTypeModule *type_module); \ - \ - G_MODULE_EXPORT \ - GType meta_plugin_register_type (GTypeModule *type_module); \ - \ - GType \ - object_name##_get_type (void) \ - { \ - return g_define_type_id; \ - } \ - \ - static void object_name##_init (ObjectName *self); \ - static void object_name##_class_init (ObjectName##Class *klass); \ - static gpointer object_name##_parent_class = NULL; \ - static void object_name##_class_intern_init (gpointer klass) \ - { \ - object_name##_parent_class = g_type_class_peek_parent (klass); \ - object_name##_class_init ((ObjectName##Class *) klass); \ - } \ - \ - GType \ - object_name##_register_type (GTypeModule *type_module) \ - { \ - static const GTypeInfo our_info = \ - { \ - sizeof (ObjectName##Class), \ - NULL, /* base_init */ \ - NULL, /* base_finalize */ \ - (GClassInitFunc) object_name##_class_intern_init, \ - NULL, \ - NULL, /* class_data */ \ - sizeof (ObjectName), \ - 0, /* n_preallocs */ \ - (GInstanceInitFunc) object_name##_init \ - }; \ - \ - g_define_type_id = g_type_module_register_type (type_module, \ - META_TYPE_PLUGIN, \ - #ObjectName, \ - &our_info, \ - 0); \ - \ - \ - return g_define_type_id; \ - } \ + /* Unused, but required by G_DEFINE_DYNAMIC_TYPE */ \ + static void \ + object_name##_class_finalize (ObjectName##Class *klass) {} \ \ G_MODULE_EXPORT GType \ meta_plugin_register_type (GTypeModule *type_module) \ { \ - return object_name##_register_type (type_module); \ + object_name##_register_type (type_module); \ + return object_name##_get_type (); \ } \ void