diff --git a/clutter/deprecated/clutter-alpha.c b/clutter/deprecated/clutter-alpha.c index d9548a5ee..f2bf040e5 100644 --- a/clutter/deprecated/clutter-alpha.c +++ b/clutter/deprecated/clutter-alpha.c @@ -122,14 +122,6 @@ #include "clutter-scriptable.h" #include "clutter-script-private.h" -static void clutter_scriptable_iface_init (ClutterScriptableIface *iface); - -G_DEFINE_TYPE_WITH_CODE (ClutterAlpha, - clutter_alpha, - G_TYPE_INITIALLY_UNOWNED, - G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_SCRIPTABLE, - clutter_scriptable_iface_init)); - struct _ClutterAlphaPrivate { ClutterTimeline *timeline; @@ -159,6 +151,15 @@ enum static GParamSpec *obj_props[PROP_LAST]; +static void clutter_scriptable_iface_init (ClutterScriptableIface *iface); + +G_DEFINE_TYPE_WITH_CODE (ClutterAlpha, + clutter_alpha, + G_TYPE_INITIALLY_UNOWNED, + G_ADD_PRIVATE (ClutterAlpha) + G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_SCRIPTABLE, + clutter_scriptable_iface_init)); + static void timeline_new_frame_cb (ClutterTimeline *timeline, guint msecs, @@ -339,8 +340,6 @@ clutter_alpha_class_init (ClutterAlphaClass *klass) object_class->finalize = clutter_alpha_finalize; object_class->dispose = clutter_alpha_dispose; - g_type_class_add_private (klass, sizeof (ClutterAlphaPrivate)); - /** * ClutterAlpha:timeline: * @@ -405,10 +404,7 @@ clutter_alpha_class_init (ClutterAlphaClass *klass) static void clutter_alpha_init (ClutterAlpha *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, - CLUTTER_TYPE_ALPHA, - ClutterAlphaPrivate); - + self->priv = clutter_alpha_get_instance_private (self); self->priv->mode = CLUTTER_CUSTOM_MODE; self->priv->alpha = 0.0; } diff --git a/clutter/deprecated/clutter-animation.c b/clutter/deprecated/clutter-animation.c index 80f5f6a7b..5ae560f51 100644 --- a/clutter/deprecated/clutter-animation.c +++ b/clutter/deprecated/clutter-animation.c @@ -190,8 +190,6 @@ enum LAST_SIGNAL }; -#define CLUTTER_ANIMATION_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CLUTTER_TYPE_ANIMATION, ClutterAnimationPrivate)) - struct _ClutterAnimationPrivate { GObject *object; @@ -218,6 +216,7 @@ static ClutterAlpha * clutter_animation_get_alpha_internal (Clutter static ClutterTimeline * clutter_animation_get_timeline_internal (ClutterAnimation *animation); G_DEFINE_TYPE_WITH_CODE (ClutterAnimation, clutter_animation, G_TYPE_OBJECT, + G_ADD_PRIVATE (ClutterAnimation) G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_SCRIPTABLE, clutter_scriptable_init)); @@ -489,8 +488,6 @@ clutter_animation_class_init (ClutterAnimationClass *klass) quark_object_animation = g_quark_from_static_string ("clutter-actor-animation"); - g_type_class_add_private (klass, sizeof (ClutterAnimationPrivate)); - klass->completed = clutter_animation_real_completed; gobject_class->set_property = clutter_animation_set_property; @@ -643,7 +640,7 @@ clutter_animation_class_init (ClutterAnimationClass *klass) static void clutter_animation_init (ClutterAnimation *self) { - self->priv = CLUTTER_ANIMATION_GET_PRIVATE (self); + self->priv = clutter_animation_get_instance_private (self); self->priv->properties = g_hash_table_new_full (g_str_hash, g_str_equal, diff --git a/clutter/deprecated/clutter-animator.c b/clutter/deprecated/clutter-animator.c index 89e4925f4..00ca8e297 100644 --- a/clutter/deprecated/clutter-animator.c +++ b/clutter/deprecated/clutter-animator.c @@ -143,8 +143,6 @@ #include "clutter-script-private.h" #include "clutter-scriptable.h" -#define CLUTTER_ANIMATOR_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CLUTTER_TYPE_ANIMATOR, ClutterAnimatorPrivate)) - /* progress values varying by less than this are considered equal */ #define PROGRESS_EPSILON 0.00001 @@ -203,6 +201,7 @@ static void clutter_scriptable_init (ClutterScriptableIface *iface); G_DEFINE_TYPE_WITH_CODE (ClutterAnimator, clutter_animator, G_TYPE_OBJECT, + G_ADD_PRIVATE (ClutterAnimator) G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_SCRIPTABLE, clutter_scriptable_init)); /** @@ -1783,8 +1782,6 @@ clutter_animator_class_init (ClutterAnimatorClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - g_type_class_add_private (klass, sizeof (ClutterAnimatorPrivate)); - gobject_class->set_property = clutter_animator_set_property; gobject_class->get_property = clutter_animator_get_property; gobject_class->dispose = clutter_animator_dispose; @@ -1834,7 +1831,7 @@ clutter_animator_init (ClutterAnimator *animator) ClutterAnimatorPrivate *priv; ClutterTimeline *timeline; - animator->priv = priv = CLUTTER_ANIMATOR_GET_PRIVATE (animator); + animator->priv = priv = clutter_animator_get_instance_private (animator); priv->properties = g_hash_table_new_full (prop_actor_hash, prop_actor_equal, diff --git a/clutter/deprecated/clutter-behaviour-depth.c b/clutter/deprecated/clutter-behaviour-depth.c index 49a4afc9a..405b14bef 100644 --- a/clutter/deprecated/clutter-behaviour-depth.c +++ b/clutter/deprecated/clutter-behaviour-depth.c @@ -54,10 +54,6 @@ * instead. */ -G_DEFINE_TYPE (ClutterBehaviourDepth, - clutter_behaviour_depth, - CLUTTER_TYPE_BEHAVIOUR); - struct _ClutterBehaviourDepthPrivate { gint depth_start; @@ -72,6 +68,10 @@ enum PROP_DEPTH_END }; +G_DEFINE_TYPE_WITH_PRIVATE (ClutterBehaviourDepth, + clutter_behaviour_depth, + CLUTTER_TYPE_BEHAVIOUR) + static void alpha_notify_foreach (ClutterBehaviour *behaviour, ClutterActor *actor, @@ -159,8 +159,6 @@ clutter_behaviour_depth_class_init (ClutterBehaviourDepthClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); ClutterBehaviourClass *behaviour_class = CLUTTER_BEHAVIOUR_CLASS (klass); - g_type_class_add_private (klass, sizeof (ClutterBehaviourDepthPrivate)); - gobject_class->set_property = clutter_behaviour_depth_set_property; gobject_class->get_property = clutter_behaviour_depth_get_property; @@ -204,9 +202,7 @@ clutter_behaviour_depth_class_init (ClutterBehaviourDepthClass *klass) static void clutter_behaviour_depth_init (ClutterBehaviourDepth *depth) { - depth->priv = G_TYPE_INSTANCE_GET_PRIVATE (depth, - CLUTTER_TYPE_BEHAVIOUR_DEPTH, - ClutterBehaviourDepthPrivate); + depth->priv = clutter_behaviour_depth_get_instance_private (depth); } /** diff --git a/clutter/deprecated/clutter-behaviour-ellipse.c b/clutter/deprecated/clutter-behaviour-ellipse.c index 103a4aeea..72fbe8ca2 100644 --- a/clutter/deprecated/clutter-behaviour-ellipse.c +++ b/clutter/deprecated/clutter-behaviour-ellipse.c @@ -60,15 +60,6 @@ #include "clutter-enum-types.h" #include "clutter-private.h" -G_DEFINE_TYPE (ClutterBehaviourEllipse, - clutter_behaviour_ellipse, - CLUTTER_TYPE_BEHAVIOUR); - -#define CLUTTER_BEHAVIOUR_ELLIPSE_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \ - CLUTTER_TYPE_BEHAVIOUR_ELLIPSE, \ - ClutterBehaviourEllipsePrivate)) - enum { PROP_0, @@ -108,6 +99,10 @@ struct _ClutterBehaviourEllipsePrivate ClutterRotateDirection direction; }; +G_DEFINE_TYPE_WITH_PRIVATE (ClutterBehaviourEllipse, + clutter_behaviour_ellipse, + CLUTTER_TYPE_BEHAVIOUR) + typedef struct _knot3d { gint x; @@ -382,8 +377,6 @@ clutter_behaviour_ellipse_class_init (ClutterBehaviourEllipseClass *klass) ClutterBehaviourClass *behave_class = CLUTTER_BEHAVIOUR_CLASS (klass); GParamSpec *pspec = NULL; - g_type_class_add_private (klass, sizeof (ClutterBehaviourEllipsePrivate)); - object_class->set_property = clutter_behaviour_ellipse_set_property; object_class->get_property = clutter_behaviour_ellipse_get_property; @@ -539,7 +532,7 @@ clutter_behaviour_ellipse_init (ClutterBehaviourEllipse * self) { ClutterBehaviourEllipsePrivate *priv; - self->priv = priv = CLUTTER_BEHAVIOUR_ELLIPSE_GET_PRIVATE (self); + self->priv = priv = clutter_behaviour_ellipse_get_instance_private (self); priv->direction = CLUTTER_ROTATE_CW; diff --git a/clutter/deprecated/clutter-behaviour-opacity.c b/clutter/deprecated/clutter-behaviour-opacity.c index b685be03b..385506754 100644 --- a/clutter/deprecated/clutter-behaviour-opacity.c +++ b/clutter/deprecated/clutter-behaviour-opacity.c @@ -50,21 +50,12 @@ #include "clutter-private.h" #include "clutter-debug.h" -G_DEFINE_TYPE (ClutterBehaviourOpacity, - clutter_behaviour_opacity, - CLUTTER_TYPE_BEHAVIOUR); - struct _ClutterBehaviourOpacityPrivate { guint8 opacity_start; guint8 opacity_end; }; -#define CLUTTER_BEHAVIOUR_OPACITY_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \ - CLUTTER_TYPE_BEHAVIOUR_OPACITY, \ - ClutterBehaviourOpacityPrivate)) - enum { PROP_0, @@ -77,6 +68,10 @@ enum static GParamSpec *obj_props[PROP_LAST]; +G_DEFINE_TYPE_WITH_PRIVATE (ClutterBehaviourOpacity, + clutter_behaviour_opacity, + CLUTTER_TYPE_BEHAVIOUR) + static void alpha_notify_foreach (ClutterBehaviour *behaviour, ClutterActor *actor, @@ -166,8 +161,6 @@ clutter_behaviour_opacity_class_init (ClutterBehaviourOpacityClass *klass) ClutterBehaviourClass *behave_class = CLUTTER_BEHAVIOUR_CLASS (klass); GParamSpec *pspec; - g_type_class_add_private (klass, sizeof (ClutterBehaviourOpacityPrivate)); - gobject_class->set_property = clutter_behaviour_opacity_set_property; gobject_class->get_property = clutter_behaviour_opacity_get_property; @@ -213,10 +206,7 @@ clutter_behaviour_opacity_class_init (ClutterBehaviourOpacityClass *klass) static void clutter_behaviour_opacity_init (ClutterBehaviourOpacity *self) { - self->priv = CLUTTER_BEHAVIOUR_OPACITY_GET_PRIVATE (self); - - self->priv->opacity_start = 0; - self->priv->opacity_end = 0; + self->priv = clutter_behaviour_opacity_get_instance_private (self); } /** diff --git a/clutter/deprecated/clutter-behaviour-path.c b/clutter/deprecated/clutter-behaviour-path.c index 9702a3942..b2b66f06a 100644 --- a/clutter/deprecated/clutter-behaviour-path.c +++ b/clutter/deprecated/clutter-behaviour-path.c @@ -83,25 +83,12 @@ #include -static void clutter_scriptable_iface_init (ClutterScriptableIface *iface); - -G_DEFINE_TYPE_WITH_CODE (ClutterBehaviourPath, - clutter_behaviour_path, - CLUTTER_TYPE_BEHAVIOUR, - G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_SCRIPTABLE, - clutter_scriptable_iface_init)); - struct _ClutterBehaviourPathPrivate { ClutterPath *path; guint last_knot_passed; }; -#define CLUTTER_BEHAVIOUR_PATH_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \ - CLUTTER_TYPE_BEHAVIOUR_PATH, \ - ClutterBehaviourPathPrivate)) - enum { KNOT_REACHED, @@ -122,6 +109,15 @@ enum static GParamSpec *obj_props[PROP_LAST]; +static void clutter_scriptable_iface_init (ClutterScriptableIface *iface); + +G_DEFINE_TYPE_WITH_CODE (ClutterBehaviourPath, + clutter_behaviour_path, + CLUTTER_TYPE_BEHAVIOUR, + G_ADD_PRIVATE (ClutterBehaviourPath) + G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_SCRIPTABLE, + clutter_scriptable_iface_init)) + static void actor_apply_knot_foreach (ClutterBehaviour *behaviour, ClutterActor *actor, @@ -253,8 +249,6 @@ clutter_behaviour_path_class_init (ClutterBehaviourPathClass *klass) G_TYPE_UINT); behave_class->alpha_notify = clutter_behaviour_path_alpha_notify; - - g_type_class_add_private (klass, sizeof (ClutterBehaviourPathPrivate)); } static ClutterScriptableIface *parent_scriptable_iface = NULL; @@ -310,12 +304,8 @@ clutter_scriptable_iface_init (ClutterScriptableIface *iface) static void clutter_behaviour_path_init (ClutterBehaviourPath *self) { - ClutterBehaviourPathPrivate *priv; - - self->priv = priv = CLUTTER_BEHAVIOUR_PATH_GET_PRIVATE (self); - - priv->path = NULL; - priv->last_knot_passed = G_MAXUINT; + self->priv = clutter_behaviour_path_get_instance_private (self); + self->priv->last_knot_passed = G_MAXUINT; } /** diff --git a/clutter/deprecated/clutter-behaviour-rotate.c b/clutter/deprecated/clutter-behaviour-rotate.c index 9ba0f42a6..67ab3e441 100644 --- a/clutter/deprecated/clutter-behaviour-rotate.c +++ b/clutter/deprecated/clutter-behaviour-rotate.c @@ -52,10 +52,6 @@ #include "clutter-main.h" #include "clutter-private.h" -G_DEFINE_TYPE (ClutterBehaviourRotate, - clutter_behaviour_rotate, - CLUTTER_TYPE_BEHAVIOUR); - struct _ClutterBehaviourRotatePrivate { gdouble angle_start; @@ -69,11 +65,6 @@ struct _ClutterBehaviourRotatePrivate gint center_z; }; -#define CLUTTER_BEHAVIOUR_ROTATE_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \ - CLUTTER_TYPE_BEHAVIOUR_ROTATE, \ - ClutterBehaviourRotatePrivate)) - enum { PROP_0, @@ -91,6 +82,10 @@ enum static GParamSpec *obj_props[PROP_LAST]; +G_DEFINE_TYPE_WITH_PRIVATE (ClutterBehaviourRotate, + clutter_behaviour_rotate, + CLUTTER_TYPE_BEHAVIOUR) + typedef struct { gdouble angle; } RotateFrameClosure; @@ -265,8 +260,6 @@ clutter_behaviour_rotate_class_init (ClutterBehaviourRotateClass *klass) ClutterBehaviourClass *behaviour_class = CLUTTER_BEHAVIOUR_CLASS (klass); GParamSpec *pspec = NULL; - g_type_class_add_private (klass, sizeof (ClutterBehaviourRotatePrivate)); - gobject_class->set_property = clutter_behaviour_rotate_set_property; gobject_class->get_property = clutter_behaviour_rotate_get_property; @@ -400,19 +393,19 @@ clutter_behaviour_rotate_class_init (ClutterBehaviourRotateClass *klass) } static void -clutter_behaviour_rotate_init (ClutterBehaviourRotate *rotate) +clutter_behaviour_rotate_init (ClutterBehaviourRotate *self) { - ClutterBehaviourRotatePrivate *priv; + self->priv = clutter_behaviour_rotate_get_instance_private (self); - rotate->priv = priv = CLUTTER_BEHAVIOUR_ROTATE_GET_PRIVATE (rotate); + self->priv->angle_start = 0.0; + self->priv->angle_end = 0.0; - priv->angle_start = priv->angle_end = 0; + self->priv->axis = CLUTTER_Z_AXIS; + self->priv->direction = CLUTTER_ROTATE_CW; - priv->axis = CLUTTER_Z_AXIS; - - priv->direction = CLUTTER_ROTATE_CW; - - priv->center_x = priv->center_y = priv->center_z = 0; + self->priv->center_x = 0; + self->priv->center_y = 0; + self->priv->center_z = 0; } /** diff --git a/clutter/deprecated/clutter-behaviour-scale.c b/clutter/deprecated/clutter-behaviour-scale.c index 2f78eee11..c0d5fcf03 100644 --- a/clutter/deprecated/clutter-behaviour-scale.c +++ b/clutter/deprecated/clutter-behaviour-scale.c @@ -51,10 +51,6 @@ #include "clutter-main.h" #include "clutter-private.h" -G_DEFINE_TYPE (ClutterBehaviourScale, - clutter_behaviour_scale, - CLUTTER_TYPE_BEHAVIOUR); - struct _ClutterBehaviourScalePrivate { gdouble x_scale_start; @@ -64,8 +60,6 @@ struct _ClutterBehaviourScalePrivate gdouble y_scale_end; }; -#define CLUTTER_BEHAVIOUR_SCALE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CLUTTER_TYPE_BEHAVIOUR_SCALE, ClutterBehaviourScalePrivate)) - enum { PROP_0, @@ -80,6 +74,10 @@ enum static GParamSpec *obj_props[PROP_LAST]; +G_DEFINE_TYPE_WITH_PRIVATE (ClutterBehaviourScale, + clutter_behaviour_scale, + CLUTTER_TYPE_BEHAVIOUR) + typedef struct { gdouble scale_x; gdouble scale_y; @@ -208,8 +206,6 @@ clutter_behaviour_scale_class_init (ClutterBehaviourScaleClass *klass) ClutterBehaviourClass *behave_class = CLUTTER_BEHAVIOUR_CLASS (klass); GParamSpec *pspec = NULL; - g_type_class_add_private (klass, sizeof (ClutterBehaviourScalePrivate)); - gobject_class->set_property = clutter_behaviour_scale_set_property; gobject_class->get_property = clutter_behaviour_scale_get_property; @@ -298,7 +294,7 @@ clutter_behaviour_scale_init (ClutterBehaviourScale *self) { ClutterBehaviourScalePrivate *priv; - self->priv = priv = CLUTTER_BEHAVIOUR_SCALE_GET_PRIVATE (self); + self->priv = priv = clutter_behaviour_scale_get_instance_private (self); priv->x_scale_start = priv->x_scale_end = 1.0; priv->y_scale_start = priv->y_scale_end = 1.0; diff --git a/clutter/deprecated/clutter-behaviour.c b/clutter/deprecated/clutter-behaviour.c index 08a11f444..95511880d 100644 --- a/clutter/deprecated/clutter-behaviour.c +++ b/clutter/deprecated/clutter-behaviour.c @@ -88,14 +88,6 @@ #include "clutter-scriptable.h" #include "clutter-script-private.h" -static void clutter_scriptable_iface_init (ClutterScriptableIface *iface); - -G_DEFINE_ABSTRACT_TYPE_WITH_CODE (ClutterBehaviour, - clutter_behaviour, - G_TYPE_OBJECT, - G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_SCRIPTABLE, - clutter_scriptable_iface_init)); - struct _ClutterBehaviourPrivate { ClutterAlpha *alpha; @@ -122,10 +114,14 @@ enum { static guint behave_signals[LAST_SIGNAL] = { 0 }; -#define CLUTTER_BEHAVIOUR_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \ - CLUTTER_TYPE_BEHAVIOUR, \ - ClutterBehaviourPrivate)) +static void clutter_scriptable_iface_init (ClutterScriptableIface *iface); + +G_DEFINE_ABSTRACT_TYPE_WITH_CODE (ClutterBehaviour, + clutter_behaviour, + G_TYPE_OBJECT, + G_ADD_PRIVATE (ClutterBehaviour) + G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_SCRIPTABLE, + clutter_scriptable_iface_init)) static gboolean clutter_behaviour_parse_custom_node (ClutterScriptable *scriptable, @@ -291,14 +287,12 @@ clutter_behaviour_class_init (ClutterBehaviourClass *klass) _clutter_marshal_VOID__OBJECT, G_TYPE_NONE, 1, CLUTTER_TYPE_ACTOR); - - g_type_class_add_private (klass, sizeof (ClutterBehaviourPrivate)); } static void clutter_behaviour_init (ClutterBehaviour *self) { - self->priv = CLUTTER_BEHAVIOUR_GET_PRIVATE (self); + self->priv = clutter_behaviour_get_instance_private (self); } static void diff --git a/clutter/deprecated/clutter-box.c b/clutter/deprecated/clutter-box.c index 51412c633..51a26a719 100644 --- a/clutter/deprecated/clutter-box.c +++ b/clutter/deprecated/clutter-box.c @@ -89,8 +89,6 @@ #include "clutter-marshal.h" #include "clutter-private.h" -#define CLUTTER_BOX_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CLUTTER_TYPE_BOX, ClutterBoxPrivate)) - struct _ClutterBoxPrivate { ClutterLayoutManager *manager; @@ -112,7 +110,7 @@ static GParamSpec *obj_props[PROP_LAST] = { NULL, }; static const ClutterColor default_box_color = { 255, 255, 255, 255 }; -G_DEFINE_TYPE (ClutterBox, clutter_box, CLUTTER_TYPE_ACTOR); +G_DEFINE_TYPE_WITH_PRIVATE (ClutterBox, clutter_box, CLUTTER_TYPE_ACTOR) static inline void clutter_box_set_color_internal (ClutterBox *box, @@ -238,8 +236,6 @@ clutter_box_class_init (ClutterBoxClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass); - g_type_class_add_private (klass, sizeof (ClutterBoxPrivate)); - actor_class->destroy = clutter_box_real_destroy; actor_class->get_paint_volume = clutter_box_real_get_paint_volume; @@ -282,7 +278,7 @@ clutter_box_class_init (ClutterBoxClass *klass) static void clutter_box_init (ClutterBox *self) { - self->priv = CLUTTER_BOX_GET_PRIVATE (self); + self->priv = clutter_box_get_instance_private (self); } /** diff --git a/clutter/deprecated/clutter-cairo-texture.c b/clutter/deprecated/clutter-cairo-texture.c index d08b6eaba..b9519b05a 100644 --- a/clutter/deprecated/clutter-cairo-texture.c +++ b/clutter/deprecated/clutter-cairo-texture.c @@ -86,9 +86,17 @@ #include "clutter-marshal.h" #include "clutter-private.h" -G_DEFINE_TYPE (ClutterCairoTexture, - clutter_cairo_texture, - CLUTTER_TYPE_TEXTURE); +struct _ClutterCairoTexturePrivate +{ + cairo_surface_t *cr_surface; + + guint surface_width; + guint surface_height; + + cairo_t *cr_context; + + guint auto_resize : 1; +}; enum { @@ -113,6 +121,10 @@ static GParamSpec *obj_props[PROP_LAST] = { NULL, }; static guint cairo_signals[LAST_SIGNAL] = { 0, }; +G_DEFINE_TYPE_WITH_PRIVATE (ClutterCairoTexture, + clutter_cairo_texture, + CLUTTER_TYPE_TEXTURE) + #ifdef CLUTTER_ENABLE_DEBUG #define clutter_warn_if_paint_fail(obj) G_STMT_START { \ if (CLUTTER_ACTOR_IN_PAINT (obj)) { \ @@ -124,20 +136,6 @@ static guint cairo_signals[LAST_SIGNAL] = { 0, }; #define clutter_warn_if_paint_fail(obj) /* void */ #endif /* CLUTTER_ENABLE_DEBUG */ -#define CLUTTER_CAIRO_TEXTURE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CLUTTER_TYPE_CAIRO_TEXTURE, ClutterCairoTexturePrivate)) - -struct _ClutterCairoTexturePrivate -{ - cairo_surface_t *cr_surface; - - guint surface_width; - guint surface_height; - - cairo_t *cr_context; - - guint auto_resize : 1; -}; - typedef struct { ClutterCairoTexture *texture; @@ -580,8 +578,6 @@ clutter_cairo_texture_class_init (ClutterCairoTextureClass *klass) klass->create_surface = clutter_cairo_texture_create_surface; - g_type_class_add_private (gobject_class, sizeof (ClutterCairoTexturePrivate)); - /** * ClutterCairoTexture:surface-width: * @@ -711,7 +707,7 @@ clutter_cairo_texture_class_init (ClutterCairoTextureClass *klass) static void clutter_cairo_texture_init (ClutterCairoTexture *self) { - self->priv = CLUTTER_CAIRO_TEXTURE_GET_PRIVATE (self); + self->priv = clutter_cairo_texture_get_instance_private (self); /* FIXME - we are hardcoding the format; it would be good to have * a :surface-format construct-only property for creating diff --git a/clutter/deprecated/clutter-group.c b/clutter/deprecated/clutter-group.c index 365b0dc5a..5afaf2b6c 100644 --- a/clutter/deprecated/clutter-group.c +++ b/clutter/deprecated/clutter-group.c @@ -65,8 +65,6 @@ #include "cogl/cogl.h" -#define CLUTTER_GROUP_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CLUTTER_TYPE_GROUP, ClutterGroupPrivate)) - struct _ClutterGroupPrivate { GList *children; @@ -77,6 +75,7 @@ struct _ClutterGroupPrivate static void clutter_container_iface_init (ClutterContainerIface *iface); G_DEFINE_TYPE_WITH_CODE (ClutterGroup, clutter_group, CLUTTER_TYPE_ACTOR, + G_ADD_PRIVATE (ClutterGroup) G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_CONTAINER, clutter_container_iface_init)); @@ -441,8 +440,6 @@ clutter_group_class_init (ClutterGroupClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass); - g_type_class_add_private (klass, sizeof (ClutterGroupPrivate)); - actor_class->get_preferred_width = clutter_group_real_get_preferred_width; actor_class->get_preferred_height = clutter_group_real_get_preferred_height; actor_class->allocate = clutter_group_real_allocate; @@ -460,7 +457,7 @@ clutter_group_init (ClutterGroup *self) { ClutterActor *actor = CLUTTER_ACTOR (self); - self->priv = CLUTTER_GROUP_GET_PRIVATE (self); + self->priv = clutter_group_get_instance_private (self); /* turn on some optimization * diff --git a/clutter/deprecated/clutter-rectangle.c b/clutter/deprecated/clutter-rectangle.c index b6236aff5..0565658f5 100644 --- a/clutter/deprecated/clutter-rectangle.c +++ b/clutter/deprecated/clutter-rectangle.c @@ -48,7 +48,15 @@ #include "cogl/cogl.h" -G_DEFINE_TYPE (ClutterRectangle, clutter_rectangle, CLUTTER_TYPE_ACTOR); +struct _ClutterRectanglePrivate +{ + ClutterColor color; + ClutterColor border_color; + + guint border_width; + + guint has_border : 1; +}; enum { @@ -62,22 +70,11 @@ enum /* FIXME: Add gradient, rounded corner props etc */ }; -#define CLUTTER_RECTANGLE_GET_PRIVATE(obj) \ -(G_TYPE_INSTANCE_GET_PRIVATE ((obj), CLUTTER_TYPE_RECTANGLE, ClutterRectanglePrivate)) - -struct _ClutterRectanglePrivate -{ - ClutterColor color; - ClutterColor border_color; - - guint border_width; - - guint has_border : 1; -}; - static const ClutterColor default_color = { 255, 255, 255, 255 }; static const ClutterColor default_border_color = { 0, 0, 0, 255 }; +G_DEFINE_TYPE_WITH_PRIVATE (ClutterRectangle, clutter_rectangle, CLUTTER_TYPE_ACTOR) + static void clutter_rectangle_paint (ClutterActor *self) { @@ -319,8 +316,6 @@ clutter_rectangle_class_init (ClutterRectangleClass *klass) P_("Whether the rectangle should have a border"), FALSE, CLUTTER_PARAM_READWRITE)); - - g_type_class_add_private (gobject_class, sizeof (ClutterRectanglePrivate)); } static void @@ -328,7 +323,7 @@ clutter_rectangle_init (ClutterRectangle *self) { ClutterRectanglePrivate *priv; - self->priv = priv = CLUTTER_RECTANGLE_GET_PRIVATE (self); + self->priv = priv = clutter_rectangle_get_instance_private (self); priv->color = default_color; priv->border_color = default_border_color; diff --git a/clutter/deprecated/clutter-score.c b/clutter/deprecated/clutter-score.c index 2991d6591..bae728598 100644 --- a/clutter/deprecated/clutter-score.c +++ b/clutter/deprecated/clutter-score.c @@ -114,8 +114,6 @@ struct _ClutterScoreEntry GNode *node; }; -#define CLUTTER_SCORE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CLUTTER_TYPE_SCORE, ClutterScorePrivate)) - struct _ClutterScorePrivate { GNode *root; @@ -149,7 +147,7 @@ enum static inline void clutter_score_clear (ClutterScore *score); -G_DEFINE_TYPE (ClutterScore, clutter_score, G_TYPE_OBJECT); +G_DEFINE_TYPE_WITH_PRIVATE (ClutterScore, clutter_score, G_TYPE_OBJECT) static int score_signals[LAST_SIGNAL] = { 0 }; @@ -161,7 +159,9 @@ clutter_score_set_property (GObject *gobject, const GValue *value, GParamSpec *pspec) { - ClutterScorePrivate *priv = CLUTTER_SCORE_GET_PRIVATE (gobject); + ClutterScorePrivate *priv; + + priv = clutter_score_get_instance_private (CLUTTER_SCORE (gobject)); switch (prop_id) { @@ -180,7 +180,9 @@ clutter_score_get_property (GObject *gobject, GValue *value, GParamSpec *pspec) { - ClutterScorePrivate *priv = CLUTTER_SCORE_GET_PRIVATE (gobject); + ClutterScorePrivate *priv; + + priv = clutter_score_get_instance_private (CLUTTER_SCORE (gobject)); switch (prop_id) { @@ -213,8 +215,6 @@ clutter_score_class_init (ClutterScoreClass *klass) gobject_class->get_property = clutter_score_get_property; gobject_class->finalize = clutter_score_finalize; - g_type_class_add_private (klass, sizeof (ClutterScorePrivate)); - /** * ClutterScore:loop: * @@ -330,7 +330,7 @@ clutter_score_init (ClutterScore *self) { ClutterScorePrivate *priv; - self->priv = priv = CLUTTER_SCORE_GET_PRIVATE (self); + self->priv = priv = clutter_score_get_instance_private (self); /* sentinel */ priv->root = g_node_new (NULL); diff --git a/clutter/deprecated/clutter-shader.c b/clutter/deprecated/clutter-shader.c index 3e728ca01..8e50c88d5 100644 --- a/clutter/deprecated/clutter-shader.c +++ b/clutter/deprecated/clutter-shader.c @@ -71,8 +71,6 @@ /* global list of shaders */ static GList *clutter_shaders_list = NULL; -#define CLUTTER_SHADER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CLUTTER_TYPE_SHADER, ClutterShaderPrivate)) - struct _ClutterShaderPrivate { guint compiled : 1; /* Shader is bound to the GL context */ @@ -103,7 +101,7 @@ enum static GParamSpec *obj_props[PROP_LAST]; -G_DEFINE_TYPE (ClutterShader, clutter_shader, G_TYPE_OBJECT); +G_DEFINE_TYPE_WITH_PRIVATE (ClutterShader, clutter_shader, G_TYPE_OBJECT) static inline void clutter_shader_release_internal (ClutterShader *shader) @@ -245,8 +243,6 @@ clutter_shader_class_init (ClutterShaderClass *klass) object_class->get_property = clutter_shader_get_property; object_class->constructor = clutter_shader_constructor; - g_type_class_add_private (klass, sizeof (ClutterShaderPrivate)); - /** * ClutterShader:vertex-source: * @@ -323,7 +319,7 @@ clutter_shader_init (ClutterShader *self) { ClutterShaderPrivate *priv; - priv = self->priv = CLUTTER_SHADER_GET_PRIVATE (self); + priv = self->priv = clutter_shader_get_instance_private (self); priv->compiled = FALSE; diff --git a/clutter/deprecated/clutter-state.c b/clutter/deprecated/clutter-state.c index 8df11a178..4f27ee1af 100644 --- a/clutter/deprecated/clutter-state.c +++ b/clutter/deprecated/clutter-state.c @@ -287,14 +287,10 @@ static void clutter_scriptable_iface_init (ClutterScriptableIface *iface); static guint state_signals[LAST_SIGNAL] = {0, }; -#define CLUTTER_STATE_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \ - CLUTTER_TYPE_STATE, \ - ClutterStatePrivate)) - G_DEFINE_TYPE_WITH_CODE (ClutterState, clutter_state, G_TYPE_OBJECT, + G_ADD_PRIVATE (ClutterState) G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_SCRIPTABLE, - clutter_scriptable_iface_init)); + clutter_scriptable_iface_init)) /** * clutter_state_new: @@ -1462,8 +1458,6 @@ clutter_state_class_init (ClutterStateClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GParamSpec *pspec; - g_type_class_add_private (klass, sizeof (ClutterStatePrivate)); - gobject_class->finalize = clutter_state_finalize; gobject_class->set_property = clutter_state_set_property; gobject_class->get_property = clutter_state_get_property; @@ -1533,7 +1527,7 @@ clutter_state_init (ClutterState *self) { ClutterStatePrivate *priv; - priv = self->priv = CLUTTER_STATE_GET_PRIVATE (self); + priv = self->priv = clutter_state_get_instance_private (self); priv->states = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, diff --git a/clutter/deprecated/clutter-texture.c b/clutter/deprecated/clutter-texture.c index 448c8849f..8d995232e 100644 --- a/clutter/deprecated/clutter-texture.c +++ b/clutter/deprecated/clutter-texture.c @@ -78,16 +78,6 @@ #include "deprecated/clutter-texture.h" #include "deprecated/clutter-util.h" -static void clutter_scriptable_iface_init (ClutterScriptableIface *iface); - -G_DEFINE_TYPE_WITH_CODE (ClutterTexture, - clutter_texture, - CLUTTER_TYPE_ACTOR, - G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_SCRIPTABLE, - clutter_scriptable_iface_init)); - -#define CLUTTER_TEXTURE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CLUTTER_TYPE_TEXTURE, ClutterTexturePrivate)) - typedef struct _ClutterTextureAsyncData ClutterTextureAsyncData; struct _ClutterTexturePrivate @@ -194,6 +184,16 @@ static CoglPipeline *texture_template_pipeline = NULL; static void texture_fbo_free_resources (ClutterTexture *texture); +static void clutter_scriptable_iface_init (ClutterScriptableIface *iface); + +G_DEFINE_TYPE_WITH_CODE (ClutterTexture, + clutter_texture, + CLUTTER_TYPE_ACTOR, + G_ADD_PRIVATE (ClutterTexture) + G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_SCRIPTABLE, + clutter_scriptable_iface_init)); + + GQuark clutter_texture_error_quark (void) { @@ -972,8 +972,6 @@ clutter_texture_class_init (ClutterTextureClass *klass) ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass); GParamSpec *pspec; - g_type_class_add_private (klass, sizeof (ClutterTexturePrivate)); - actor_class->paint = clutter_texture_paint; actor_class->pick = clutter_texture_pick; actor_class->get_paint_volume = clutter_texture_get_paint_volume; @@ -1296,7 +1294,7 @@ clutter_texture_init (ClutterTexture *self) { ClutterTexturePrivate *priv; - self->priv = priv = CLUTTER_TEXTURE_GET_PRIVATE (self); + self->priv = priv = clutter_texture_get_instance_private (self); priv->repeat_x = FALSE; priv->repeat_y = FALSE;