mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 01:20:42 -05:00
plugin: Simplify META_PLUGIN_DECLARE() macro
It's mostly boilerplate that G_DEFINE_DYNAMIC_TYPE() can take care of, so use that internally. https://gitlab.gnome.org/GNOME/mutter/merge_requests/176
This commit is contained in:
parent
3d75b48d50
commit
43eb724b94
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user