diff --git a/clutter/clutter-actor-meta.c b/clutter/clutter-actor-meta.c index a58c773c5..583e81693 100644 --- a/clutter/clutter-actor-meta.c +++ b/clutter/clutter-actor-meta.c @@ -75,9 +75,9 @@ enum static GParamSpec *obj_props[PROP_LAST]; -G_DEFINE_ABSTRACT_TYPE (ClutterActorMeta, - clutter_actor_meta, - G_TYPE_INITIALLY_UNOWNED); +G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (ClutterActorMeta, + clutter_actor_meta, + G_TYPE_INITIALLY_UNOWNED) static void on_actor_destroy (ClutterActor *actor, @@ -177,8 +177,6 @@ clutter_actor_meta_class_init (ClutterActorMetaClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - g_type_class_add_private (klass, sizeof (ClutterActorMetaPrivate)); - klass->set_actor = clutter_actor_meta_real_set_actor; /** @@ -234,12 +232,8 @@ clutter_actor_meta_class_init (ClutterActorMetaClass *klass) void clutter_actor_meta_init (ClutterActorMeta *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, - CLUTTER_TYPE_ACTOR_META, - ClutterActorMetaPrivate); - + self->priv = clutter_actor_meta_get_instance_private (self); self->priv->is_enabled = TRUE; - self->priv->priority = CLUTTER_ACTOR_META_PRIORITY_DEFAULT; } diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index 9b4ded58c..5d378a0be 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -628,9 +628,6 @@ #include "deprecated/clutter-behaviour.h" #include "deprecated/clutter-container.h" -#define CLUTTER_ACTOR_GET_PRIVATE(obj) \ -(G_TYPE_INSTANCE_GET_PRIVATE ((obj), CLUTTER_TYPE_ACTOR, ClutterActorPrivate)) - /* Internal enum used to control mapped state update. This is a hint * which indicates when to do something other than just enforce * invariants. @@ -1086,6 +1083,7 @@ static GQuark quark_actor_animation_info = 0; G_DEFINE_TYPE_WITH_CODE (ClutterActor, clutter_actor, G_TYPE_INITIALLY_UNOWNED, + G_ADD_PRIVATE (ClutterActor) G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_CONTAINER, clutter_container_iface_init) G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_SCRIPTABLE, @@ -6149,8 +6147,6 @@ clutter_actor_class_init (ClutterActorClass *klass) klass->paint = clutter_actor_real_paint; klass->destroy = clutter_actor_real_destroy; - g_type_class_add_private (klass, sizeof (ClutterActorPrivate)); - /** * ClutterActor:x: * @@ -8329,7 +8325,7 @@ clutter_actor_init (ClutterActor *self) { ClutterActorPrivate *priv; - self->priv = priv = CLUTTER_ACTOR_GET_PRIVATE (self); + self->priv = priv = clutter_actor_get_instance_private (self); priv->id = _clutter_context_acquire_id (self); priv->pick_id = -1; @@ -16104,7 +16100,7 @@ clutter_actor_get_text_direction (ClutterActor *self) * static void * my_actor_init (MyActor *self) * { - * self->priv = SELF_ACTOR_GET_PRIVATE (self); + * self->priv = my_actor_get_instance_private (self); * * clutter_actor_push_internal (CLUTTER_ACTOR (self)); * diff --git a/clutter/clutter-backend.c b/clutter/clutter-backend.c index c174ae817..55f0e1b21 100644 --- a/clutter/clutter-backend.c +++ b/clutter/clutter-backend.c @@ -93,13 +93,8 @@ #include "wayland/clutter-wayland-compositor.h" #endif -G_DEFINE_ABSTRACT_TYPE (ClutterBackend, clutter_backend, G_TYPE_OBJECT); - #define DEFAULT_FONT_NAME "Sans 10" -#define CLUTTER_BACKEND_GET_PRIVATE(obj) \ -(G_TYPE_INSTANCE_GET_PRIVATE ((obj), CLUTTER_TYPE_BACKEND, ClutterBackendPrivate)) - struct _ClutterBackendPrivate { cairo_font_options_t *font_options; @@ -121,6 +116,8 @@ enum LAST_SIGNAL }; +G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (ClutterBackend, clutter_backend, G_TYPE_OBJECT) + static guint backend_signals[LAST_SIGNAL] = { 0, }; /* Global for being able to specify a compositor side wayland display @@ -591,8 +588,6 @@ clutter_backend_class_init (ClutterBackendClass *klass) gobject_class->dispose = clutter_backend_dispose; gobject_class->finalize = clutter_backend_finalize; - g_type_class_add_private (gobject_class, sizeof (ClutterBackendPrivate)); - klass->stage_window_type = G_TYPE_INVALID; /** @@ -662,14 +657,11 @@ clutter_backend_class_init (ClutterBackendClass *klass) } static void -clutter_backend_init (ClutterBackend *backend) +clutter_backend_init (ClutterBackend *self) { - ClutterBackendPrivate *priv; - - priv = backend->priv = CLUTTER_BACKEND_GET_PRIVATE (backend); - - priv->units_per_em = -1.0; - priv->units_serial = 1; + self->priv = clutter_backend_get_instance_private (self); + self->priv->units_per_em = -1.0; + self->priv->units_serial = 1; } void diff --git a/clutter/clutter-bin-layout.c b/clutter/clutter-bin-layout.c index de7370ee7..a0a4ec5f4 100644 --- a/clutter/clutter-bin-layout.c +++ b/clutter/clutter-bin-layout.c @@ -83,8 +83,6 @@ #define CLUTTER_BIN_LAYER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BIN_LAYER, ClutterBinLayer)) #define CLUTTER_IS_BIN_LAYER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_BIN_LAYER)) -#define CLUTTER_BIN_LAYOUT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CLUTTER_TYPE_BIN_LAYOUT, ClutterBinLayoutPrivate)) - typedef struct _ClutterBinLayer ClutterBinLayer; typedef struct _ClutterLayoutMetaClass ClutterBinLayerClass; @@ -131,11 +129,11 @@ GType clutter_bin_layer_get_type (void); G_DEFINE_TYPE (ClutterBinLayer, clutter_bin_layer, - CLUTTER_TYPE_LAYOUT_META); + CLUTTER_TYPE_LAYOUT_META) -G_DEFINE_TYPE (ClutterBinLayout, - clutter_bin_layout, - CLUTTER_TYPE_LAYOUT_MANAGER); +G_DEFINE_TYPE_WITH_PRIVATE (ClutterBinLayout, + clutter_bin_layout, + CLUTTER_TYPE_LAYOUT_MANAGER) /* * ClutterBinLayer @@ -637,8 +635,6 @@ clutter_bin_layout_class_init (ClutterBinLayoutClass *klass) ClutterLayoutManagerClass *layout_class = CLUTTER_LAYOUT_MANAGER_CLASS (klass); - g_type_class_add_private (klass, sizeof (ClutterBinLayoutPrivate)); - /** * ClutterBinLayout:x-align: * @@ -694,7 +690,7 @@ clutter_bin_layout_class_init (ClutterBinLayoutClass *klass) static void clutter_bin_layout_init (ClutterBinLayout *self) { - self->priv = CLUTTER_BIN_LAYOUT_GET_PRIVATE (self); + self->priv = clutter_bin_layout_get_instance_private (self); self->priv->x_align = CLUTTER_BIN_ALIGNMENT_CENTER; self->priv->y_align = CLUTTER_BIN_ALIGNMENT_CENTER; diff --git a/clutter/clutter-box-layout.c b/clutter/clutter-box-layout.c index a87b32bf2..b9c2c68c0 100644 --- a/clutter/clutter-box-layout.c +++ b/clutter/clutter-box-layout.c @@ -85,8 +85,6 @@ #define CLUTTER_BOX_CHILD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BOX_CHILD, ClutterBoxChild)) #define CLUTTER_IS_BOX_CHILD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_BOX_CHILD)) -#define CLUTTER_BOX_LAYOUT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CLUTTER_TYPE_BOX_LAYOUT, ClutterBoxLayoutPrivate)) - typedef struct _ClutterBoxChild ClutterBoxChild; typedef struct _ClutterLayoutMetaClass ClutterBoxChildClass; @@ -153,11 +151,11 @@ GType clutter_box_child_get_type (void); G_DEFINE_TYPE (ClutterBoxChild, clutter_box_child, - CLUTTER_TYPE_LAYOUT_META); + CLUTTER_TYPE_LAYOUT_META) -G_DEFINE_TYPE (ClutterBoxLayout, - clutter_box_layout, - CLUTTER_TYPE_LAYOUT_MANAGER); +G_DEFINE_TYPE_WITH_PRIVATE (ClutterBoxLayout, + clutter_box_layout, + CLUTTER_TYPE_LAYOUT_MANAGER) typedef struct _RequestedSize @@ -1348,8 +1346,6 @@ clutter_box_layout_class_init (ClutterBoxLayoutClass *klass) layout_class->set_container = clutter_box_layout_set_container; layout_class->get_child_meta_type = clutter_box_layout_get_child_meta_type; - g_type_class_add_private (klass, sizeof (ClutterBoxLayoutPrivate)); - /** * ClutterBoxLayout:vertical: * @@ -1503,20 +1499,18 @@ clutter_box_layout_class_init (ClutterBoxLayoutClass *klass) } static void -clutter_box_layout_init (ClutterBoxLayout *layout) +clutter_box_layout_init (ClutterBoxLayout *self) { - ClutterBoxLayoutPrivate *priv; + self->priv = clutter_box_layout_get_instance_private (self); - layout->priv = priv = CLUTTER_BOX_LAYOUT_GET_PRIVATE (layout); + self->priv->orientation = CLUTTER_ORIENTATION_HORIZONTAL; + self->priv->is_homogeneous = FALSE; + self->priv->is_pack_start = FALSE; + self->priv->spacing = 0; - priv->orientation = CLUTTER_ORIENTATION_HORIZONTAL; - priv->is_homogeneous = FALSE; - priv->is_pack_start = FALSE; - priv->spacing = 0; - - priv->use_animations = FALSE; - priv->easing_mode = CLUTTER_EASE_OUT_CUBIC; - priv->easing_duration = 500; + self->priv->use_animations = FALSE; + self->priv->easing_mode = CLUTTER_EASE_OUT_CUBIC; + self->priv->easing_duration = 500; } /** diff --git a/clutter/clutter-canvas.c b/clutter/clutter-canvas.c index d7cf90bf2..482bdd13e 100644 --- a/clutter/clutter-canvas.c +++ b/clutter/clutter-canvas.c @@ -101,6 +101,7 @@ static guint canvas_signals[LAST_SIGNAL] = { 0, }; static void clutter_content_iface_init (ClutterContentIface *iface); G_DEFINE_TYPE_WITH_CODE (ClutterCanvas, clutter_canvas, G_TYPE_OBJECT, + G_ADD_PRIVATE (ClutterCanvas) G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_CONTENT, clutter_content_iface_init)) @@ -211,8 +212,6 @@ clutter_canvas_class_init (ClutterCanvasClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - g_type_class_add_private (klass, sizeof (ClutterCanvasPrivate)); - /** * ClutterCanvas:width: * @@ -286,9 +285,7 @@ clutter_canvas_class_init (ClutterCanvasClass *klass) static void clutter_canvas_init (ClutterCanvas *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, CLUTTER_TYPE_CANVAS, - ClutterCanvasPrivate); - + self->priv = clutter_canvas_get_instance_private (self); self->priv->width = -1; self->priv->height = -1; } diff --git a/clutter/clutter-click-action.c b/clutter/clutter-click-action.c index 3fe164cfa..8e7963cf1 100644 --- a/clutter/clutter-click-action.c +++ b/clutter/clutter-click-action.c @@ -150,7 +150,7 @@ enum static guint click_signals[LAST_SIGNAL] = { 0, }; -G_DEFINE_TYPE (ClutterClickAction, clutter_click_action, CLUTTER_TYPE_ACTION); +G_DEFINE_TYPE_WITH_PRIVATE (ClutterClickAction, clutter_click_action, CLUTTER_TYPE_ACTION) /* forward declaration */ static gboolean on_captured_event (ClutterActor *stage, @@ -540,8 +540,6 @@ clutter_click_action_class_init (ClutterClickActionClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); ClutterActorMetaClass *meta_class = CLUTTER_ACTOR_META_CLASS (klass); - g_type_class_add_private (klass, sizeof (ClutterClickActionPrivate)); - meta_class->set_actor = clutter_click_action_set_actor; gobject_class->set_property = clutter_click_action_set_property; @@ -680,9 +678,7 @@ clutter_click_action_class_init (ClutterClickActionClass *klass) static void clutter_click_action_init (ClutterClickAction *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, CLUTTER_TYPE_CLICK_ACTION, - ClutterClickActionPrivate); - + self->priv = clutter_click_action_get_instance_private (self); self->priv->long_press_threshold = -1; self->priv->long_press_duration = -1; } diff --git a/clutter/clutter-clone.c b/clutter/clutter-clone.c index 1f94ab2b7..3de1c0505 100644 --- a/clutter/clutter-clone.c +++ b/clutter/clutter-clone.c @@ -50,7 +50,12 @@ #include "cogl/cogl.h" -G_DEFINE_TYPE (ClutterClone, clutter_clone, CLUTTER_TYPE_ACTOR); +struct _ClutterClonePrivate +{ + ClutterActor *clone_source; +}; + +G_DEFINE_TYPE_WITH_PRIVATE (ClutterClone, clutter_clone, CLUTTER_TYPE_ACTOR) enum { @@ -63,13 +68,6 @@ enum static GParamSpec *obj_props[PROP_LAST]; -#define CLUTTER_CLONE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CLUTTER_TYPE_CLONE, ClutterClonePrivate)) - -struct _ClutterClonePrivate -{ - ClutterActor *clone_source; -}; - static void clutter_clone_set_source_internal (ClutterClone *clone, ClutterActor *source); static void @@ -319,8 +317,6 @@ clutter_clone_class_init (ClutterCloneClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass); - g_type_class_add_private (gobject_class, sizeof (ClutterClonePrivate)); - actor_class->apply_transform = clutter_clone_apply_transform; actor_class->paint = clutter_clone_paint; actor_class->get_paint_volume = clutter_clone_get_paint_volume; @@ -354,11 +350,7 @@ clutter_clone_class_init (ClutterCloneClass *klass) static void clutter_clone_init (ClutterClone *self) { - ClutterClonePrivate *priv; - - self->priv = priv = CLUTTER_CLONE_GET_PRIVATE (self); - - priv->clone_source = NULL; + self->priv = clutter_clone_get_instance_private (self); } /** diff --git a/clutter/clutter-deform-effect.c b/clutter/clutter-deform-effect.c index 655117d77..f619505bc 100644 --- a/clutter/clutter-deform-effect.c +++ b/clutter/clutter-deform-effect.c @@ -102,9 +102,9 @@ enum static GParamSpec *obj_props[PROP_LAST]; -G_DEFINE_ABSTRACT_TYPE (ClutterDeformEffect, - clutter_deform_effect, - CLUTTER_TYPE_OFFSCREEN_EFFECT); +G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (ClutterDeformEffect, + clutter_deform_effect, + CLUTTER_TYPE_OFFSCREEN_EFFECT) static void clutter_deform_effect_real_deform_vertex (ClutterDeformEffect *effect, @@ -577,8 +577,6 @@ clutter_deform_effect_class_init (ClutterDeformEffectClass *klass) ClutterActorMetaClass *meta_class = CLUTTER_ACTOR_META_CLASS (klass); ClutterOffscreenEffectClass *offscreen_class = CLUTTER_OFFSCREEN_EFFECT_CLASS (klass); - g_type_class_add_private (klass, sizeof (ClutterDeformEffectPrivate)); - klass->deform_vertex = clutter_deform_effect_real_deform_vertex; /** @@ -645,9 +643,7 @@ clutter_deform_effect_class_init (ClutterDeformEffectClass *klass) static void clutter_deform_effect_init (ClutterDeformEffect *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, CLUTTER_TYPE_DEFORM_EFFECT, - ClutterDeformEffectPrivate); - + self->priv = clutter_deform_effect_get_instance_private (self); self->priv->x_tiles = self->priv->y_tiles = DEFAULT_N_TILES; self->priv->back_pipeline = NULL; diff --git a/clutter/clutter-device-manager.c b/clutter/clutter-device-manager.c index 2dc67be01..d4bb6b247 100644 --- a/clutter/clutter-device-manager.c +++ b/clutter/clutter-device-manager.c @@ -48,8 +48,6 @@ #include "clutter-private.h" #include "clutter-stage-private.h" -#define CLUTTER_DEVICE_MANAGER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CLUTTER_TYPE_DEVICE_MANAGER, ClutterDeviceManagerPrivate)) - struct _ClutterDeviceManagerPrivate { /* back-pointer to the backend */ @@ -77,9 +75,9 @@ enum static guint manager_signals[LAST_SIGNAL] = { 0, }; -G_DEFINE_ABSTRACT_TYPE (ClutterDeviceManager, - clutter_device_manager, - G_TYPE_OBJECT); +G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (ClutterDeviceManager, + clutter_device_manager, + G_TYPE_OBJECT) static void clutter_device_manager_set_property (GObject *gobject, @@ -124,8 +122,6 @@ clutter_device_manager_class_init (ClutterDeviceManagerClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - g_type_class_add_private (klass, sizeof (ClutterDeviceManagerPrivate)); - obj_props[PROP_BACKEND] = g_param_spec_object ("backend", P_("Backend"), @@ -183,7 +179,7 @@ clutter_device_manager_class_init (ClutterDeviceManagerClass *klass) static void clutter_device_manager_init (ClutterDeviceManager *self) { - self->priv = CLUTTER_DEVICE_MANAGER_GET_PRIVATE (self); + self->priv = clutter_device_manager_get_instance_private (self); } /** diff --git a/clutter/clutter-drag-action.c b/clutter/clutter-drag-action.c index 669240c1b..e88de02cb 100644 --- a/clutter/clutter-drag-action.c +++ b/clutter/clutter-drag-action.c @@ -150,7 +150,7 @@ static gboolean on_captured_event (ClutterActor *stage, ClutterEvent *event, ClutterDragAction *action); -G_DEFINE_TYPE (ClutterDragAction, clutter_drag_action, CLUTTER_TYPE_ACTION); +G_DEFINE_TYPE_WITH_PRIVATE (ClutterDragAction, clutter_drag_action, CLUTTER_TYPE_ACTION) static void get_drag_threshold (ClutterDragAction *action, @@ -710,8 +710,6 @@ clutter_drag_action_class_init (ClutterDragActionClass *klass) ClutterActorMetaClass *meta_class = CLUTTER_ACTOR_META_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - g_type_class_add_private (klass, sizeof (ClutterDragActionPrivate)); - meta_class->set_actor = clutter_drag_action_set_actor; klass->drag_progress = clutter_drag_action_real_drag_progress; @@ -991,8 +989,7 @@ clutter_drag_action_class_init (ClutterDragActionClass *klass) static void clutter_drag_action_init (ClutterDragAction *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, CLUTTER_TYPE_DRAG_ACTION, - ClutterDragActionPrivate); + self->priv = clutter_drag_action_get_instance_private (self); } /** diff --git a/clutter/clutter-drop-action.c b/clutter/clutter-drop-action.c index adf6aeb9f..7f71ae3a1 100644 --- a/clutter/clutter-drop-action.c +++ b/clutter/clutter-drop-action.c @@ -108,7 +108,7 @@ enum static guint drop_signals[LAST_SIGNAL] = { 0, }; -G_DEFINE_TYPE (ClutterDropAction, clutter_drop_action, CLUTTER_TYPE_ACTION) +G_DEFINE_TYPE_WITH_PRIVATE (ClutterDropAction, clutter_drop_action, CLUTTER_TYPE_ACTION) static void drop_target_free (gpointer _data) @@ -384,8 +384,6 @@ clutter_drop_action_class_init (ClutterDropActionClass *klass) { ClutterActorMetaClass *meta_class = CLUTTER_ACTOR_META_CLASS (klass); - g_type_class_add_private (klass, sizeof (ClutterDropActionPrivate)); - meta_class->set_actor = clutter_drop_action_set_actor; klass->can_drop = clutter_drop_action_real_can_drop; @@ -518,8 +516,7 @@ clutter_drop_action_class_init (ClutterDropActionClass *klass) static void clutter_drop_action_init (ClutterDropAction *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, CLUTTER_TYPE_DROP_ACTION, - ClutterDropActionPrivate); + self->priv = clutter_drop_action_get_instance_private (self); } /** diff --git a/clutter/clutter-flow-layout.c b/clutter/clutter-flow-layout.c index 094c55236..eb23b53de 100644 --- a/clutter/clutter-flow-layout.c +++ b/clutter/clutter-flow-layout.c @@ -85,8 +85,6 @@ #include "clutter-layout-meta.h" #include "clutter-private.h" -#define CLUTTER_FLOW_LAYOUT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CLUTTER_TYPE_FLOW_LAYOUT, ClutterFlowLayoutPrivate)) - struct _ClutterFlowLayoutPrivate { ClutterContainer *container; @@ -139,9 +137,9 @@ enum static GParamSpec *flow_properties[N_PROPERTIES] = { NULL, }; -G_DEFINE_TYPE (ClutterFlowLayout, - clutter_flow_layout, - CLUTTER_TYPE_LAYOUT_MANAGER); +G_DEFINE_TYPE_WITH_PRIVATE (ClutterFlowLayout, + clutter_flow_layout, + CLUTTER_TYPE_LAYOUT_MANAGER) static gint get_columns (ClutterFlowLayout *self, @@ -919,8 +917,6 @@ clutter_flow_layout_class_init (ClutterFlowLayoutClass *klass) GObjectClass *gobject_class; ClutterLayoutManagerClass *layout_class; - g_type_class_add_private (klass, sizeof (ClutterFlowLayoutPrivate)); - gobject_class = G_OBJECT_CLASS (klass); layout_class = CLUTTER_LAYOUT_MANAGER_CLASS (klass); @@ -1088,7 +1084,7 @@ clutter_flow_layout_init (ClutterFlowLayout *self) { ClutterFlowLayoutPrivate *priv; - self->priv = priv = CLUTTER_FLOW_LAYOUT_GET_PRIVATE (self); + self->priv = priv = clutter_flow_layout_get_instance_private (self); priv->orientation = CLUTTER_FLOW_HORIZONTAL; diff --git a/clutter/clutter-gesture-action.c b/clutter/clutter-gesture-action.c index 6544451ae..6a116d0b7 100644 --- a/clutter/clutter-gesture-action.c +++ b/clutter/clutter-gesture-action.c @@ -150,7 +150,7 @@ enum static GParamSpec *gesture_props[PROP_LAST]; static guint gesture_signals[LAST_SIGNAL] = { 0, }; -G_DEFINE_TYPE (ClutterGestureAction, clutter_gesture_action, CLUTTER_TYPE_ACTION); +G_DEFINE_TYPE_WITH_PRIVATE (ClutterGestureAction, clutter_gesture_action, CLUTTER_TYPE_ACTION) static GesturePoint * gesture_register_point (ClutterGestureAction *action, ClutterEvent *event) @@ -624,8 +624,6 @@ clutter_gesture_action_class_init (ClutterGestureActionClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); ClutterActorMetaClass *meta_class = CLUTTER_ACTOR_META_CLASS (klass); - g_type_class_add_private (klass, sizeof (ClutterGestureActionPrivate)); - gobject_class->finalize = clutter_gesture_action_finalize; gobject_class->set_property = clutter_gesture_action_set_property; gobject_class->get_property = clutter_gesture_action_get_property; @@ -750,8 +748,7 @@ clutter_gesture_action_class_init (ClutterGestureActionClass *klass) static void clutter_gesture_action_init (ClutterGestureAction *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, CLUTTER_TYPE_GESTURE_ACTION, - ClutterGestureActionPrivate); + self->priv = clutter_gesture_action_get_instance_private (self); self->priv->points = g_array_sized_new (FALSE, TRUE, sizeof (GesturePoint), 3); g_array_set_clear_func (self->priv->points, (GDestroyNotify) gesture_point_unset); diff --git a/clutter/clutter-grid-layout.c b/clutter/clutter-grid-layout.c index 8c419bbc9..7724c92df 100644 --- a/clutter/clutter-grid-layout.c +++ b/clutter/clutter-grid-layout.c @@ -66,7 +66,6 @@ #define CLUTTER_TYPE_GRID_CHILD (clutter_grid_child_get_type ()) #define CLUTTER_GRID_CHILD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_GRID_CHILD, ClutterGridChild)) #define CLUTTER_IS_GRID_CHILD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_GRID_CHILD)) -#define CLUTTER_GRID_LAYOUT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CLUTTER_TYPE_GRID_LAYOUT, ClutterGridLayoutPrivate)) typedef struct _ClutterGridChild ClutterGridChild; typedef struct _ClutterLayoutMetaClass ClutterGridChildClass; @@ -173,9 +172,11 @@ static GParamSpec *child_props[PROP_CHILD_LAST]; GType clutter_grid_child_get_type (void); G_DEFINE_TYPE (ClutterGridChild, clutter_grid_child, - CLUTTER_TYPE_LAYOUT_META); -G_DEFINE_TYPE (ClutterGridLayout, clutter_grid_layout, - CLUTTER_TYPE_LAYOUT_MANAGER); + CLUTTER_TYPE_LAYOUT_META) + +G_DEFINE_TYPE_WITH_PRIVATE (ClutterGridLayout, + clutter_grid_layout, + CLUTTER_TYPE_LAYOUT_MANAGER) #define GET_GRID_CHILD(grid, child) \ @@ -1527,8 +1528,6 @@ clutter_grid_layout_class_init (ClutterGridLayoutClass *klass) layout_class = CLUTTER_LAYOUT_MANAGER_CLASS (klass); - g_type_class_add_private (klass, sizeof (ClutterGridLayoutPrivate)); - object_class->set_property = clutter_grid_layout_set_property; object_class->get_property = clutter_grid_layout_get_property; @@ -1616,17 +1615,15 @@ clutter_grid_layout_class_init (ClutterGridLayoutClass *klass) static void clutter_grid_layout_init (ClutterGridLayout *self) { - ClutterGridLayoutPrivate *priv; + self->priv = clutter_grid_layout_get_instance_private (self); - self->priv = priv = CLUTTER_GRID_LAYOUT_GET_PRIVATE (self); + self->priv->orientation = CLUTTER_ORIENTATION_HORIZONTAL; - priv->orientation = CLUTTER_ORIENTATION_HORIZONTAL; + self->priv->linedata[0].spacing = 0; + self->priv->linedata[1].spacing = 0; - priv->linedata[0].spacing = 0; - priv->linedata[1].spacing = 0; - - priv->linedata[0].homogeneous = FALSE; - priv->linedata[1].homogeneous = FALSE; + self->priv->linedata[0].homogeneous = FALSE; + self->priv->linedata[1].homogeneous = FALSE; } /** diff --git a/clutter/clutter-image.c b/clutter/clutter-image.c index 7ae9839ee..cfc0ae34e 100644 --- a/clutter/clutter-image.c +++ b/clutter/clutter-image.c @@ -62,6 +62,7 @@ struct _ClutterImagePrivate static void clutter_content_iface_init (ClutterContentIface *iface); G_DEFINE_TYPE_WITH_CODE (ClutterImage, clutter_image, G_TYPE_OBJECT, + G_ADD_PRIVATE (ClutterImage) G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_CONTENT, clutter_content_iface_init)) @@ -88,16 +89,13 @@ clutter_image_finalize (GObject *gobject) static void clutter_image_class_init (ClutterImageClass *klass) { - g_type_class_add_private (klass, sizeof (ClutterImagePrivate)); - G_OBJECT_CLASS (klass)->finalize = clutter_image_finalize; } static void clutter_image_init (ClutterImage *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, CLUTTER_TYPE_IMAGE, - ClutterImagePrivate); + self->priv = clutter_image_get_instance_private (self); } static void diff --git a/clutter/clutter-interval.c b/clutter/clutter-interval.c index 13649ad16..601ad0f7e 100644 --- a/clutter/clutter-interval.c +++ b/clutter/clutter-interval.c @@ -86,8 +86,6 @@ enum N_VALUES }; -#define CLUTTER_INTERVAL_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CLUTTER_TYPE_INTERVAL, ClutterIntervalPrivate)) - struct _ClutterIntervalPrivate { GType value_type; @@ -95,7 +93,7 @@ struct _ClutterIntervalPrivate GValue *values; }; -G_DEFINE_TYPE (ClutterInterval, clutter_interval, G_TYPE_INITIALLY_UNOWNED); +G_DEFINE_TYPE_WITH_PRIVATE (ClutterInterval, clutter_interval, G_TYPE_INITIALLY_UNOWNED) static gboolean clutter_interval_real_validate (ClutterInterval *interval, @@ -420,7 +418,8 @@ clutter_interval_set_property (GObject *gobject, const GValue *value, GParamSpec *pspec) { - ClutterIntervalPrivate *priv = CLUTTER_INTERVAL_GET_PRIVATE (gobject); + ClutterInterval *self = CLUTTER_INTERVAL (gobject); + ClutterIntervalPrivate *priv = clutter_interval_get_instance_private (self); switch (prop_id) { @@ -430,16 +429,14 @@ clutter_interval_set_property (GObject *gobject, case PROP_INITIAL: if (g_value_get_boxed (value) != NULL) - clutter_interval_set_initial_value (CLUTTER_INTERVAL (gobject), - g_value_get_boxed (value)); + clutter_interval_set_initial_value (self, g_value_get_boxed (value)); else if (G_IS_VALUE (&priv->values[INITIAL])) g_value_unset (&priv->values[INITIAL]); break; case PROP_FINAL: if (g_value_get_boxed (value) != NULL) - clutter_interval_set_final_value (CLUTTER_INTERVAL (gobject), - g_value_get_boxed (value)); + clutter_interval_set_final_value (self, g_value_get_boxed (value)); else if (G_IS_VALUE (&priv->values[FINAL])) g_value_unset (&priv->values[FINAL]); break; @@ -456,7 +453,9 @@ clutter_interval_get_property (GObject *gobject, GValue *value, GParamSpec *pspec) { - ClutterIntervalPrivate *priv = CLUTTER_INTERVAL_GET_PRIVATE (gobject); + ClutterIntervalPrivate *priv; + + priv = clutter_interval_get_instance_private (CLUTTER_INTERVAL (gobject)); switch (prop_id) { @@ -485,8 +484,6 @@ clutter_interval_class_init (ClutterIntervalClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - g_type_class_add_private (klass, sizeof (ClutterIntervalPrivate)); - klass->validate = clutter_interval_real_validate; klass->compute_value = clutter_interval_real_compute_value; @@ -546,12 +543,10 @@ clutter_interval_class_init (ClutterIntervalClass *klass) static void clutter_interval_init (ClutterInterval *self) { - ClutterIntervalPrivate *priv; + self->priv = clutter_interval_get_instance_private (self); - self->priv = priv = CLUTTER_INTERVAL_GET_PRIVATE (self); - - priv->value_type = G_TYPE_INVALID; - priv->values = g_malloc0 (sizeof (GValue) * N_VALUES); + self->priv->value_type = G_TYPE_INVALID; + self->priv->values = g_malloc0 (sizeof (GValue) * N_VALUES); } static inline void diff --git a/clutter/clutter-keyframe-transition.c b/clutter/clutter-keyframe-transition.c index 007be9caf..cef39fc55 100644 --- a/clutter/clutter-keyframe-transition.c +++ b/clutter/clutter-keyframe-transition.c @@ -96,9 +96,9 @@ struct _ClutterKeyframeTransitionPrivate gint current_frame; }; -G_DEFINE_TYPE (ClutterKeyframeTransition, - clutter_keyframe_transition, - CLUTTER_TYPE_PROPERTY_TRANSITION) +G_DEFINE_TYPE_WITH_PRIVATE (ClutterKeyframeTransition, + clutter_keyframe_transition, + CLUTTER_TYPE_PROPERTY_TRANSITION) static void key_frame_free (gpointer data) @@ -375,8 +375,6 @@ clutter_keyframe_transition_class_init (ClutterKeyframeTransitionClass *klass) ClutterTimelineClass *timeline_class = CLUTTER_TIMELINE_CLASS (klass); ClutterTransitionClass *transition_class = CLUTTER_TRANSITION_CLASS (klass); - g_type_class_add_private (klass, sizeof (ClutterKeyframeTransitionPrivate)); - gobject_class->finalize = clutter_keyframe_transition_finalize; timeline_class->started = clutter_keyframe_transition_started; @@ -388,9 +386,7 @@ clutter_keyframe_transition_class_init (ClutterKeyframeTransitionClass *klass) static void clutter_keyframe_transition_init (ClutterKeyframeTransition *self) { - self->priv = - G_TYPE_INSTANCE_GET_PRIVATE (self, CLUTTER_TYPE_KEYFRAME_TRANSITION, - ClutterKeyframeTransitionPrivate); + self->priv = clutter_keyframe_transition_get_instance_private (self); } /** diff --git a/clutter/clutter-layout-manager.c b/clutter/clutter-layout-manager.c index 9f3ef5605..e1bce2e3c 100644 --- a/clutter/clutter-layout-manager.c +++ b/clutter/clutter-layout-manager.c @@ -345,11 +345,6 @@ G_OBJECT_TYPE_NAME (_obj), \ (method)); } G_STMT_END -struct _ClutterLayoutManagerPrivate -{ - gpointer dummy; -}; - enum { LAYOUT_CHANGED, @@ -359,7 +354,7 @@ enum G_DEFINE_ABSTRACT_TYPE (ClutterLayoutManager, clutter_layout_manager, - G_TYPE_INITIALLY_UNOWNED); + G_TYPE_INITIALLY_UNOWNED) static GQuark quark_layout_meta = 0; static GQuark quark_layout_alpha = 0; @@ -595,8 +590,6 @@ clutter_layout_manager_class_init (ClutterLayoutManagerClass *klass) quark_layout_alpha = g_quark_from_static_string ("clutter-layout-manager-alpha"); - g_type_class_add_private (klass, sizeof (ClutterLayoutManagerPrivate)); - klass->get_preferred_width = layout_manager_real_get_preferred_width; klass->get_preferred_height = layout_manager_real_get_preferred_height; klass->allocate = layout_manager_real_allocate; @@ -652,9 +645,6 @@ clutter_layout_manager_class_init (ClutterLayoutManagerClass *klass) static void clutter_layout_manager_init (ClutterLayoutManager *manager) { - manager->priv = - G_TYPE_INSTANCE_GET_PRIVATE (manager, CLUTTER_TYPE_LAYOUT_MANAGER, - ClutterLayoutManagerPrivate); } /** diff --git a/clutter/clutter-layout-manager.h b/clutter/clutter-layout-manager.h index d19d56337..d054bfdce 100644 --- a/clutter/clutter-layout-manager.h +++ b/clutter/clutter-layout-manager.h @@ -40,7 +40,6 @@ G_BEGIN_DECLS #define CLUTTER_IS_LAYOUT_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_LAYOUT_MANAGER)) #define CLUTTER_LAYOUT_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_LAYOUT_MANAGER, ClutterLayoutManagerClass)) -typedef struct _ClutterLayoutManagerPrivate ClutterLayoutManagerPrivate; typedef struct _ClutterLayoutManagerClass ClutterLayoutManagerClass; /** @@ -56,7 +55,7 @@ struct _ClutterLayoutManager /*< private >*/ GInitiallyUnowned parent_instance; - ClutterLayoutManagerPrivate *priv; + gpointer CLUTTER_PRIVATE_FIELD (dummy); }; /** diff --git a/clutter/clutter-list-model.c b/clutter/clutter-list-model.c index 49ac9df9d..b1dec9b84 100644 --- a/clutter/clutter-list-model.c +++ b/clutter/clutter-list-model.c @@ -76,8 +76,6 @@ typedef struct _ClutterListModelIter ClutterListModelIter; typedef struct _ClutterModelIterClass ClutterListModelIterClass; -#define CLUTTER_LIST_MODEL_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CLUTTER_TYPE_LIST_MODEL, ClutterListModelPrivate)) - struct _ClutterListModelPrivate { GSequence *sequence; @@ -102,7 +100,7 @@ GType clutter_list_model_iter_get_type (void); G_DEFINE_TYPE (ClutterListModelIter, clutter_list_model_iter, - CLUTTER_TYPE_MODEL_ITER); + CLUTTER_TYPE_MODEL_ITER) static void clutter_list_model_iter_get_value (ClutterModelIter *iter, @@ -434,7 +432,7 @@ clutter_list_model_iter_init (ClutterListModelIter *iter) * ClutterListModel */ -G_DEFINE_TYPE (ClutterListModel, clutter_list_model, CLUTTER_TYPE_MODEL); +G_DEFINE_TYPE_WITH_PRIVATE (ClutterListModel, clutter_list_model, CLUTTER_TYPE_MODEL) static ClutterModelIter * clutter_list_model_get_iter_at_row (ClutterModel *model, @@ -698,24 +696,21 @@ clutter_list_model_class_init (ClutterListModelClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); ClutterModelClass *model_class = CLUTTER_MODEL_CLASS (klass); - g_type_class_add_private (klass, sizeof (ClutterListModelPrivate)); - gobject_class->finalize = clutter_list_model_finalize; gobject_class->dispose = clutter_list_model_dispose; model_class->get_iter_at_row = clutter_list_model_get_iter_at_row; - model_class->insert_row = clutter_list_model_insert_row; - model_class->remove_row = clutter_list_model_remove_row; - model_class->resort = clutter_list_model_resort; - model_class->get_n_rows = clutter_list_model_get_n_rows; - - model_class->row_removed = clutter_list_model_row_removed; + model_class->insert_row = clutter_list_model_insert_row; + model_class->remove_row = clutter_list_model_remove_row; + model_class->resort = clutter_list_model_resort; + model_class->get_n_rows = clutter_list_model_get_n_rows; + model_class->row_removed = clutter_list_model_row_removed; } static void clutter_list_model_init (ClutterListModel *model) { - model->priv = CLUTTER_LIST_MODEL_GET_PRIVATE (model); + model->priv = clutter_list_model_get_instance_private (model); model->priv->sequence = g_sequence_new (NULL); model->priv->temp_iter = g_object_new (CLUTTER_TYPE_LIST_MODEL_ITER, diff --git a/clutter/clutter-model.c b/clutter/clutter-model.c index 5ebaefa05..f43c54515 100644 --- a/clutter/clutter-model.c +++ b/clutter/clutter-model.c @@ -170,13 +170,6 @@ #include "clutter-scriptable.h" #include "clutter-script-private.h" -static void clutter_scriptable_iface_init (ClutterScriptableIface *iface); - -G_DEFINE_ABSTRACT_TYPE_WITH_CODE - (ClutterModel, clutter_model, G_TYPE_OBJECT, - G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_SCRIPTABLE, - clutter_scriptable_iface_init)); - enum { PROP_0, @@ -198,9 +191,6 @@ enum static guint model_signals[LAST_SIGNAL] = { 0, }; -#define CLUTTER_MODEL_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CLUTTER_TYPE_MODEL, ClutterModelPrivate)) - struct _ClutterModelPrivate { GType *column_types; @@ -226,6 +216,13 @@ struct _ClutterModelPrivate GDestroyNotify sort_notify; }; +static void clutter_scriptable_iface_init (ClutterScriptableIface *iface); + +G_DEFINE_ABSTRACT_TYPE_WITH_CODE (ClutterModel, clutter_model, G_TYPE_OBJECT, + G_ADD_PRIVATE (ClutterModel) + G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_SCRIPTABLE, + clutter_scriptable_iface_init)) + static GType clutter_model_real_get_column_type (ClutterModel *model, guint column) @@ -347,8 +344,6 @@ clutter_model_class_init (ClutterModelClass *klass) gobject_class->get_property = clutter_model_get_property; gobject_class->finalize = clutter_model_finalize; - g_type_class_add_private (gobject_class, sizeof (ClutterModelPrivate)); - klass->get_column_name = clutter_model_real_get_column_name; klass->get_column_type = clutter_model_real_get_column_type; klass->get_n_columns = clutter_model_real_get_n_columns; @@ -470,7 +465,7 @@ clutter_model_init (ClutterModel *self) { ClutterModelPrivate *priv; - self->priv = priv = CLUTTER_MODEL_GET_PRIVATE (self); + self->priv = priv = clutter_model_get_instance_private (self); priv->n_columns = -1; priv->column_types = NULL; @@ -1757,12 +1752,6 @@ clutter_model_get_filter_set (ClutterModel *model) * #ClutterModelIter is available since Clutter 0.6 */ -G_DEFINE_ABSTRACT_TYPE (ClutterModelIter, clutter_model_iter, G_TYPE_OBJECT); - -#define CLUTTER_MODEL_ITER_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \ - CLUTTER_TYPE_MODEL_ITER, ClutterModelIterPrivate)) - struct _ClutterModelIterPrivate { ClutterModel *model; @@ -1770,6 +1759,8 @@ struct _ClutterModelIterPrivate gint row; }; +G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (ClutterModelIter, clutter_model_iter, G_TYPE_OBJECT) + enum { ITER_PROP_0, @@ -1964,19 +1955,12 @@ clutter_model_iter_class_init (ClutterModelIterClass *klass) 0, G_MAXUINT, 0, CLUTTER_PARAM_READWRITE); g_object_class_install_property (gobject_class, ITER_PROP_ROW, pspec); - - g_type_class_add_private (gobject_class, sizeof (ClutterModelIterPrivate)); } static void clutter_model_iter_init (ClutterModelIter *self) { - ClutterModelIterPrivate *priv; - - self->priv = priv = CLUTTER_MODEL_ITER_GET_PRIVATE (self); - - priv->model = NULL; - priv->row = 0; + self->priv = clutter_model_iter_get_instance_private (self); } /* diff --git a/clutter/clutter-offscreen-effect.c b/clutter/clutter-offscreen-effect.c index e1197b56f..5c053df68 100644 --- a/clutter/clutter-offscreen-effect.c +++ b/clutter/clutter-offscreen-effect.c @@ -108,9 +108,9 @@ struct _ClutterOffscreenEffectPrivate CoglMatrix last_matrix_drawn; }; -G_DEFINE_ABSTRACT_TYPE (ClutterOffscreenEffect, - clutter_offscreen_effect, - CLUTTER_TYPE_EFFECT); +G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (ClutterOffscreenEffect, + clutter_offscreen_effect, + CLUTTER_TYPE_EFFECT) static void clutter_offscreen_effect_set_actor (ClutterActorMeta *meta, @@ -483,8 +483,6 @@ clutter_offscreen_effect_class_init (ClutterOffscreenEffectClass *klass) ClutterEffectClass *effect_class = CLUTTER_EFFECT_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - g_type_class_add_private (klass, sizeof (ClutterOffscreenEffectPrivate)); - klass->create_texture = clutter_offscreen_effect_real_create_texture; klass->paint_target = clutter_offscreen_effect_real_paint_target; @@ -500,9 +498,7 @@ clutter_offscreen_effect_class_init (ClutterOffscreenEffectClass *klass) static void clutter_offscreen_effect_init (ClutterOffscreenEffect *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, - CLUTTER_TYPE_OFFSCREEN_EFFECT, - ClutterOffscreenEffectPrivate); + self->priv = clutter_offscreen_effect_get_instance_private (self); } /** diff --git a/clutter/clutter-pan-action.c b/clutter/clutter-pan-action.c index 53a32d3e5..14188be07 100644 --- a/clutter/clutter-pan-action.c +++ b/clutter/clutter-pan-action.c @@ -127,8 +127,7 @@ enum static guint pan_signals[LAST_SIGNAL] = { 0, }; -G_DEFINE_TYPE (ClutterPanAction, clutter_pan_action, - CLUTTER_TYPE_GESTURE_ACTION); +G_DEFINE_TYPE_WITH_PRIVATE (ClutterPanAction, clutter_pan_action, CLUTTER_TYPE_GESTURE_ACTION) static void emit_pan (ClutterPanAction *self, @@ -424,8 +423,6 @@ clutter_pan_action_class_init (ClutterPanActionClass *klass) ClutterGestureActionClass *gesture_class = CLUTTER_GESTURE_ACTION_CLASS (klass); - g_type_class_add_private (klass, sizeof (ClutterPanActionPrivate)); - klass->pan = clutter_pan_action_real_pan; gesture_class->gesture_prepare = gesture_prepare; @@ -559,12 +556,10 @@ clutter_pan_action_class_init (ClutterPanActionClass *klass) static void clutter_pan_action_init (ClutterPanAction *self) { - ClutterPanActionPrivate *priv = self->priv = - G_TYPE_INSTANCE_GET_PRIVATE (self, CLUTTER_TYPE_PAN_ACTION, - ClutterPanActionPrivate); - priv->deceleration_rate = default_deceleration_rate; - priv->acceleration_factor = default_acceleration_factor; - priv->state = PAN_STATE_INACTIVE; + self->priv = clutter_pan_action_get_instance_private (self); + self->priv->deceleration_rate = default_deceleration_rate; + self->priv->acceleration_factor = default_acceleration_factor; + self->priv->state = PAN_STATE_INACTIVE; } /** diff --git a/clutter/clutter-path.c b/clutter/clutter-path.c index 799c2e57a..23886fc88 100644 --- a/clutter/clutter-path.c +++ b/clutter/clutter-path.c @@ -88,10 +88,6 @@ #include "clutter-bezier.h" #include "clutter-private.h" -#define CLUTTER_PATH_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CLUTTER_TYPE_PATH, \ - ClutterPathPrivate)) - #define CLUTTER_PATH_NODE_TYPE_IS_VALID(t) \ ((((t) & ~CLUTTER_PATH_RELATIVE) >= CLUTTER_PATH_MOVE_TO \ && ((t) & ~CLUTTER_PATH_RELATIVE) <= CLUTTER_PATH_CURVE_TO) \ @@ -149,6 +145,7 @@ G_DEFINE_BOXED_TYPE (ClutterPathNode, clutter_path_node, G_DEFINE_TYPE_WITH_CODE (ClutterPath, clutter_path, G_TYPE_INITIALLY_UNOWNED, + G_ADD_PRIVATE (ClutterPath) CLUTTER_REGISTER_VALUE_TRANSFORM_TO (G_TYPE_STRING, clutter_value_transform_path_string) CLUTTER_REGISTER_VALUE_TRANSFORM_FROM (G_TYPE_STRING, clutter_value_transform_string_path)); @@ -220,14 +217,12 @@ clutter_path_class_init (ClutterPathClass *klass) CLUTTER_PARAM_READABLE); obj_props[PROP_LENGTH] = pspec; g_object_class_install_property (gobject_class, PROP_LENGTH, pspec); - - g_type_class_add_private (klass, sizeof (ClutterPathPrivate)); } static void clutter_path_init (ClutterPath *self) { - self->priv = CLUTTER_PATH_GET_PRIVATE (self); + self->priv = clutter_path_get_instance_private (self); } static void diff --git a/clutter/clutter-property-transition.c b/clutter/clutter-property-transition.c index e74490de4..6cdceb2da 100644 --- a/clutter/clutter-property-transition.c +++ b/clutter/clutter-property-transition.c @@ -60,7 +60,7 @@ enum static GParamSpec *obj_props[PROP_LAST] = { NULL, }; -G_DEFINE_TYPE (ClutterPropertyTransition, clutter_property_transition, CLUTTER_TYPE_TRANSITION) +G_DEFINE_TYPE_WITH_PRIVATE (ClutterPropertyTransition, clutter_property_transition, CLUTTER_TYPE_TRANSITION) static inline void clutter_property_transition_ensure_interval (ClutterPropertyTransition *transition, @@ -249,8 +249,6 @@ clutter_property_transition_class_init (ClutterPropertyTransitionClass *klass) ClutterTransitionClass *transition_class = CLUTTER_TRANSITION_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - g_type_class_add_private (klass, sizeof (ClutterPropertyTransitionPrivate)); - transition_class->attached = clutter_property_transition_attached; transition_class->detached = clutter_property_transition_detached; transition_class->compute_value = clutter_property_transition_compute_value; @@ -279,9 +277,7 @@ clutter_property_transition_class_init (ClutterPropertyTransitionClass *klass) static void clutter_property_transition_init (ClutterPropertyTransition *self) { - self->priv = - G_TYPE_INSTANCE_GET_PRIVATE (self, CLUTTER_TYPE_PROPERTY_TRANSITION, - ClutterPropertyTransitionPrivate); + self->priv = clutter_property_transition_get_instance_private (self); } /** diff --git a/clutter/clutter-rotate-action.c b/clutter/clutter-rotate-action.c index 567d73fc1..7c155f0e7 100644 --- a/clutter/clutter-rotate-action.c +++ b/clutter/clutter-rotate-action.c @@ -62,8 +62,7 @@ enum static guint rotate_signals[LAST_SIGNAL] = { 0, }; -G_DEFINE_TYPE (ClutterRotateAction, clutter_rotate_action, - CLUTTER_TYPE_GESTURE_ACTION); +G_DEFINE_TYPE_WITH_PRIVATE (ClutterRotateAction, clutter_rotate_action, CLUTTER_TYPE_GESTURE_ACTION) static gboolean clutter_rotate_action_real_rotate (ClutterRotateAction *action, @@ -178,8 +177,6 @@ clutter_rotate_action_class_init (ClutterRotateActionClass *klass) ClutterGestureActionClass *gesture_class = CLUTTER_GESTURE_ACTION_CLASS (klass); - g_type_class_add_private (klass, sizeof (ClutterRotateActionPrivate)); - klass->rotate = clutter_rotate_action_real_rotate; gesture_class->gesture_begin = clutter_rotate_action_gesture_begin; @@ -217,8 +214,7 @@ clutter_rotate_action_class_init (ClutterRotateActionClass *klass) static void clutter_rotate_action_init (ClutterRotateAction *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, CLUTTER_TYPE_ROTATE_ACTION, - ClutterRotateActionPrivate); + self->priv = clutter_rotate_action_get_instance_private (self); clutter_gesture_action_set_n_touch_points (CLUTTER_GESTURE_ACTION (self), 2); } diff --git a/clutter/clutter-script.c b/clutter/clutter-script.c index 6d0b6071f..4434b4d2a 100644 --- a/clutter/clutter-script.c +++ b/clutter/clutter-script.c @@ -287,7 +287,7 @@ struct _ClutterScriptPrivate guint is_filename : 1; }; -G_DEFINE_TYPE (ClutterScript, clutter_script, G_TYPE_OBJECT); +G_DEFINE_TYPE_WITH_PRIVATE (ClutterScript, clutter_script, G_TYPE_OBJECT) static GType clutter_script_real_get_type_from_name (ClutterScript *script, @@ -448,8 +448,6 @@ clutter_script_class_init (ClutterScriptClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - g_type_class_add_private (klass, sizeof (ClutterScriptPrivate)); - klass->get_type_from_name = clutter_script_real_get_type_from_name; /** @@ -515,7 +513,7 @@ clutter_script_init (ClutterScript *script) { ClutterScriptPrivate *priv; - script->priv = priv = CLUTTER_SCRIPT_GET_PRIVATE (script); + script->priv = priv = clutter_script_get_instance_private (script); priv->parser = g_object_new (CLUTTER_TYPE_SCRIPT_PARSER, NULL); priv->parser->script = script; diff --git a/clutter/clutter-scroll-actor.c b/clutter/clutter-scroll-actor.c index 8783e102a..e1acc1e6e 100644 --- a/clutter/clutter-scroll-actor.c +++ b/clutter/clutter-scroll-actor.c @@ -96,6 +96,7 @@ static ClutterAnimatableIface *parent_animatable_iface = NULL; static void clutter_animatable_iface_init (ClutterAnimatableIface *iface); G_DEFINE_TYPE_WITH_CODE (ClutterScrollActor, clutter_scroll_actor, CLUTTER_TYPE_ACTOR, + G_ADD_PRIVATE (ClutterScrollActor) G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_ANIMATABLE, clutter_animatable_iface_init)) @@ -173,8 +174,6 @@ clutter_scroll_actor_class_init (ClutterScrollActorClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - g_type_class_add_private (klass, sizeof (ClutterScrollActorPrivate)); - gobject_class->set_property = clutter_scroll_actor_set_property; gobject_class->get_property = clutter_scroll_actor_get_property; @@ -200,9 +199,7 @@ clutter_scroll_actor_class_init (ClutterScrollActorClass *klass) static void clutter_scroll_actor_init (ClutterScrollActor *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, CLUTTER_TYPE_SCROLL_ACTOR, - ClutterScrollActorPrivate); - + self->priv = clutter_scroll_actor_get_instance_private (self); self->priv->scroll_mode = CLUTTER_SCROLL_BOTH; clutter_actor_set_clip_to_allocation (CLUTTER_ACTOR (self), TRUE); diff --git a/clutter/clutter-shader-effect.c b/clutter/clutter-shader-effect.c index 08b4a92a4..95b7d6a7e 100644 --- a/clutter/clutter-shader-effect.c +++ b/clutter/clutter-shader-effect.c @@ -171,6 +171,7 @@ static GParamSpec *obj_props[PROP_LAST]; G_DEFINE_TYPE_WITH_CODE (ClutterShaderEffect, clutter_shader_effect, CLUTTER_TYPE_OFFSCREEN_EFFECT, + G_ADD_PRIVATE (ClutterShaderEffect) g_type_add_class_private (g_define_type_id, sizeof (ClutterShaderEffectClassPrivate))) @@ -470,8 +471,6 @@ clutter_shader_effect_class_init (ClutterShaderEffectClass *klass) offscreen_class = CLUTTER_OFFSCREEN_EFFECT_CLASS (klass); - g_type_class_add_private (klass, sizeof (ClutterShaderEffectPrivate)); - /** * ClutterShaderEffect:shader-type: * @@ -503,9 +502,7 @@ clutter_shader_effect_class_init (ClutterShaderEffectClass *klass) static void clutter_shader_effect_init (ClutterShaderEffect *effect) { - effect->priv = G_TYPE_INSTANCE_GET_PRIVATE (effect, - CLUTTER_TYPE_SHADER_EFFECT, - ClutterShaderEffectPrivate); + effect->priv = clutter_shader_effect_get_instance_private (effect); } /** diff --git a/clutter/clutter-stage.c b/clutter/clutter-stage.c index e2698f744..55a50f6a8 100644 --- a/clutter/clutter-stage.c +++ b/clutter/clutter-stage.c @@ -79,15 +79,6 @@ #include "cogl/cogl.h" -static void clutter_container_iface_init (ClutterContainerIface *iface); - -G_DEFINE_TYPE_WITH_CODE (ClutterStage, clutter_stage, CLUTTER_TYPE_GROUP, - G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_CONTAINER, - clutter_container_iface_init)) - -#define CLUTTER_STAGE_GET_PRIVATE(obj) \ -(G_TYPE_INSTANCE_GET_PRIVATE ((obj), CLUTTER_TYPE_STAGE, ClutterStagePrivate)) - /* * ClutterStageHint: * @CLUTTER_STAGE_NONE: No hint set @@ -218,6 +209,13 @@ static void clutter_stage_maybe_finish_queue_redraws (ClutterStage *stage); static void free_queue_redraw_entry (ClutterStageQueueRedrawEntry *entry); static void clutter_stage_invoke_paint_callback (ClutterStage *stage); +static void clutter_container_iface_init (ClutterContainerIface *iface); + +G_DEFINE_TYPE_WITH_CODE (ClutterStage, clutter_stage, CLUTTER_TYPE_GROUP, + G_ADD_PRIVATE (ClutterStage) + G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_CONTAINER, + clutter_container_iface_init)) + static void clutter_stage_real_add (ClutterContainer *container, ClutterActor *child) @@ -2244,8 +2242,6 @@ clutter_stage_class_init (ClutterStageClass *klass) klass->activate = clutter_stage_real_activate; klass->deactivate = clutter_stage_real_deactivate; klass->delete_event = clutter_stage_real_delete_event; - - g_type_class_add_private (gobject_class, sizeof (ClutterStagePrivate)); } static void @@ -2266,7 +2262,7 @@ clutter_stage_init (ClutterStage *self) /* a stage is a top-level object */ CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_IS_TOPLEVEL); - self->priv = priv = CLUTTER_STAGE_GET_PRIVATE (self); + self->priv = priv = clutter_stage_get_instance_private (self); CLUTTER_NOTE (BACKEND, "Creating stage from the default backend"); backend = clutter_get_default_backend (); diff --git a/clutter/clutter-swipe-action.c b/clutter/clutter-swipe-action.c index 0b0886bbc..96b7c091c 100644 --- a/clutter/clutter-swipe-action.c +++ b/clutter/clutter-swipe-action.c @@ -66,8 +66,7 @@ enum static guint swipe_signals[LAST_SIGNAL] = { 0, }; -G_DEFINE_TYPE (ClutterSwipeAction, clutter_swipe_action, - CLUTTER_TYPE_GESTURE_ACTION); +G_DEFINE_TYPE_WITH_PRIVATE (ClutterSwipeAction, clutter_swipe_action, CLUTTER_TYPE_GESTURE_ACTION) static gboolean gesture_begin (ClutterGestureAction *action, @@ -184,8 +183,6 @@ clutter_swipe_action_class_init (ClutterSwipeActionClass *klass) ClutterGestureActionClass *gesture_class = CLUTTER_GESTURE_ACTION_CLASS (klass); - g_type_class_add_private (klass, sizeof (ClutterSwipeActionPrivate)); - gesture_class->gesture_begin = gesture_begin; gesture_class->gesture_progress = gesture_progress; gesture_class->gesture_end = gesture_end; @@ -247,8 +244,7 @@ clutter_swipe_action_class_init (ClutterSwipeActionClass *klass) static void clutter_swipe_action_init (ClutterSwipeAction *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, CLUTTER_TYPE_SWIPE_ACTION, - ClutterSwipeActionPrivate); + self->priv = clutter_swipe_action_get_instance_private (self); } /** diff --git a/clutter/clutter-table-layout.c b/clutter/clutter-table-layout.c index 9927ad59a..b396e2d5e 100644 --- a/clutter/clutter-table-layout.c +++ b/clutter/clutter-table-layout.c @@ -98,8 +98,6 @@ #define CLUTTER_TABLE_CHILD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_TABLE_CHILD, ClutterTableChild)) #define CLUTTER_IS_TABLE_CHILD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_TABLE_CHILD)) -#define CLUTTER_TABLE_LAYOUT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CLUTTER_TYPE_TABLE_LAYOUT, ClutterTableLayoutPrivate)) - typedef struct _ClutterTableChild ClutterTableChild; typedef struct _ClutterLayoutMetaClass ClutterTableChildClass; @@ -184,13 +182,9 @@ enum GType clutter_table_child_get_type (void); -G_DEFINE_TYPE (ClutterTableChild, - clutter_table_child, - CLUTTER_TYPE_LAYOUT_META); +G_DEFINE_TYPE (ClutterTableChild, clutter_table_child, CLUTTER_TYPE_LAYOUT_META) -G_DEFINE_TYPE (ClutterTableLayout, - clutter_table_layout, - CLUTTER_TYPE_LAYOUT_MANAGER); +G_DEFINE_TYPE_WITH_PRIVATE (ClutterTableLayout, clutter_table_layout, CLUTTER_TYPE_LAYOUT_MANAGER) /* * ClutterBoxChild @@ -1624,8 +1618,6 @@ clutter_table_layout_class_init (ClutterTableLayoutClass *klass) layout_class->get_child_meta_type = clutter_table_layout_get_child_meta_type; - g_type_class_add_private (klass, sizeof (ClutterTableLayoutPrivate)); - /** * ClutterTableLayout:column-spacing: * @@ -1731,7 +1723,7 @@ clutter_table_layout_init (ClutterTableLayout *layout) { ClutterTableLayoutPrivate *priv; - layout->priv = priv = CLUTTER_TABLE_LAYOUT_GET_PRIVATE (layout); + layout->priv = priv = clutter_table_layout_get_instance_private (layout); priv->row_spacing = 0; priv->col_spacing = 0; diff --git a/clutter/clutter-text-buffer.c b/clutter/clutter-text-buffer.c index 1ee9f4df8..63cab2206 100644 --- a/clutter/clutter-text-buffer.c +++ b/clutter/clutter-text-buffer.c @@ -81,7 +81,7 @@ struct _ClutterTextBufferPrivate guint normal_text_chars; }; -G_DEFINE_TYPE (ClutterTextBuffer, clutter_text_buffer, G_TYPE_OBJECT); +G_DEFINE_TYPE_WITH_PRIVATE (ClutterTextBuffer, clutter_text_buffer, G_TYPE_OBJECT) /* -------------------------------------------------------------------------------- * DEFAULT IMPLEMENTATIONS OF TEXT BUFFER @@ -246,16 +246,14 @@ clutter_text_buffer_real_deleted_text (ClutterTextBuffer *buffer, */ static void -clutter_text_buffer_init (ClutterTextBuffer *buffer) +clutter_text_buffer_init (ClutterTextBuffer *self) { - ClutterTextBufferPrivate *pv; + self->priv = clutter_text_buffer_get_instance_private (self); - pv = buffer->priv = G_TYPE_INSTANCE_GET_PRIVATE (buffer, CLUTTER_TYPE_TEXT_BUFFER, ClutterTextBufferPrivate); - - pv->normal_text = NULL; - pv->normal_text_chars = 0; - pv->normal_text_bytes = 0; - pv->normal_text_size = 0; + self->priv->normal_text = NULL; + self->priv->normal_text_chars = 0; + self->priv->normal_text_bytes = 0; + self->priv->normal_text_size = 0; } static void @@ -337,8 +335,6 @@ clutter_text_buffer_class_init (ClutterTextBufferClass *klass) klass->inserted_text = clutter_text_buffer_real_inserted_text; klass->deleted_text = clutter_text_buffer_real_deleted_text; - g_type_class_add_private (gobject_class, sizeof (ClutterTextBufferPrivate)); - /** * ClutterTextBuffer:text: * diff --git a/clutter/clutter-text.c b/clutter/clutter-text.c index 9fb434845..0ce2c3adf 100644 --- a/clutter/clutter-text.c +++ b/clutter/clutter-text.c @@ -82,29 +82,8 @@ */ #define N_CACHED_LAYOUTS 6 -#define CLUTTER_TEXT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CLUTTER_TYPE_TEXT, ClutterTextPrivate)) - typedef struct _LayoutCache LayoutCache; -static const ClutterColor default_cursor_color = { 0, 0, 0, 255 }; -static const ClutterColor default_selection_color = { 0, 0, 0, 255 }; -static const ClutterColor default_text_color = { 0, 0, 0, 255 }; -static const ClutterColor default_selected_text_color = { 0, 0, 0, 255 }; - -static ClutterAnimatableIface *parent_animatable_iface = NULL; -static ClutterScriptableIface *parent_scriptable_iface = NULL; - -static void clutter_scriptable_iface_init (ClutterScriptableIface *iface); -static void clutter_animatable_iface_init (ClutterAnimatableIface *iface); - -G_DEFINE_TYPE_WITH_CODE (ClutterText, - clutter_text, - CLUTTER_TYPE_ACTOR, - G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_SCRIPTABLE, - clutter_scriptable_iface_init) - G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_ANIMATABLE, - clutter_animatable_iface_init)); - struct _LayoutCache { /* Cached layout. Pango internally caches the computed extents @@ -281,6 +260,26 @@ static void buffer_connect_signals (ClutterText *self); static void buffer_disconnect_signals (ClutterText *self); static ClutterTextBuffer *get_buffer (ClutterText *self); +static const ClutterColor default_cursor_color = { 0, 0, 0, 255 }; +static const ClutterColor default_selection_color = { 0, 0, 0, 255 }; +static const ClutterColor default_text_color = { 0, 0, 0, 255 }; +static const ClutterColor default_selected_text_color = { 0, 0, 0, 255 }; + +static ClutterAnimatableIface *parent_animatable_iface = NULL; +static ClutterScriptableIface *parent_scriptable_iface = NULL; + +static void clutter_scriptable_iface_init (ClutterScriptableIface *iface); +static void clutter_animatable_iface_init (ClutterAnimatableIface *iface); + +G_DEFINE_TYPE_WITH_CODE (ClutterText, + clutter_text, + CLUTTER_TYPE_ACTOR, + G_ADD_PRIVATE (ClutterText) + G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_SCRIPTABLE, + clutter_scriptable_iface_init) + G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_ANIMATABLE, + clutter_animatable_iface_init)); + static inline void clutter_text_dirty_paint_volume (ClutterText *text) { @@ -3325,8 +3324,6 @@ clutter_text_class_init (ClutterTextClass *klass) ClutterBindingPool *binding_pool; GParamSpec *pspec; - g_type_class_add_private (klass, sizeof (ClutterTextPrivate)); - gobject_class->set_property = clutter_text_set_property; gobject_class->get_property = clutter_text_get_property; gobject_class->dispose = clutter_text_dispose; @@ -4060,7 +4057,7 @@ clutter_text_init (ClutterText *self) gchar *font_name; int i, password_hint_time; - self->priv = priv = CLUTTER_TEXT_GET_PRIVATE (self); + self->priv = priv = clutter_text_get_instance_private (self); priv->alignment = PANGO_ALIGN_LEFT; priv->wrap = FALSE; diff --git a/clutter/clutter-timeline.c b/clutter/clutter-timeline.c index 440b2d2e9..adb942a5a 100644 --- a/clutter/clutter-timeline.c +++ b/clutter/clutter-timeline.c @@ -112,12 +112,6 @@ #include "deprecated/clutter-timeline.h" -static void clutter_scriptable_iface_init (ClutterScriptableIface *iface); - -G_DEFINE_TYPE_WITH_CODE (ClutterTimeline, clutter_timeline, G_TYPE_OBJECT, - G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_SCRIPTABLE, - clutter_scriptable_iface_init)); - struct _ClutterTimelinePrivate { ClutterTimelineDirection direction; @@ -210,6 +204,13 @@ enum static guint timeline_signals[LAST_SIGNAL] = { 0, }; +static void clutter_scriptable_iface_init (ClutterScriptableIface *iface); + +G_DEFINE_TYPE_WITH_CODE (ClutterTimeline, clutter_timeline, G_TYPE_OBJECT, + G_ADD_PRIVATE (ClutterTimeline) + G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_SCRIPTABLE, + clutter_scriptable_iface_init)) + static TimelineMarker * timeline_marker_new_time (const gchar *name, guint msecs) @@ -575,8 +576,6 @@ clutter_timeline_class_init (ClutterTimelineClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - g_type_class_add_private (klass, sizeof (ClutterTimelinePrivate)); - /** * ClutterTimeline:loop: * @@ -846,21 +845,17 @@ clutter_timeline_class_init (ClutterTimelineClass *klass) static void clutter_timeline_init (ClutterTimeline *self) { - ClutterTimelinePrivate *priv; + self->priv = clutter_timeline_get_instance_private (self); - self->priv = priv = - G_TYPE_INSTANCE_GET_PRIVATE (self, CLUTTER_TYPE_TIMELINE, - ClutterTimelinePrivate); - - priv->progress_mode = CLUTTER_LINEAR; + self->priv->progress_mode = CLUTTER_LINEAR; /* default steps() parameters are 1, end */ - priv->n_steps = 1; - priv->step_mode = CLUTTER_STEP_MODE_END; + self->priv->n_steps = 1; + self->priv->step_mode = CLUTTER_STEP_MODE_END; /* default cubic-bezier() paramereters are (0, 0, 1, 1) */ - clutter_point_init (&priv->cb_1, 0, 0); - clutter_point_init (&priv->cb_2, 1, 1); + clutter_point_init (&self->priv->cb_1, 0, 0); + clutter_point_init (&self->priv->cb_2, 1, 1); } struct CheckIfMarkerHitClosure diff --git a/clutter/clutter-transition-group.c b/clutter/clutter-transition-group.c index 1b8e664bb..f479dc44c 100644 --- a/clutter/clutter-transition-group.c +++ b/clutter/clutter-transition-group.c @@ -51,7 +51,7 @@ struct _ClutterTransitionGroupPrivate GHashTable *transitions; }; -G_DEFINE_TYPE (ClutterTransitionGroup, clutter_transition_group, CLUTTER_TYPE_TRANSITION) +G_DEFINE_TYPE_WITH_PRIVATE (ClutterTransitionGroup, clutter_transition_group, CLUTTER_TYPE_TRANSITION) static void clutter_transition_group_new_frame (ClutterTimeline *timeline, @@ -155,8 +155,6 @@ clutter_transition_group_class_init (ClutterTransitionGroupClass *klass) ClutterTimelineClass *timeline_class = CLUTTER_TIMELINE_CLASS (klass); ClutterTransitionClass *transition_class = CLUTTER_TRANSITION_CLASS (klass); - g_type_class_add_private (klass, sizeof (ClutterTransitionGroupPrivate)); - gobject_class->finalize = clutter_transition_group_finalize; timeline_class->started = clutter_transition_group_started; @@ -169,10 +167,7 @@ clutter_transition_group_class_init (ClutterTransitionGroupClass *klass) static void clutter_transition_group_init (ClutterTransitionGroup *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, - CLUTTER_TYPE_TRANSITION_GROUP, - ClutterTransitionGroupPrivate); - + self->priv = clutter_transition_group_get_instance_private (self); self->priv->transitions = g_hash_table_new_full (NULL, NULL, (GDestroyNotify) g_object_unref, NULL); } diff --git a/clutter/clutter-transition.c b/clutter/clutter-transition.c index ec6055b0c..2fa9195b6 100644 --- a/clutter/clutter-transition.c +++ b/clutter/clutter-transition.c @@ -67,7 +67,7 @@ static GParamSpec *obj_props[PROP_LAST] = { NULL, }; static GQuark quark_animatable_set = 0; -G_DEFINE_ABSTRACT_TYPE (ClutterTransition, clutter_transition, CLUTTER_TYPE_TIMELINE) +G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (ClutterTransition, clutter_transition, CLUTTER_TYPE_TIMELINE) static void clutter_transition_attach (ClutterTransition *transition, @@ -220,8 +220,6 @@ clutter_transition_class_init (ClutterTransitionClass *klass) quark_animatable_set = g_quark_from_static_string ("-clutter-transition-animatable-set"); - g_type_class_add_private (klass, sizeof (ClutterTransitionPrivate)); - klass->compute_value = clutter_transition_real_compute_value; klass->attached = clutter_transition_real_attached; klass->detached = clutter_transition_real_detached; @@ -291,8 +289,7 @@ clutter_transition_class_init (ClutterTransitionClass *klass) static void clutter_transition_init (ClutterTransition *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, CLUTTER_TYPE_TRANSITION, - ClutterTransitionPrivate); + self->priv = clutter_transition_get_instance_private (self); } /** diff --git a/clutter/clutter-zoom-action.c b/clutter/clutter-zoom-action.c index 422e2a8cd..3f4eb9a9f 100644 --- a/clutter/clutter-zoom-action.c +++ b/clutter/clutter-zoom-action.c @@ -115,7 +115,7 @@ enum static guint zoom_signals[LAST_SIGNAL] = { 0, }; -G_DEFINE_TYPE (ClutterZoomAction, clutter_zoom_action, CLUTTER_TYPE_GESTURE_ACTION); +G_DEFINE_TYPE_WITH_PRIVATE (ClutterZoomAction, clutter_zoom_action, CLUTTER_TYPE_GESTURE_ACTION) static void capture_point_initial_position (ClutterGestureAction *action, @@ -332,8 +332,6 @@ clutter_zoom_action_class_init (ClutterZoomActionClass *klass) CLUTTER_GESTURE_ACTION_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - g_type_class_add_private (klass, sizeof (ClutterZoomActionPrivate)); - gobject_class->set_property = clutter_zoom_action_set_property; gobject_class->get_property = clutter_zoom_action_get_property; gobject_class->dispose = clutter_zoom_action_dispose; @@ -400,9 +398,7 @@ clutter_zoom_action_class_init (ClutterZoomActionClass *klass) static void clutter_zoom_action_init (ClutterZoomAction *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, CLUTTER_TYPE_ZOOM_ACTION, - ClutterZoomActionPrivate); - + self->priv = clutter_zoom_action_get_instance_private (self); self->priv->zoom_axis = CLUTTER_ZOOM_BOTH; clutter_gesture_action_set_n_touch_points (CLUTTER_GESTURE_ACTION (self), 2); diff --git a/clutter/evdev/clutter-device-manager-evdev.c b/clutter/evdev/clutter-device-manager-evdev.c index 101c955fe..bab4a8259 100644 --- a/clutter/evdev/clutter-device-manager-evdev.c +++ b/clutter/evdev/clutter-device-manager-evdev.c @@ -51,15 +51,6 @@ #include "clutter-device-manager-evdev.h" -#define CLUTTER_DEVICE_MANAGER_EVDEV_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \ - CLUTTER_TYPE_DEVICE_MANAGER_EVDEV, \ - ClutterDeviceManagerEvdevPrivate)) - -G_DEFINE_TYPE (ClutterDeviceManagerEvdev, - clutter_device_manager_evdev, - CLUTTER_TYPE_DEVICE_MANAGER); - struct _ClutterDeviceManagerEvdevPrivate { GUdevClient *udev_client; @@ -78,6 +69,10 @@ struct _ClutterDeviceManagerEvdevPrivate guint stage_removed_handler; }; +G_DEFINE_TYPE_WITH_PRIVATE (ClutterDeviceManagerEvdev, + clutter_device_manager_evdev, + CLUTTER_TYPE_DEVICE_MANAGER) + static const gchar *subsystems[] = { "input", NULL }; /* @@ -914,10 +909,8 @@ clutter_device_manager_evdev_finalize (GObject *object) static void clutter_device_manager_evdev_class_init (ClutterDeviceManagerEvdevClass *klass) { + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); ClutterDeviceManagerClass *manager_class; - GObjectClass *gobject_class = (GObjectClass *) klass; - - g_type_class_add_private (klass, sizeof (ClutterDeviceManagerEvdevPrivate)); gobject_class->constructed = clutter_device_manager_evdev_constructed; gobject_class->finalize = clutter_device_manager_evdev_finalize; @@ -989,7 +982,7 @@ clutter_device_manager_evdev_init (ClutterDeviceManagerEvdev *self) { ClutterDeviceManagerEvdevPrivate *priv; - priv = self->priv = CLUTTER_DEVICE_MANAGER_EVDEV_GET_PRIVATE (self); + priv = self->priv = clutter_device_manager_evdev_get_instance_private (self); priv->stage_manager = clutter_stage_manager_get_default (); g_object_ref (priv->stage_manager); diff --git a/clutter/evdev/clutter-input-device-evdev.c b/clutter/evdev/clutter-input-device-evdev.c index 7eccbe58d..40b3e1ff2 100644 --- a/clutter/evdev/clutter-input-device-evdev.c +++ b/clutter/evdev/clutter-input-device-evdev.c @@ -33,11 +33,6 @@ typedef struct _ClutterInputDeviceClass ClutterInputDeviceEvdevClass; typedef struct _ClutterInputDeviceEvdevPrivate ClutterInputDeviceEvdevPrivate; -#define INPUT_DEVICE_EVDEV_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((o), \ - CLUTTER_TYPE_INPUT_DEVICE_EVDEV, \ - ClutterInputDeviceEvdevPrivate)) - enum { PROP_0, @@ -61,9 +56,9 @@ struct _ClutterInputDeviceEvdev ClutterInputDeviceEvdevPrivate *priv; }; -G_DEFINE_TYPE (ClutterInputDeviceEvdev, - clutter_input_device_evdev, - CLUTTER_TYPE_INPUT_DEVICE) +G_DEFINE_TYPE_WITH_PRIVATE (ClutterInputDeviceEvdev, + clutter_input_device_evdev, + CLUTTER_TYPE_INPUT_DEVICE) static GParamSpec *obj_props[PROP_LAST]; @@ -140,8 +135,6 @@ clutter_input_device_evdev_class_init (ClutterInputDeviceEvdevClass *klass) GObjectClass *object_class = G_OBJECT_CLASS (klass); GParamSpec *pspec; - g_type_class_add_private (klass, sizeof (ClutterInputDeviceEvdevPrivate)); - object_class->get_property = clutter_input_device_evdev_get_property; object_class->set_property = clutter_input_device_evdev_set_property; object_class->finalize = clutter_input_device_evdev_finalize; @@ -183,7 +176,7 @@ clutter_input_device_evdev_class_init (ClutterInputDeviceEvdevClass *klass) static void clutter_input_device_evdev_init (ClutterInputDeviceEvdev *self) { - self->priv = INPUT_DEVICE_EVDEV_PRIVATE (self); + self->priv = clutter_input_device_evdev_get_instance_private (self); } ClutterInputDeviceEvdev * diff --git a/clutter/wayland/clutter-wayland-surface.c b/clutter/wayland/clutter-wayland-surface.c index becd917cd..e16c3ff34 100644 --- a/clutter/wayland/clutter-wayland-surface.c +++ b/clutter/wayland/clutter-wayland-surface.c @@ -78,9 +78,9 @@ struct _ClutterWaylandSurfacePrivate CoglPipeline *pipeline; }; -G_DEFINE_TYPE (ClutterWaylandSurface, - clutter_wayland_surface, - CLUTTER_TYPE_ACTOR); +G_DEFINE_TYPE_WITH_PRIVATE (ClutterWaylandSurface, + clutter_wayland_surface, + CLUTTER_TYPE_ACTOR) static gboolean clutter_wayland_surface_get_paint_volume (ClutterActor *self, @@ -156,11 +156,9 @@ opacity_change_cb (ClutterWaylandSurface *self) static void clutter_wayland_surface_init (ClutterWaylandSurface *self) { - ClutterWaylandSurfacePrivate *priv = - G_TYPE_INSTANCE_GET_PRIVATE (self, - CLUTTER_WAYLAND_TYPE_SURFACE, - ClutterWaylandSurfacePrivate); - + ClutterWaylandSurfacePrivate *priv; + + priv = clutter_wayland_surface_get_instance_private (self); priv->surface = NULL; priv->width = 0; priv->height = 0; @@ -405,8 +403,6 @@ clutter_wayland_surface_class_init (ClutterWaylandSurfaceClass *klass) ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass); GParamSpec *pspec; - g_type_class_add_private (klass, sizeof (ClutterWaylandSurfacePrivate)); - actor_class->get_paint_volume = clutter_wayland_surface_get_paint_volume; actor_class->paint = clutter_wayland_surface_paint; actor_class->get_preferred_width = diff --git a/clutter/x11/clutter-x11-texture-pixmap.c b/clutter/x11/clutter-x11-texture-pixmap.c index 6f2a1dbc2..119fd4693 100644 --- a/clutter/x11/clutter-x11-texture-pixmap.c +++ b/clutter/x11/clutter-x11-texture-pixmap.c @@ -136,9 +136,9 @@ struct _ClutterX11TexturePixmapPrivate static int _damage_event_base = 0; -G_DEFINE_TYPE (ClutterX11TexturePixmap, - clutter_x11_texture_pixmap, - CLUTTER_TYPE_TEXTURE); +G_DEFINE_TYPE_WITH_PRIVATE (ClutterX11TexturePixmap, + clutter_x11_texture_pixmap, + CLUTTER_TYPE_TEXTURE) static gboolean check_extensions (ClutterX11TexturePixmap *texture) @@ -384,10 +384,7 @@ clutter_x11_texture_pixmap_real_queue_damage_redraw ( static void clutter_x11_texture_pixmap_init (ClutterX11TexturePixmap *self) { - self->priv = - G_TYPE_INSTANCE_GET_PRIVATE (self, - CLUTTER_X11_TYPE_TEXTURE_PIXMAP, - ClutterX11TexturePixmapPrivate); + self->priv = clutter_x11_texture_pixmap_get_instance_private (self); if (!check_extensions (self)) { @@ -525,8 +522,6 @@ clutter_x11_texture_pixmap_class_init (ClutterX11TexturePixmapClass *klass) ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass); GParamSpec *pspec; - g_type_class_add_private (klass, sizeof (ClutterX11TexturePixmapPrivate)); - actor_class->get_paint_volume = clutter_x11_texture_pixmap_get_paint_volume; object_class->dispose = clutter_x11_texture_pixmap_dispose;