plugin: Add META_DECLARE_PLUGIN_WITH_CODE() variant

Thanks to G_DEFINE_DYNAMIC_TYPE_EXTENDED(), this is a trivial addition that
will allow using G_IMPLEMENT_INTERFACE_DYNAMIC() or G_ADD_PRIVATE_DYNAMIC()
when declaring a plugin.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/176
This commit is contained in:
Florian Müllner 2018-07-23 20:29:02 +02:00
parent 43eb724b94
commit ec451b4674

View File

@ -303,7 +303,7 @@ struct _MetaPluginVersion
/* /*
* Convenience macro to set up the plugin type. Based on GEdit. * Convenience macro to set up the plugin type. Based on GEdit.
*/ */
#define META_PLUGIN_DECLARE(ObjectName, object_name) \ #define META_PLUGIN_DECLARE_WITH_CODE(ObjectName, object_name, CODE) \
G_MODULE_EXPORT MetaPluginVersion meta_plugin_version = \ G_MODULE_EXPORT MetaPluginVersion meta_plugin_version = \
{ \ { \
META_MAJOR_VERSION, \ META_MAJOR_VERSION, \
@ -312,7 +312,8 @@ struct _MetaPluginVersion
META_PLUGIN_API_VERSION \ META_PLUGIN_API_VERSION \
}; \ }; \
\ \
G_DEFINE_DYNAMIC_TYPE(ObjectName, object_name, META_TYPE_PLUGIN) \ G_DEFINE_DYNAMIC_TYPE_EXTENDED(ObjectName, object_name, \
META_TYPE_PLUGIN, 0, CODE) \
\ \
/* Unused, but required by G_DEFINE_DYNAMIC_TYPE */ \ /* Unused, but required by G_DEFINE_DYNAMIC_TYPE */ \
static void \ static void \
@ -325,6 +326,9 @@ struct _MetaPluginVersion
return object_name##_get_type (); \ return object_name##_get_type (); \
} \ } \
#define META_PLUGIN_DECLARE(ObjectName, object_name) \
META_PLUGIN_DECLARE_WITH_CODE(ObjectName, object_name, {})
void void
meta_plugin_switch_workspace_completed (MetaPlugin *plugin); meta_plugin_switch_workspace_completed (MetaPlugin *plugin);