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
This commit is contained in:
Florian Müllner 2018-07-19 13:40:39 +02:00
parent 4fe594bf9c
commit c403785d36
9 changed files with 18 additions and 30 deletions

View File

@ -18,7 +18,7 @@
#include "backends/x11/meta-barrier-x11.h" #include "backends/x11/meta-barrier-x11.h"
#include <meta/meta-enum-types.h> #include <meta/meta-enum-types.h>
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) G_DEFINE_TYPE (MetaBarrierImpl, meta_barrier_impl, G_TYPE_OBJECT)
enum { enum {
@ -281,8 +281,6 @@ meta_barrier_class_init (MetaBarrierClass *klass)
NULL, NULL, NULL, NULL, NULL, NULL,
G_TYPE_NONE, 1, G_TYPE_NONE, 1,
META_TYPE_BARRIER_EVENT); META_TYPE_BARRIER_EVENT);
g_type_class_add_private (object_class, sizeof(MetaBarrierPrivate));
} }
void void

View File

@ -176,6 +176,7 @@ struct _MetaBackgroundActorPrivate
static void cullable_iface_init (MetaCullableInterface *iface); static void cullable_iface_init (MetaCullableInterface *iface);
G_DEFINE_TYPE_WITH_CODE (MetaBackgroundActor, meta_background_actor, CLUTTER_TYPE_ACTOR, 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)); G_IMPLEMENT_INTERFACE (META_TYPE_CULLABLE, cullable_iface_init));
static void static void
@ -653,8 +654,6 @@ meta_background_actor_class_init (MetaBackgroundActorClass *klass)
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass); ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
GParamSpec *param_spec; GParamSpec *param_spec;
g_type_class_add_private (klass, sizeof (MetaBackgroundActorPrivate));
object_class->dispose = meta_background_actor_dispose; object_class->dispose = meta_background_actor_dispose;
object_class->set_property = meta_background_actor_set_property; object_class->set_property = meta_background_actor_set_property;
object_class->get_property = meta_background_actor_get_property; object_class->get_property = meta_background_actor_get_property;

View File

@ -74,7 +74,7 @@ enum
PROP_MONITOR, 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); static gboolean texture_has_alpha (CoglTexture *texture);
@ -334,8 +334,6 @@ meta_background_class_init (MetaBackgroundClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass); GObjectClass *object_class = G_OBJECT_CLASS (klass);
GParamSpec *param_spec; GParamSpec *param_spec;
g_type_class_add_private (klass, sizeof (MetaBackgroundPrivate));
object_class->dispose = meta_background_dispose; object_class->dispose = meta_background_dispose;
object_class->finalize = meta_background_finalize; object_class->finalize = meta_background_finalize;
object_class->constructed = meta_background_constructed; object_class->constructed = meta_background_constructed;

View File

@ -41,7 +41,7 @@ struct _MetaModulePrivate
#define META_MODULE_GET_PRIVATE(obj) \ #define META_MODULE_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), META_TYPE_MODULE, MetaModulePrivate)) (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 static gboolean
meta_module_load (GTypeModule *gmodule) meta_module_load (GTypeModule *gmodule)
@ -184,8 +184,6 @@ meta_module_class_init (MetaModuleClass *klass)
NULL, NULL,
G_PARAM_READWRITE | G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY)); G_PARAM_CONSTRUCT_ONLY));
g_type_class_add_private (gobject_class, sizeof (MetaModulePrivate));
} }
static void static void

View File

@ -41,20 +41,19 @@
#include "meta-window-actor-private.h" #include "meta-window-actor-private.h"
#include "meta-monitor-manager-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 struct _MetaPluginPrivate
{ {
MetaCompositor *compositor; 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 static void
meta_plugin_class_init (MetaPluginClass *klass) meta_plugin_class_init (MetaPluginClass *klass)
{ {
g_type_class_add_private (klass, sizeof (MetaPluginPrivate));
} }
static void static void

View File

@ -70,9 +70,6 @@ static gboolean meta_shaped_texture_get_paint_volume (ClutterActor *self, Clutte
static void cullable_iface_init (MetaCullableInterface *iface); 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) \ #define META_SHAPED_TEXTURE_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), META_TYPE_SHAPED_TEXTURE, \ (G_TYPE_INSTANCE_GET_PRIVATE ((obj), META_TYPE_SHAPED_TEXTURE, \
MetaShapedTexturePrivate)) MetaShapedTexturePrivate))
@ -117,6 +114,10 @@ struct _MetaShapedTexturePrivate
guint create_mipmaps : 1; 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 static void
meta_shaped_texture_class_init (MetaShapedTextureClass *klass) meta_shaped_texture_class_init (MetaShapedTextureClass *klass)
{ {
@ -136,8 +137,6 @@ meta_shaped_texture_class_init (MetaShapedTextureClass *klass)
0, 0,
NULL, NULL, NULL, NULL, NULL, NULL,
G_TYPE_NONE, 0); G_TYPE_NONE, 0);
g_type_class_add_private (klass, sizeof (MetaShapedTexturePrivate));
} }
static void static void

View File

@ -32,6 +32,7 @@ struct _MetaSurfaceActorPrivate
static void cullable_iface_init (MetaCullableInterface *iface); static void cullable_iface_init (MetaCullableInterface *iface);
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (MetaSurfaceActor, meta_surface_actor, CLUTTER_TYPE_ACTOR, 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)); G_IMPLEMENT_INTERFACE (META_TYPE_CULLABLE, cullable_iface_init));
enum { enum {
@ -142,8 +143,6 @@ meta_surface_actor_class_init (MetaSurfaceActorClass *klass)
0, 0,
NULL, NULL, NULL, NULL, NULL, NULL,
G_TYPE_NONE, 0); G_TYPE_NONE, 0);
g_type_class_add_private (klass, sizeof (MetaSurfaceActorPrivate));
} }
static void static void

View File

@ -191,6 +191,7 @@ static void do_send_frame_timings (MetaWindowActor *self,
static void cullable_iface_init (MetaCullableInterface *iface); static void cullable_iface_init (MetaCullableInterface *iface);
G_DEFINE_TYPE_WITH_CODE (MetaWindowActor, meta_window_actor, CLUTTER_TYPE_ACTOR, 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)); G_IMPLEMENT_INTERFACE (META_TYPE_CULLABLE, cullable_iface_init));
static void static void
@ -206,8 +207,6 @@ meta_window_actor_class_init (MetaWindowActorClass *klass)
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass); ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
GParamSpec *pspec; GParamSpec *pspec;
g_type_class_add_private (klass, sizeof (MetaWindowActorPrivate));
object_class->dispose = meta_window_actor_dispose; object_class->dispose = meta_window_actor_dispose;
object_class->finalize = meta_window_actor_finalize; object_class->finalize = meta_window_actor_finalize;
object_class->set_property = meta_window_actor_set_property; object_class->set_property = meta_window_actor_set_property;

View File

@ -98,8 +98,6 @@ static void confirm_display_change (MetaPlugin *plugin);
static const MetaPluginInfo * plugin_info (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. * Plugin private data that we store in the .plugin_private member.
*/ */
@ -116,6 +114,9 @@ struct _MetaDefaultPluginPrivate
MetaPluginInfo info; 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. * 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_window_effects = kill_window_effects;
plugin_class->kill_switch_workspace = kill_switch_workspace; plugin_class->kill_switch_workspace = kill_switch_workspace;
plugin_class->confirm_display_change = confirm_display_change; plugin_class->confirm_display_change = confirm_display_change;
g_type_class_add_private (gobject_class, sizeof (MetaDefaultPluginPrivate));
} }
static void static void