From c403785d363ac82c527ee18644a0caebeb3a8ad7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 19 Jul 2018 13:40:39 +0200 Subject: [PATCH] Stop using g_type_class_add_private() It is now deprecated in favor of the G_ADD_PRIVATE() macro (usually called via G_DEFINE_WITH_PRIVATE()). https://gitlab.gnome.org/GNOME/mutter/merge_requests/176 --- src/backends/meta-barrier.c | 4 +--- src/compositor/meta-background-actor.c | 3 +-- src/compositor/meta-background.c | 4 +--- src/compositor/meta-module.c | 4 +--- src/compositor/meta-plugin.c | 11 +++++------ src/compositor/meta-shaped-texture.c | 9 ++++----- src/compositor/meta-surface-actor.c | 3 +-- src/compositor/meta-window-actor.c | 3 +-- src/compositor/plugins/default.c | 7 +++---- 9 files changed, 18 insertions(+), 30 deletions(-) diff --git a/src/backends/meta-barrier.c b/src/backends/meta-barrier.c index a1e1180fe..4449076a6 100644 --- a/src/backends/meta-barrier.c +++ b/src/backends/meta-barrier.c @@ -18,7 +18,7 @@ #include "backends/x11/meta-barrier-x11.h" #include -G_DEFINE_TYPE (MetaBarrier, meta_barrier, G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE (MetaBarrier, meta_barrier, G_TYPE_OBJECT) G_DEFINE_TYPE (MetaBarrierImpl, meta_barrier_impl, G_TYPE_OBJECT) enum { @@ -281,8 +281,6 @@ meta_barrier_class_init (MetaBarrierClass *klass) NULL, NULL, NULL, G_TYPE_NONE, 1, META_TYPE_BARRIER_EVENT); - - g_type_class_add_private (object_class, sizeof(MetaBarrierPrivate)); } void diff --git a/src/compositor/meta-background-actor.c b/src/compositor/meta-background-actor.c index b417fad8f..9475ba73b 100644 --- a/src/compositor/meta-background-actor.c +++ b/src/compositor/meta-background-actor.c @@ -176,6 +176,7 @@ struct _MetaBackgroundActorPrivate static void cullable_iface_init (MetaCullableInterface *iface); G_DEFINE_TYPE_WITH_CODE (MetaBackgroundActor, meta_background_actor, CLUTTER_TYPE_ACTOR, + G_ADD_PRIVATE (MetaBackgroundActor) G_IMPLEMENT_INTERFACE (META_TYPE_CULLABLE, cullable_iface_init)); static void @@ -653,8 +654,6 @@ meta_background_actor_class_init (MetaBackgroundActorClass *klass) ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass); GParamSpec *param_spec; - g_type_class_add_private (klass, sizeof (MetaBackgroundActorPrivate)); - object_class->dispose = meta_background_actor_dispose; object_class->set_property = meta_background_actor_set_property; object_class->get_property = meta_background_actor_get_property; diff --git a/src/compositor/meta-background.c b/src/compositor/meta-background.c index a6d41a4d6..23f7832ef 100644 --- a/src/compositor/meta-background.c +++ b/src/compositor/meta-background.c @@ -74,7 +74,7 @@ enum PROP_MONITOR, }; -G_DEFINE_TYPE (MetaBackground, meta_background, G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE (MetaBackground, meta_background, G_TYPE_OBJECT) static gboolean texture_has_alpha (CoglTexture *texture); @@ -334,8 +334,6 @@ meta_background_class_init (MetaBackgroundClass *klass) GObjectClass *object_class = G_OBJECT_CLASS (klass); GParamSpec *param_spec; - g_type_class_add_private (klass, sizeof (MetaBackgroundPrivate)); - object_class->dispose = meta_background_dispose; object_class->finalize = meta_background_finalize; object_class->constructed = meta_background_constructed; diff --git a/src/compositor/meta-module.c b/src/compositor/meta-module.c index c78bef785..6bb80d376 100644 --- a/src/compositor/meta-module.c +++ b/src/compositor/meta-module.c @@ -41,7 +41,7 @@ struct _MetaModulePrivate #define META_MODULE_GET_PRIVATE(obj) \ (G_TYPE_INSTANCE_GET_PRIVATE ((obj), META_TYPE_MODULE, MetaModulePrivate)) -G_DEFINE_TYPE (MetaModule, meta_module, G_TYPE_TYPE_MODULE); +G_DEFINE_TYPE_WITH_PRIVATE (MetaModule, meta_module, G_TYPE_TYPE_MODULE); static gboolean meta_module_load (GTypeModule *gmodule) @@ -184,8 +184,6 @@ meta_module_class_init (MetaModuleClass *klass) NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); - - g_type_class_add_private (gobject_class, sizeof (MetaModulePrivate)); } static void diff --git a/src/compositor/meta-plugin.c b/src/compositor/meta-plugin.c index 15a7ffd50..c613a5020 100644 --- a/src/compositor/meta-plugin.c +++ b/src/compositor/meta-plugin.c @@ -41,20 +41,19 @@ #include "meta-window-actor-private.h" #include "meta-monitor-manager-private.h" -G_DEFINE_ABSTRACT_TYPE (MetaPlugin, meta_plugin, G_TYPE_OBJECT); - -#define META_PLUGIN_GET_PRIVATE(obj) \ -(G_TYPE_INSTANCE_GET_PRIVATE ((obj), META_TYPE_PLUGIN, MetaPluginPrivate)) - struct _MetaPluginPrivate { MetaCompositor *compositor; }; +G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (MetaPlugin, meta_plugin, G_TYPE_OBJECT); + +#define META_PLUGIN_GET_PRIVATE(obj) \ +(G_TYPE_INSTANCE_GET_PRIVATE ((obj), META_TYPE_PLUGIN, MetaPluginPrivate)) + static void meta_plugin_class_init (MetaPluginClass *klass) { - g_type_class_add_private (klass, sizeof (MetaPluginPrivate)); } static void diff --git a/src/compositor/meta-shaped-texture.c b/src/compositor/meta-shaped-texture.c index 6f4d3acbb..eb8d19080 100644 --- a/src/compositor/meta-shaped-texture.c +++ b/src/compositor/meta-shaped-texture.c @@ -70,9 +70,6 @@ static gboolean meta_shaped_texture_get_paint_volume (ClutterActor *self, Clutte static void cullable_iface_init (MetaCullableInterface *iface); -G_DEFINE_TYPE_WITH_CODE (MetaShapedTexture, meta_shaped_texture, CLUTTER_TYPE_ACTOR, - G_IMPLEMENT_INTERFACE (META_TYPE_CULLABLE, cullable_iface_init)); - #define META_SHAPED_TEXTURE_GET_PRIVATE(obj) \ (G_TYPE_INSTANCE_GET_PRIVATE ((obj), META_TYPE_SHAPED_TEXTURE, \ MetaShapedTexturePrivate)) @@ -117,6 +114,10 @@ struct _MetaShapedTexturePrivate guint create_mipmaps : 1; }; +G_DEFINE_TYPE_WITH_CODE (MetaShapedTexture, meta_shaped_texture, CLUTTER_TYPE_ACTOR, + G_ADD_PRIVATE (MetaShapedTexture) + G_IMPLEMENT_INTERFACE (META_TYPE_CULLABLE, cullable_iface_init)); + static void meta_shaped_texture_class_init (MetaShapedTextureClass *klass) { @@ -136,8 +137,6 @@ meta_shaped_texture_class_init (MetaShapedTextureClass *klass) 0, NULL, NULL, NULL, G_TYPE_NONE, 0); - - g_type_class_add_private (klass, sizeof (MetaShapedTexturePrivate)); } static void diff --git a/src/compositor/meta-surface-actor.c b/src/compositor/meta-surface-actor.c index 9acfab1f0..b1d246e15 100644 --- a/src/compositor/meta-surface-actor.c +++ b/src/compositor/meta-surface-actor.c @@ -32,6 +32,7 @@ struct _MetaSurfaceActorPrivate static void cullable_iface_init (MetaCullableInterface *iface); G_DEFINE_ABSTRACT_TYPE_WITH_CODE (MetaSurfaceActor, meta_surface_actor, CLUTTER_TYPE_ACTOR, + G_ADD_PRIVATE (MetaSurfaceActor) G_IMPLEMENT_INTERFACE (META_TYPE_CULLABLE, cullable_iface_init)); enum { @@ -142,8 +143,6 @@ meta_surface_actor_class_init (MetaSurfaceActorClass *klass) 0, NULL, NULL, NULL, G_TYPE_NONE, 0); - - g_type_class_add_private (klass, sizeof (MetaSurfaceActorPrivate)); } static void diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c index 50ccecee3..df7b8d7ca 100644 --- a/src/compositor/meta-window-actor.c +++ b/src/compositor/meta-window-actor.c @@ -191,6 +191,7 @@ static void do_send_frame_timings (MetaWindowActor *self, static void cullable_iface_init (MetaCullableInterface *iface); G_DEFINE_TYPE_WITH_CODE (MetaWindowActor, meta_window_actor, CLUTTER_TYPE_ACTOR, + G_ADD_PRIVATE (MetaWindowActor) G_IMPLEMENT_INTERFACE (META_TYPE_CULLABLE, cullable_iface_init)); static void @@ -206,8 +207,6 @@ meta_window_actor_class_init (MetaWindowActorClass *klass) ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass); GParamSpec *pspec; - g_type_class_add_private (klass, sizeof (MetaWindowActorPrivate)); - object_class->dispose = meta_window_actor_dispose; object_class->finalize = meta_window_actor_finalize; object_class->set_property = meta_window_actor_set_property; diff --git a/src/compositor/plugins/default.c b/src/compositor/plugins/default.c index 12adbf245..a29b73d40 100644 --- a/src/compositor/plugins/default.c +++ b/src/compositor/plugins/default.c @@ -98,8 +98,6 @@ static void confirm_display_change (MetaPlugin *plugin); static const MetaPluginInfo * plugin_info (MetaPlugin *plugin); -META_PLUGIN_DECLARE(MetaDefaultPlugin, meta_default_plugin); - /* * Plugin private data that we store in the .plugin_private member. */ @@ -116,6 +114,9 @@ struct _MetaDefaultPluginPrivate MetaPluginInfo info; }; +META_PLUGIN_DECLARE_WITH_CODE (MetaDefaultPlugin, meta_default_plugin, + G_ADD_PRIVATE_DYNAMIC (MetaDefaultPlugin)); + /* * Per actor private data we attach to each actor. */ @@ -209,8 +210,6 @@ meta_default_plugin_class_init (MetaDefaultPluginClass *klass) plugin_class->kill_window_effects = kill_window_effects; plugin_class->kill_switch_workspace = kill_switch_workspace; plugin_class->confirm_display_change = confirm_display_change; - - g_type_class_add_private (gobject_class, sizeof (MetaDefaultPluginPrivate)); } static void