From 8d5161797974f8f9eb25da844f64fc27bceb28f4 Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Mon, 21 Jun 2010 10:20:32 +0100 Subject: [PATCH] Conditionally use g_object_notify_by_pspec This adds a wrapper macro to clutter-private that will use g_object_notify_by_pspec if it's compiled against a version of GLib that is sufficiently new. Otherwise it will notify by the property name as before by extracting the name from the pspec. The objects can then store a static array of GParamSpecs and notify using those as suggested in the documentation for g_object_notify_by_pspec. Note that the name of the variable used for storing the array of GParamSpecs is obj_props instead of properties as used in the documentation because some places in Clutter uses 'properties' as the name of a local variable. Mose of the classes in Clutter have been converted using the script in the bug report. Some classes have not been modified even though the script picked them up as described here: json-generator: We probably don't want to modify the internal copy of JSON behaviour-depth: rectangle: score: stage-manager: These aren't using the separate GParamSpec* variable style. blur-effect: win32/device-manager: Don't actually define any properties even though it has the enum. box-layout: flow-layout: Have some per-child properties that don't work automatically with the script. clutter-model: The script gets confused with ClutterModelIter stage: Script gets confused because PROP_USER_RESIZE doesn't match "user-resizable" test-layout: Don't really want to modify the tests http://bugzilla.clutter-project.org/show_bug.cgi?id=2150 --- clutter/clutter-actor-meta.c | 13 +- clutter/clutter-actor.c | 208 ++++++++++++++--------- clutter/clutter-align-constraint.c | 15 +- clutter/clutter-alpha.c | 19 ++- clutter/clutter-animation.c | 40 +++-- clutter/clutter-animator.c | 8 +- clutter/clutter-behaviour-ellipse.c | 37 ++-- clutter/clutter-behaviour-opacity.c | 12 +- clutter/clutter-behaviour-path.c | 9 +- clutter/clutter-behaviour-rotate.c | 27 ++- clutter/clutter-behaviour-scale.c | 16 +- clutter/clutter-behaviour.c | 9 +- clutter/clutter-bin-layout.c | 18 +- clutter/clutter-bind-constraint.c | 15 +- clutter/clutter-binding-pool.c | 7 +- clutter/clutter-box.c | 15 +- clutter/clutter-cairo-texture.c | 12 +- clutter/clutter-child-meta.c | 8 +- clutter/clutter-click-action.c | 10 +- clutter/clutter-clone.c | 9 +- clutter/clutter-colorize-effect.c | 9 +- clutter/clutter-deform-effect.c | 13 +- clutter/clutter-desaturate-effect.c | 9 +- clutter/clutter-device-manager.c | 7 +- clutter/clutter-drag-action.c | 15 +- clutter/clutter-input-device.c | 9 +- clutter/clutter-interval.c | 7 +- clutter/clutter-layout-meta.c | 7 +- clutter/clutter-page-turn-effect.c | 15 +- clutter/clutter-path.c | 8 +- clutter/clutter-private.h | 12 ++ clutter/clutter-script.c | 8 +- clutter/clutter-settings.c | 15 +- clutter/clutter-shader-effect.c | 7 +- clutter/clutter-shader.c | 20 ++- clutter/clutter-state.c | 10 +- clutter/clutter-text.c | 91 ++++++---- clutter/clutter-texture.c | 42 +++-- clutter/clutter-timeline.c | 18 +- clutter/x11/clutter-device-manager-x11.c | 7 +- clutter/x11/clutter-input-device-x11.c | 7 +- clutter/x11/clutter-keymap-x11.c | 7 +- 42 files changed, 608 insertions(+), 242 deletions(-) diff --git a/clutter/clutter-actor-meta.c b/clutter/clutter-actor-meta.c index 2e9a59161..c860e3115 100644 --- a/clutter/clutter-actor-meta.c +++ b/clutter/clutter-actor-meta.c @@ -38,9 +38,13 @@ enum PROP_ACTOR, PROP_NAME, - PROP_ENABLED + PROP_ENABLED, + + PROP_LAST }; +static GParamSpec *obj_props[PROP_LAST]; + G_DEFINE_ABSTRACT_TYPE (ClutterActorMeta, clutter_actor_meta, G_TYPE_INITIALLY_UNOWNED); @@ -161,6 +165,7 @@ clutter_actor_meta_class_init (ClutterActorMetaClass *klass) P_("The actor attached to the meta"), CLUTTER_TYPE_ACTOR, CLUTTER_PARAM_READABLE); + obj_props[PROP_ACTOR] = pspec; g_object_class_install_property (gobject_class, PROP_ACTOR, pspec); /** @@ -175,6 +180,7 @@ clutter_actor_meta_class_init (ClutterActorMetaClass *klass) P_("The name of the meta"), NULL, CLUTTER_PARAM_READWRITE); + obj_props[PROP_NAME] = pspec; g_object_class_install_property (gobject_class, PROP_NAME, pspec); /** @@ -189,6 +195,7 @@ clutter_actor_meta_class_init (ClutterActorMetaClass *klass) P_("Whether the meta is enabled"), TRUE, CLUTTER_PARAM_READWRITE); + obj_props[PROP_ENABLED] = pspec; g_object_class_install_property (gobject_class, PROP_ENABLED, pspec); } @@ -225,7 +232,7 @@ clutter_actor_meta_set_name (ClutterActorMeta *meta, g_free (meta->priv->name); meta->priv->name = g_strdup (name); - g_object_notify (G_OBJECT (meta), "name"); + _clutter_notify_by_pspec (G_OBJECT (meta), obj_props[PROP_NAME]); } /** @@ -271,7 +278,7 @@ clutter_actor_meta_set_enabled (ClutterActorMeta *meta, meta->priv->is_enabled = is_enabled; - g_object_notify (G_OBJECT (meta), "enabled"); + _clutter_notify_by_pspec (G_OBJECT (meta), obj_props[PROP_ENABLED]); } /** diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index 645442297..741d56f4f 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -546,9 +546,13 @@ enum PROP_ACTIONS, PROP_CONSTRAINTS, - PROP_EFFECT + PROP_EFFECT, + + PROP_LAST }; +static GParamSpec *obj_props[PROP_LAST]; + enum { SHOW, @@ -1013,7 +1017,7 @@ clutter_actor_real_map (ClutterActor *self) /* notify on parent mapped before potentially mapping * children, so apps see a top-down notification. */ - g_object_notify (G_OBJECT (self), "mapped"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_MAPPED]); if (CLUTTER_IS_CONTAINER (self)) clutter_container_foreach_with_internals (CLUTTER_CONTAINER (self), @@ -1069,7 +1073,7 @@ clutter_actor_real_unmap (ClutterActor *self) /* notify on parent mapped after potentially unmapping * children, so apps see a bottom-up notification. */ - g_object_notify (G_OBJECT (self), "mapped"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_MAPPED]); /* relinquish keyboard focus if we were unmapped while owning it */ if (!CLUTTER_ACTOR_IS_TOPLEVEL (self)) @@ -1180,13 +1184,13 @@ clutter_actor_show (ClutterActor *self) if (!priv->show_on_set_parent && !priv->parent_actor) { priv->show_on_set_parent = TRUE; - g_object_notify (G_OBJECT (self), "show-on-set-parent"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_SHOW_ON_SET_PARENT]); } if (!CLUTTER_ACTOR_IS_VISIBLE (self)) { g_signal_emit (self, actor_signals[SHOW], 0); - g_object_notify (G_OBJECT (self), "visible"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_VISIBLE]); } if (priv->parent_actor) @@ -1270,13 +1274,13 @@ clutter_actor_hide (ClutterActor *self) if (priv->show_on_set_parent && !priv->parent_actor) { priv->show_on_set_parent = FALSE; - g_object_notify (G_OBJECT (self), "show-on-set-parent"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_SHOW_ON_SET_PARENT]); } if (CLUTTER_ACTOR_IS_VISIBLE (self)) { g_signal_emit (self, actor_signals[HIDE], 0); - g_object_notify (G_OBJECT (self), "visible"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_VISIBLE]); } if (priv->parent_actor) @@ -1368,7 +1372,7 @@ clutter_actor_realize (ClutterActor *self) CLUTTER_NOTE (ACTOR, "Realizing actor '%s'", get_actor_debug_name (self)); CLUTTER_ACTOR_SET_FLAGS (self, CLUTTER_ACTOR_REALIZED); - g_object_notify (G_OBJECT (self), "realized"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_REALIZED]); g_signal_emit (self, actor_signals[REALIZE], 0); @@ -1485,7 +1489,7 @@ clutter_actor_unrealize_not_hiding (ClutterActor *self) CLUTTER_ACTOR_UNSET_FLAGS (self, CLUTTER_ACTOR_REALIZED); - g_object_notify (G_OBJECT (self), "realized"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_REALIZED]); } /* @@ -1673,15 +1677,15 @@ clutter_actor_notify_if_geometry_changed (ClutterActor *self, */ if (priv->needs_allocation) { - g_object_notify (obj, "x"); - g_object_notify (obj, "y"); - g_object_notify (obj, "width"); - g_object_notify (obj, "height"); + _clutter_notify_by_pspec (obj, obj_props[PROP_X]); + _clutter_notify_by_pspec (obj, obj_props[PROP_Y]); + _clutter_notify_by_pspec (obj, obj_props[PROP_WIDTH]); + _clutter_notify_by_pspec (obj, obj_props[PROP_HEIGHT]); } else if (priv->needs_width_request || priv->needs_height_request) { - g_object_notify (obj, "width"); - g_object_notify (obj, "height"); + _clutter_notify_by_pspec (obj, obj_props[PROP_WIDTH]); + _clutter_notify_by_pspec (obj, obj_props[PROP_HEIGHT]); } else { @@ -1694,16 +1698,16 @@ clutter_actor_notify_if_geometry_changed (ClutterActor *self, heightu = priv->allocation.y2 - priv->allocation.y1; if (xu != old->x1) - g_object_notify (obj, "x"); + _clutter_notify_by_pspec (obj, obj_props[PROP_X]); if (yu != old->y1) - g_object_notify (obj, "y"); + _clutter_notify_by_pspec (obj, obj_props[PROP_Y]); if (widthu != (old->x2 - old->x1)) - g_object_notify (obj, "width"); + _clutter_notify_by_pspec (obj, obj_props[PROP_WIDTH]); if (heightu != (old->y2 - old->y1)) - g_object_notify (obj, "height"); + _clutter_notify_by_pspec (obj, obj_props[PROP_HEIGHT]); } g_object_thaw_notify (obj); @@ -1736,7 +1740,7 @@ clutter_actor_real_allocate (ClutterActor *self, if (x1_changed || y1_changed || x2_changed || y2_changed || flags_changed) { - g_object_notify (G_OBJECT (self), "allocation"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_ALLOCATION]); /* we also emit the ::allocation-changed signal for people * that wish to track the allocation flags @@ -2757,17 +2761,17 @@ clutter_actor_set_rotation_internal (ClutterActor *self, { case CLUTTER_X_AXIS: priv->rxang = angle; - g_object_notify (G_OBJECT (self), "rotation-angle-x"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_ROTATION_ANGLE_X]); break; case CLUTTER_Y_AXIS: priv->ryang = angle; - g_object_notify (G_OBJECT (self), "rotation-angle-y"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_ROTATION_ANGLE_Y]); break; case CLUTTER_Z_AXIS: priv->rzang = angle; - g_object_notify (G_OBJECT (self), "rotation-angle-z"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_ROTATION_ANGLE_Z]); break; } @@ -3482,6 +3486,7 @@ clutter_actor_class_init (ClutterActorClass *klass) -G_MAXFLOAT, G_MAXFLOAT, 0.0, CLUTTER_PARAM_READWRITE); + obj_props[PROP_X] = pspec; g_object_class_install_property (object_class, PROP_X, pspec); /** @@ -3497,6 +3502,7 @@ clutter_actor_class_init (ClutterActorClass *klass) -G_MAXFLOAT, G_MAXFLOAT, 0.0, CLUTTER_PARAM_READWRITE); + obj_props[PROP_Y] = pspec; g_object_class_install_property (object_class, PROP_Y, pspec); /** @@ -3512,6 +3518,7 @@ clutter_actor_class_init (ClutterActorClass *klass) 0.0, G_MAXFLOAT, 0.0, CLUTTER_PARAM_READWRITE); + obj_props[PROP_WIDTH] = pspec; g_object_class_install_property (object_class, PROP_WIDTH, pspec); /** * ClutterActor:height: @@ -3526,6 +3533,7 @@ clutter_actor_class_init (ClutterActorClass *klass) 0.0, G_MAXFLOAT, 0.0, CLUTTER_PARAM_READWRITE); + obj_props[PROP_HEIGHT] = pspec; g_object_class_install_property (object_class, PROP_HEIGHT, pspec); /** @@ -3544,6 +3552,7 @@ clutter_actor_class_init (ClutterActorClass *klass) -G_MAXFLOAT, G_MAXFLOAT, 0.0, CLUTTER_PARAM_READWRITE); + obj_props[PROP_FIXED_X] = pspec; g_object_class_install_property (object_class, PROP_FIXED_X, pspec); /** @@ -3562,6 +3571,7 @@ clutter_actor_class_init (ClutterActorClass *klass) -G_MAXFLOAT, G_MAXFLOAT, 0, CLUTTER_PARAM_READWRITE); + obj_props[PROP_FIXED_Y] = pspec; g_object_class_install_property (object_class, PROP_FIXED_Y, pspec); /** @@ -3578,6 +3588,7 @@ clutter_actor_class_init (ClutterActorClass *klass) "for the actor"), FALSE, CLUTTER_PARAM_READWRITE); + obj_props[PROP_FIXED_POSITION_SET] = pspec; g_object_class_install_property (object_class, PROP_FIXED_POSITION_SET, pspec); @@ -3600,6 +3611,7 @@ clutter_actor_class_init (ClutterActorClass *klass) 0.0, G_MAXFLOAT, 0.0, CLUTTER_PARAM_READWRITE); + obj_props[PROP_MIN_WIDTH] = pspec; g_object_class_install_property (object_class, PROP_MIN_WIDTH, pspec); /** @@ -3619,6 +3631,7 @@ clutter_actor_class_init (ClutterActorClass *klass) 0.0, G_MAXFLOAT, 0.0, CLUTTER_PARAM_READWRITE); + obj_props[PROP_MIN_HEIGHT] = pspec; g_object_class_install_property (object_class, PROP_MIN_HEIGHT, pspec); /** @@ -3638,6 +3651,7 @@ clutter_actor_class_init (ClutterActorClass *klass) 0.0, G_MAXFLOAT, 0.0, CLUTTER_PARAM_READWRITE); + obj_props[PROP_NATURAL_WIDTH] = pspec; g_object_class_install_property (object_class, PROP_NATURAL_WIDTH, pspec); /** @@ -3657,6 +3671,7 @@ clutter_actor_class_init (ClutterActorClass *klass) 0.0, G_MAXFLOAT, 0.0, CLUTTER_PARAM_READWRITE); + obj_props[PROP_NATURAL_HEIGHT] = pspec; g_object_class_install_property (object_class, PROP_NATURAL_HEIGHT, pspec); /** @@ -3672,6 +3687,7 @@ clutter_actor_class_init (ClutterActorClass *klass) P_("Whether to use the min-width property"), FALSE, CLUTTER_PARAM_READWRITE); + obj_props[PROP_MIN_WIDTH_SET] = pspec; g_object_class_install_property (object_class, PROP_MIN_WIDTH_SET, pspec); /** @@ -3687,6 +3703,7 @@ clutter_actor_class_init (ClutterActorClass *klass) P_("Whether to use the min-height property"), FALSE, CLUTTER_PARAM_READWRITE); + obj_props[PROP_MIN_HEIGHT_SET] = pspec; g_object_class_install_property (object_class, PROP_MIN_HEIGHT_SET, pspec); /** @@ -3702,6 +3719,7 @@ clutter_actor_class_init (ClutterActorClass *klass) P_("Whether to use the natural-width property"), FALSE, CLUTTER_PARAM_READWRITE); + obj_props[PROP_NATURAL_WIDTH_SET] = pspec; g_object_class_install_property (object_class, PROP_NATURAL_WIDTH_SET, pspec); @@ -3719,6 +3737,7 @@ clutter_actor_class_init (ClutterActorClass *klass) P_("Whether to use the natural-height property"), FALSE, CLUTTER_PARAM_READWRITE); + obj_props[PROP_NATURAL_HEIGHT_SET] = pspec; g_object_class_install_property (object_class, PROP_NATURAL_HEIGHT_SET, pspec); @@ -3738,6 +3757,7 @@ clutter_actor_class_init (ClutterActorClass *klass) P_("The actor's allocation"), CLUTTER_TYPE_ACTOR_BOX, CLUTTER_PARAM_READABLE); + obj_props[PROP_ALLOCATION] = pspec; g_object_class_install_property (object_class, PROP_ALLOCATION, pspec); /** @@ -3795,6 +3815,7 @@ clutter_actor_class_init (ClutterActorClass *klass) CLUTTER_TYPE_REQUEST_MODE, CLUTTER_REQUEST_HEIGHT_FOR_WIDTH, CLUTTER_PARAM_READWRITE); + obj_props[PROP_REQUEST_MODE] = pspec; g_object_class_install_property (object_class, PROP_REQUEST_MODE, pspec); /** @@ -3810,6 +3831,7 @@ clutter_actor_class_init (ClutterActorClass *klass) -G_MAXFLOAT, G_MAXFLOAT, 0.0, CLUTTER_PARAM_READWRITE); + obj_props[PROP_DEPTH] = pspec; g_object_class_install_property (object_class, PROP_DEPTH, pspec); /** @@ -3824,6 +3846,7 @@ clutter_actor_class_init (ClutterActorClass *klass) 0, 255, 255, CLUTTER_PARAM_READWRITE); + obj_props[PROP_OPACITY] = pspec; g_object_class_install_property (object_class, PROP_OPACITY, pspec); /** @@ -3838,6 +3861,7 @@ clutter_actor_class_init (ClutterActorClass *klass) P_("Whether the actor is visible or not"), FALSE, CLUTTER_PARAM_READWRITE); + obj_props[PROP_VISIBLE] = pspec; g_object_class_install_property (object_class, PROP_VISIBLE, pspec); /** @@ -3853,6 +3877,7 @@ clutter_actor_class_init (ClutterActorClass *klass) P_("Whether the actor will be painted"), FALSE, CLUTTER_PARAM_READABLE); + obj_props[PROP_MAPPED] = pspec; g_object_class_install_property (object_class, PROP_MAPPED, pspec); /** @@ -3867,6 +3892,7 @@ clutter_actor_class_init (ClutterActorClass *klass) P_("Whether the actor has been realized"), FALSE, CLUTTER_PARAM_READABLE); + obj_props[PROP_REALIZED] = pspec; g_object_class_install_property (object_class, PROP_REALIZED, pspec); /** @@ -3883,6 +3909,7 @@ clutter_actor_class_init (ClutterActorClass *klass) P_("Whether the actor is reactive to events"), FALSE, CLUTTER_PARAM_READWRITE); + obj_props[PROP_REACTIVE] = pspec; g_object_class_install_property (object_class, PROP_REACTIVE, pspec); /** @@ -3895,6 +3922,7 @@ clutter_actor_class_init (ClutterActorClass *klass) P_("Whether the actor has a clip set"), FALSE, CLUTTER_PARAM_READABLE); + obj_props[PROP_HAS_CLIP] = pspec; g_object_class_install_property (object_class, PROP_HAS_CLIP, pspec); /** @@ -3910,6 +3938,7 @@ clutter_actor_class_init (ClutterActorClass *klass) P_("The clip region for the actor"), CLUTTER_TYPE_GEOMETRY, CLUTTER_PARAM_READWRITE); + obj_props[PROP_CLIP] = pspec; g_object_class_install_property (object_class, PROP_CLIP, pspec); /** @@ -3924,6 +3953,7 @@ clutter_actor_class_init (ClutterActorClass *klass) P_("Name of the actor"), NULL, CLUTTER_PARAM_READWRITE); + obj_props[PROP_NAME] = pspec; g_object_class_install_property (object_class, PROP_NAME, pspec); /** @@ -3939,6 +3969,7 @@ clutter_actor_class_init (ClutterActorClass *klass) 0.0, G_MAXDOUBLE, 1.0, CLUTTER_PARAM_READWRITE); + obj_props[PROP_SCALE_X] = pspec; g_object_class_install_property (object_class, PROP_SCALE_X, pspec); /** @@ -3954,6 +3985,7 @@ clutter_actor_class_init (ClutterActorClass *klass) 0.0, G_MAXDOUBLE, 1.0, CLUTTER_PARAM_READWRITE); + obj_props[PROP_SCALE_Y] = pspec; g_object_class_install_property (object_class, PROP_SCALE_Y, pspec); /** @@ -3969,6 +4001,7 @@ clutter_actor_class_init (ClutterActorClass *klass) -G_MAXFLOAT, G_MAXFLOAT, 0.0, CLUTTER_PARAM_READWRITE); + obj_props[PROP_SCALE_CENTER_X] = pspec; g_object_class_install_property (object_class, PROP_SCALE_CENTER_X, pspec); /** @@ -3984,6 +4017,7 @@ clutter_actor_class_init (ClutterActorClass *klass) -G_MAXFLOAT, G_MAXFLOAT, 0.0, CLUTTER_PARAM_READWRITE); + obj_props[PROP_SCALE_CENTER_Y] = pspec; g_object_class_install_property (object_class, PROP_SCALE_CENTER_Y, pspec); /** @@ -3999,6 +4033,7 @@ clutter_actor_class_init (ClutterActorClass *klass) CLUTTER_TYPE_GRAVITY, CLUTTER_GRAVITY_NONE, CLUTTER_PARAM_READWRITE); + obj_props[PROP_SCALE_GRAVITY] = pspec; g_object_class_install_property (object_class, PROP_SCALE_GRAVITY, pspec); @@ -4016,6 +4051,7 @@ clutter_actor_class_init (ClutterActorClass *klass) -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, CLUTTER_PARAM_READWRITE); + obj_props[PROP_ROTATION_ANGLE_X] = pspec; g_object_class_install_property (object_class, PROP_ROTATION_ANGLE_X, pspec); /** @@ -4031,6 +4067,7 @@ clutter_actor_class_init (ClutterActorClass *klass) -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, CLUTTER_PARAM_READWRITE); + obj_props[PROP_ROTATION_ANGLE_Y] = pspec; g_object_class_install_property (object_class, PROP_ROTATION_ANGLE_Y, pspec); /** @@ -4046,6 +4083,7 @@ clutter_actor_class_init (ClutterActorClass *klass) -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, CLUTTER_PARAM_READWRITE); + obj_props[PROP_ROTATION_ANGLE_Z] = pspec; g_object_class_install_property (object_class, PROP_ROTATION_ANGLE_Z, pspec); /** @@ -4060,6 +4098,7 @@ clutter_actor_class_init (ClutterActorClass *klass) P_("The rotation center on the X axis"), CLUTTER_TYPE_VERTEX, CLUTTER_PARAM_READWRITE); + obj_props[PROP_ROTATION_CENTER_X] = pspec; g_object_class_install_property (object_class, PROP_ROTATION_CENTER_X, pspec); @@ -4076,6 +4115,7 @@ clutter_actor_class_init (ClutterActorClass *klass) P_("The rotation center on the Y axis"), CLUTTER_TYPE_VERTEX, CLUTTER_PARAM_READWRITE); + obj_props[PROP_ROTATION_CENTER_Y] = pspec; g_object_class_install_property (object_class, PROP_ROTATION_CENTER_Y, pspec); @@ -4092,6 +4132,7 @@ clutter_actor_class_init (ClutterActorClass *klass) P_("The rotation center on the Z axis"), CLUTTER_TYPE_VERTEX, CLUTTER_PARAM_READWRITE); + obj_props[PROP_ROTATION_CENTER_Z] = pspec; g_object_class_install_property (object_class, PROP_ROTATION_CENTER_Z, pspec); @@ -4109,6 +4150,7 @@ clutter_actor_class_init (ClutterActorClass *klass) CLUTTER_TYPE_GRAVITY, CLUTTER_GRAVITY_NONE, CLUTTER_PARAM_READWRITE); + obj_props[PROP_ROTATION_CENTER_Z_GRAVITY] = pspec; g_object_class_install_property (object_class, PROP_ROTATION_CENTER_Z_GRAVITY, pspec); @@ -4127,6 +4169,7 @@ clutter_actor_class_init (ClutterActorClass *klass) -G_MAXFLOAT, G_MAXFLOAT, 0, CLUTTER_PARAM_READWRITE); + obj_props[PROP_ANCHOR_X] = pspec; g_object_class_install_property (object_class, PROP_ANCHOR_X, pspec); /** @@ -4143,6 +4186,7 @@ clutter_actor_class_init (ClutterActorClass *klass) -G_MAXFLOAT, G_MAXFLOAT, 0, CLUTTER_PARAM_READWRITE); + obj_props[PROP_ANCHOR_Y] = pspec; g_object_class_install_property (object_class, PROP_ANCHOR_Y, pspec); /** @@ -4158,6 +4202,7 @@ clutter_actor_class_init (ClutterActorClass *klass) CLUTTER_TYPE_GRAVITY, CLUTTER_GRAVITY_NONE, CLUTTER_PARAM_READWRITE); + obj_props[PROP_ANCHOR_GRAVITY] = pspec; g_object_class_install_property (object_class, PROP_ANCHOR_GRAVITY, pspec); @@ -4176,6 +4221,7 @@ clutter_actor_class_init (ClutterActorClass *klass) P_("Whether the actor is shown when parented"), TRUE, CLUTTER_PARAM_READWRITE); + obj_props[PROP_SHOW_ON_SET_PARENT] = pspec; g_object_class_install_property (object_class, PROP_SHOW_ON_SET_PARENT, pspec); @@ -4197,6 +4243,7 @@ clutter_actor_class_init (ClutterActorClass *klass) "actor's allocation"), FALSE, CLUTTER_PARAM_READWRITE); + obj_props[PROP_CLIP_TO_ALLOCATION] = pspec; g_object_class_install_property (object_class, PROP_CLIP_TO_ALLOCATION, pspec); @@ -4207,6 +4254,7 @@ clutter_actor_class_init (ClutterActorClass *klass) CLUTTER_TYPE_TEXT_DIRECTION, CLUTTER_TEXT_DIRECTION_LTR, CLUTTER_PARAM_READWRITE); + obj_props[PROP_TEXT_DIRECTION] = pspec; g_object_class_install_property (object_class, PROP_TEXT_DIRECTION, pspec); @@ -4225,6 +4273,7 @@ clutter_actor_class_init (ClutterActorClass *klass) "of an input device"), FALSE, CLUTTER_PARAM_READABLE); + obj_props[PROP_HAS_POINTER] = pspec; g_object_class_install_property (object_class, PROP_HAS_POINTER, pspec); @@ -4241,6 +4290,7 @@ clutter_actor_class_init (ClutterActorClass *klass) P_("Adds an action to the actor"), CLUTTER_TYPE_ACTION, CLUTTER_PARAM_WRITABLE); + obj_props[PROP_ACTIONS] = pspec; g_object_class_install_property (object_class, PROP_ACTIONS, pspec); /** @@ -4255,6 +4305,7 @@ clutter_actor_class_init (ClutterActorClass *klass) P_("Adds a constraint to the actor"), CLUTTER_TYPE_CONSTRAINT, CLUTTER_PARAM_WRITABLE); + obj_props[PROP_CONSTRAINTS] = pspec; g_object_class_install_property (object_class, PROP_CONSTRAINTS, pspec); /** @@ -4269,6 +4320,7 @@ clutter_actor_class_init (ClutterActorClass *klass) "Add an effect to be applied on the actor", CLUTTER_TYPE_EFFECT, CLUTTER_PARAM_WRITABLE); + obj_props[PROP_EFFECT] = pspec; g_object_class_install_property (object_class, PROP_EFFECT, pspec); /** @@ -5670,7 +5722,7 @@ clutter_actor_set_fixed_position_set (ClutterActor *self, return; self->priv->position_set = is_set != FALSE; - g_object_notify (G_OBJECT (self), "fixed-position-set"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_FIXED_POSITION_SET]); clutter_actor_queue_relayout (self); } @@ -5732,7 +5784,7 @@ clutter_actor_set_min_width (ClutterActor *self, clutter_actor_store_old_geometry (self, &old); priv->request_min_width = min_width; - g_object_notify (G_OBJECT (self), "min-width"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_MIN_WIDTH]); clutter_actor_set_min_width_set (self, TRUE); clutter_actor_notify_if_geometry_changed (self, &old); @@ -5767,7 +5819,7 @@ clutter_actor_set_min_height (ClutterActor *self, clutter_actor_store_old_geometry (self, &old); priv->request_min_height = min_height; - g_object_notify (G_OBJECT (self), "min-height"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_MIN_HEIGHT]); clutter_actor_set_min_height_set (self, TRUE); clutter_actor_notify_if_geometry_changed (self, &old); @@ -5802,7 +5854,7 @@ clutter_actor_set_natural_width (ClutterActor *self, clutter_actor_store_old_geometry (self, &old); priv->request_natural_width = natural_width; - g_object_notify (G_OBJECT (self), "natural-width"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_NATURAL_WIDTH]); clutter_actor_set_natural_width_set (self, TRUE); clutter_actor_notify_if_geometry_changed (self, &old); @@ -5837,7 +5889,7 @@ clutter_actor_set_natural_height (ClutterActor *self, clutter_actor_store_old_geometry (self, &old); priv->request_natural_height = natural_height; - g_object_notify (G_OBJECT (self), "natural-height"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_NATURAL_HEIGHT]); clutter_actor_set_natural_height_set (self, TRUE); clutter_actor_notify_if_geometry_changed (self, &old); @@ -5860,7 +5912,7 @@ clutter_actor_set_min_width_set (ClutterActor *self, clutter_actor_store_old_geometry (self, &old); priv->min_width_set = use_min_width != FALSE; - g_object_notify (G_OBJECT (self), "min-width-set"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_MIN_WIDTH_SET]); clutter_actor_notify_if_geometry_changed (self, &old); @@ -5880,7 +5932,7 @@ clutter_actor_set_min_height_set (ClutterActor *self, clutter_actor_store_old_geometry (self, &old); priv->min_height_set = use_min_height != FALSE; - g_object_notify (G_OBJECT (self), "min-height-set"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_MIN_HEIGHT_SET]); clutter_actor_notify_if_geometry_changed (self, &old); @@ -5900,7 +5952,7 @@ clutter_actor_set_natural_width_set (ClutterActor *self, clutter_actor_store_old_geometry (self, &old); priv->natural_width_set = use_natural_width != FALSE; - g_object_notify (G_OBJECT (self), "natural-width-set"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_NATURAL_WIDTH_SET]); clutter_actor_notify_if_geometry_changed (self, &old); @@ -5920,7 +5972,7 @@ clutter_actor_set_natural_height_set (ClutterActor *self, clutter_actor_store_old_geometry (self, &old); priv->natural_height_set = use_natural_height != FALSE; - g_object_notify (G_OBJECT (self), "natural-height-set"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_NATURAL_HEIGHT_SET]); clutter_actor_notify_if_geometry_changed (self, &old); @@ -5958,7 +6010,7 @@ clutter_actor_set_request_mode (ClutterActor *self, priv->needs_width_request = TRUE; priv->needs_height_request = TRUE; - g_object_notify (G_OBJECT (self), "request-mode"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_REQUEST_MODE]); clutter_actor_queue_relayout (self); } @@ -6602,10 +6654,10 @@ clutter_actor_set_scale (ClutterActor *self, g_object_freeze_notify (G_OBJECT (self)); priv->scale_x = scale_x; - g_object_notify (G_OBJECT (self), "scale-x"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_SCALE_X]); priv->scale_y = scale_y; - g_object_notify (G_OBJECT (self), "scale-y"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_SCALE_Y]); clutter_actor_queue_redraw (self); @@ -6644,10 +6696,10 @@ clutter_actor_set_scale_full (ClutterActor *self, clutter_actor_set_scale (self, scale_x, scale_y); if (priv->scale_center.is_fractional) - g_object_notify (G_OBJECT (self), "scale-gravity"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_SCALE_GRAVITY]); - g_object_notify (G_OBJECT (self), "scale-center-x"); - g_object_notify (G_OBJECT (self), "scale-center-y"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_SCALE_CENTER_X]); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_SCALE_CENTER_Y]); clutter_anchor_coord_set_units (&priv->scale_center, center_x, center_y, 0); @@ -6690,9 +6742,9 @@ clutter_actor_set_scale_with_gravity (ClutterActor *self, clutter_actor_set_scale (self, scale_x, scale_y); - g_object_notify (G_OBJECT (self), "scale-gravity"); - g_object_notify (G_OBJECT (self), "scale-center-x"); - g_object_notify (G_OBJECT (self), "scale-center-y"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_SCALE_GRAVITY]); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_SCALE_CENTER_X]); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_SCALE_CENTER_Y]); clutter_anchor_coord_set_gravity (&priv->scale_center, gravity); @@ -6798,7 +6850,7 @@ clutter_actor_set_opacity (ClutterActor *self, clutter_actor_queue_redraw (self); - g_object_notify (G_OBJECT (self), "opacity"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_OPACITY]); } } @@ -6904,7 +6956,7 @@ clutter_actor_set_name (ClutterActor *self, g_free (self->priv->name); self->priv->name = g_strdup (name); - g_object_notify (G_OBJECT (self), "name"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_NAME]); } /** @@ -6983,7 +7035,7 @@ clutter_actor_set_depth (ClutterActor *self, clutter_actor_queue_redraw (self); - g_object_notify (G_OBJECT (self), "depth"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_DEPTH]); } } @@ -7049,19 +7101,19 @@ clutter_actor_set_rotation (ClutterActor *self, { case CLUTTER_X_AXIS: clutter_anchor_coord_set_units (&priv->rx_center, x, y, z); - g_object_notify (G_OBJECT (self), "rotation-center-x"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_ROTATION_CENTER_X]); break; case CLUTTER_Y_AXIS: clutter_anchor_coord_set_units (&priv->ry_center, x, y, z); - g_object_notify (G_OBJECT (self), "rotation-center-y"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_ROTATION_CENTER_Y]); break; case CLUTTER_Z_AXIS: if (priv->rz_center.is_fractional) - g_object_notify (G_OBJECT (self), "rotation-center-z-gravity"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_ROTATION_CENTER_Z_GRAVITY]); clutter_anchor_coord_set_units (&priv->rz_center, x, y, z); - g_object_notify (G_OBJECT (self), "rotation-center-z"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_ROTATION_CENTER_Z]); break; } @@ -7102,8 +7154,8 @@ clutter_actor_set_z_rotation_from_gravity (ClutterActor *self, clutter_actor_set_rotation_internal (self, CLUTTER_Z_AXIS, angle); clutter_anchor_coord_set_gravity (&priv->rz_center, gravity); - g_object_notify (G_OBJECT (self), "rotation-center-z-gravity"); - g_object_notify (G_OBJECT (self), "rotation-center-z"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_ROTATION_CENTER_Z_GRAVITY]); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_ROTATION_CENTER_Z]); g_object_thaw_notify (G_OBJECT (self)); } @@ -7225,8 +7277,8 @@ clutter_actor_set_clip (ClutterActor *self, clutter_actor_queue_redraw (self); - g_object_notify (G_OBJECT (self), "has-clip"); - g_object_notify (G_OBJECT (self), "clip"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_HAS_CLIP]); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_CLIP]); } /** @@ -7247,7 +7299,7 @@ clutter_actor_remove_clip (ClutterActor *self) clutter_actor_queue_redraw (self); - g_object_notify (G_OBJECT (self), "has-clip"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_HAS_CLIP]); } /** @@ -7831,7 +7883,7 @@ clutter_actor_set_reactive (ClutterActor *actor, else CLUTTER_ACTOR_UNSET_FLAGS (actor, CLUTTER_ACTOR_REACTIVE); - g_object_notify (G_OBJECT (actor), "reactive"); + _clutter_notify_by_pspec (G_OBJECT (actor), obj_props[PROP_REACTIVE]); } /** @@ -7913,17 +7965,17 @@ clutter_actor_set_anchor_point (ClutterActor *self, NULL); if (priv->anchor.is_fractional) - g_object_notify (G_OBJECT (self), "anchor-gravity"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_ANCHOR_GRAVITY]); if (old_anchor_x != anchor_x) { - g_object_notify (G_OBJECT (self), "anchor-x"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_ANCHOR_X]); changed = TRUE; } if (old_anchor_y != anchor_y) { - g_object_notify (G_OBJECT (self), "anchor-y"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_ANCHOR_Y]); changed = TRUE; } @@ -8075,9 +8127,9 @@ clutter_actor_set_anchor_point_from_gravity (ClutterActor *self, { clutter_anchor_coord_set_gravity (&self->priv->anchor, gravity); - g_object_notify (G_OBJECT (self), "anchor-gravity"); - g_object_notify (G_OBJECT (self), "anchor-x"); - g_object_notify (G_OBJECT (self), "anchor-y"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_ANCHOR_GRAVITY]); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_ANCHOR_X]); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_ANCHOR_Y]); } } @@ -10383,16 +10435,16 @@ clutter_actor_set_flags (ClutterActor *self, visible_set = ((self->flags & CLUTTER_ACTOR_VISIBLE) != 0); if (reactive_set != was_reactive_set) - g_object_notify (obj, "reactive"); + _clutter_notify_by_pspec (obj, obj_props[PROP_REACTIVE]); if (realized_set != was_realized_set) - g_object_notify (obj, "realized"); + _clutter_notify_by_pspec (obj, obj_props[PROP_REALIZED]); if (mapped_set != was_mapped_set) - g_object_notify (obj, "mapped"); + _clutter_notify_by_pspec (obj, obj_props[PROP_MAPPED]); if (visible_set != was_visible_set) - g_object_notify (obj, "visible"); + _clutter_notify_by_pspec (obj, obj_props[PROP_VISIBLE]); g_object_thaw_notify (obj); g_object_unref (obj); @@ -10443,16 +10495,16 @@ clutter_actor_unset_flags (ClutterActor *self, visible_set = ((self->flags & CLUTTER_ACTOR_VISIBLE) != 0); if (reactive_set != was_reactive_set) - g_object_notify (obj, "reactive"); + _clutter_notify_by_pspec (obj, obj_props[PROP_REACTIVE]); if (realized_set != was_realized_set) - g_object_notify (obj, "realized"); + _clutter_notify_by_pspec (obj, obj_props[PROP_REALIZED]); if (mapped_set != was_mapped_set) - g_object_notify (obj, "mapped"); + _clutter_notify_by_pspec (obj, obj_props[PROP_MAPPED]); if (visible_set != was_visible_set) - g_object_notify (obj, "visible"); + _clutter_notify_by_pspec (obj, obj_props[PROP_VISIBLE]); g_object_thaw_notify (obj); } @@ -10560,7 +10612,7 @@ clutter_actor_set_text_direction (ClutterActor *self, * the text direction; see clutter_text_direction_changed_cb() * inside clutter-text.c */ - g_object_notify (G_OBJECT (self), "text-direction"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_TEXT_DIRECTION]); /* if this is a container we need to recurse */ if (CLUTTER_IS_CONTAINER (self)) @@ -10586,7 +10638,7 @@ _clutter_actor_set_has_pointer (ClutterActor *self, { priv->has_pointer = has_pointer; - g_object_notify (G_OBJECT (self), "has-pointer"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_HAS_POINTER]); } } @@ -10811,7 +10863,7 @@ clutter_actor_add_action (ClutterActor *self, _clutter_meta_group_add_meta (priv->actions, CLUTTER_ACTOR_META (action)); - g_object_notify (G_OBJECT (self), "actions"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_ACTIONS]); } /** @@ -10872,7 +10924,7 @@ clutter_actor_remove_action (ClutterActor *self, _clutter_meta_group_remove_meta (priv->actions, CLUTTER_ACTOR_META (action)); - g_object_notify (G_OBJECT (self), "actions"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_ACTIONS]); } /** @@ -10906,7 +10958,7 @@ clutter_actor_remove_action_by_name (ClutterActor *self, _clutter_meta_group_remove_meta (priv->actions, meta); - g_object_notify (G_OBJECT (self), "actions"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_ACTIONS]); } /** @@ -11017,7 +11069,7 @@ clutter_actor_add_constraint (ClutterActor *self, _clutter_meta_group_add_meta (priv->constraints, CLUTTER_ACTOR_META (constraint)); - g_object_notify (G_OBJECT (self), "constraints"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_CONSTRAINTS]); } /** @@ -11079,7 +11131,7 @@ clutter_actor_remove_constraint (ClutterActor *self, _clutter_meta_group_remove_meta (priv->constraints, CLUTTER_ACTOR_META (constraint)); - g_object_notify (G_OBJECT (self), "constraints"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_CONSTRAINTS]); } /** @@ -11216,7 +11268,7 @@ clutter_actor_set_clip_to_allocation (ClutterActor *self, clutter_actor_queue_redraw (self); - g_object_notify (G_OBJECT (self), "clip-to-allocation"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_CLIP_TO_ALLOCATION]); } } @@ -11272,7 +11324,7 @@ clutter_actor_add_effect (ClutterActor *self, clutter_actor_queue_redraw (self); - g_object_notify (G_OBJECT (self), "effect"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_EFFECT]); } /** @@ -11335,7 +11387,7 @@ clutter_actor_remove_effect (ClutterActor *self, clutter_actor_queue_redraw (self); - g_object_notify (G_OBJECT (self), "effect"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_EFFECT]); } /** diff --git a/clutter/clutter-align-constraint.c b/clutter/clutter-align-constraint.c index 32376e960..301763ecc 100644 --- a/clutter/clutter-align-constraint.c +++ b/clutter/clutter-align-constraint.c @@ -71,9 +71,13 @@ enum PROP_SOURCE, PROP_ALIGN_AXIS, - PROP_FACTOR + PROP_FACTOR, + + PROP_LAST }; +static GParamSpec *obj_props[PROP_LAST]; + G_DEFINE_TYPE (ClutterAlignConstraint, clutter_align_constraint, CLUTTER_TYPE_CONSTRAINT); @@ -211,6 +215,7 @@ clutter_align_constraint_class_init (ClutterAlignConstraintClass *klass) CLUTTER_TYPE_ACTOR, CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT); + obj_props[PROP_SOURCE] = pspec; g_object_class_install_property (gobject_class, PROP_SOURCE, pspec); /** @@ -227,6 +232,7 @@ clutter_align_constraint_class_init (ClutterAlignConstraintClass *klass) CLUTTER_ALIGN_X_AXIS, CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT); + obj_props[PROP_ALIGN_AXIS] = pspec; g_object_class_install_property (gobject_class, PROP_ALIGN_AXIS, pspec); /** @@ -248,6 +254,7 @@ clutter_align_constraint_class_init (ClutterAlignConstraintClass *klass) 0.0, CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT); + obj_props[PROP_FACTOR] = pspec; g_object_class_install_property (gobject_class, PROP_FACTOR, pspec); } @@ -334,7 +341,7 @@ clutter_align_constraint_set_source (ClutterAlignConstraint *align, update_actor_position (align); } - g_object_notify (G_OBJECT (align), "source"); + _clutter_notify_by_pspec (G_OBJECT (align), obj_props[PROP_SOURCE]); } /** @@ -378,7 +385,7 @@ clutter_align_constraint_set_align_axis (ClutterAlignConstraint *align, update_actor_position (align); - g_object_notify (G_OBJECT (align), "align-axis"); + _clutter_notify_by_pspec (G_OBJECT (align), obj_props[PROP_ALIGN_AXIS]); } /** @@ -429,7 +436,7 @@ clutter_align_constraint_set_factor (ClutterAlignConstraint *align, update_actor_position (align); - g_object_notify (G_OBJECT (align), "factor"); + _clutter_notify_by_pspec (G_OBJECT (align), obj_props[PROP_FACTOR]); } /** diff --git a/clutter/clutter-alpha.c b/clutter/clutter-alpha.c index 032c6309b..5565cd894 100644 --- a/clutter/clutter-alpha.c +++ b/clutter/clutter-alpha.c @@ -140,9 +140,13 @@ enum PROP_TIMELINE, PROP_ALPHA, - PROP_MODE + PROP_MODE, + + PROP_LAST }; +static GParamSpec *obj_props[PROP_LAST]; + static void timeline_new_frame_cb (ClutterTimeline *timeline, guint current_frame_num, @@ -152,7 +156,7 @@ timeline_new_frame_cb (ClutterTimeline *timeline, /* Update alpha value and notify */ priv->alpha = clutter_alpha_get_alpha (alpha); - g_object_notify (G_OBJECT (alpha), "alpha"); + _clutter_notify_by_pspec (G_OBJECT (alpha), obj_props[PROP_ALPHA]); } static void @@ -336,6 +340,7 @@ clutter_alpha_class_init (ClutterAlphaClass *klass) P_("Timeline used by the alpha"), CLUTTER_TYPE_TIMELINE, CLUTTER_PARAM_READWRITE); + obj_props[PROP_TIMELINE] = pspec; g_object_class_install_property (object_class, PROP_TIMELINE, pspec); /** @@ -353,6 +358,7 @@ clutter_alpha_class_init (ClutterAlphaClass *klass) -1.0, 2.0, 0.0, CLUTTER_PARAM_READABLE); + obj_props[PROP_ALPHA] = pspec; g_object_class_install_property (object_class, PROP_ALPHA, pspec); /** @@ -374,6 +380,7 @@ clutter_alpha_class_init (ClutterAlphaClass *klass) 0, G_MAXULONG, CLUTTER_CUSTOM_MODE, G_PARAM_CONSTRUCT | CLUTTER_PARAM_READWRITE); + obj_props[PROP_MODE] = pspec; g_object_class_install_property (object_class, PROP_MODE, pspec); } @@ -488,7 +495,7 @@ clutter_alpha_set_closure (ClutterAlpha *alpha, clutter_alpha_set_closure_internal (alpha, closure); priv->mode = CLUTTER_CUSTOM_MODE; - g_object_notify (G_OBJECT (alpha), "mode"); + _clutter_notify_by_pspec (G_OBJECT (alpha), obj_props[PROP_MODE]); } /** @@ -524,7 +531,7 @@ clutter_alpha_set_func (ClutterAlpha *alpha, clutter_alpha_set_closure_internal (alpha, closure); priv->mode = CLUTTER_CUSTOM_MODE; - g_object_notify (G_OBJECT (alpha), "mode"); + _clutter_notify_by_pspec (G_OBJECT (alpha), obj_props[PROP_MODE]); } /** @@ -569,7 +576,7 @@ clutter_alpha_set_timeline (ClutterAlpha *alpha, alpha); } - g_object_notify (G_OBJECT (alpha), "timeline"); + _clutter_notify_by_pspec (G_OBJECT (alpha), obj_props[PROP_TIMELINE]); } /** @@ -1291,7 +1298,7 @@ clutter_alpha_set_mode (ClutterAlpha *alpha, else g_assert_not_reached (); - g_object_notify (G_OBJECT (alpha), "mode"); + _clutter_notify_by_pspec (G_OBJECT (alpha), obj_props[PROP_MODE]); } static gulong diff --git a/clutter/clutter-animation.c b/clutter/clutter-animation.c index 037d771fa..0767d5176 100644 --- a/clutter/clutter-animation.c +++ b/clutter/clutter-animation.c @@ -159,9 +159,13 @@ enum PROP_DURATION, PROP_LOOP, PROP_TIMELINE, - PROP_ALPHA + PROP_ALPHA, + + PROP_LAST }; +static GParamSpec *obj_props[PROP_LAST]; + enum { STARTED, @@ -460,6 +464,7 @@ clutter_animation_class_init (ClutterAnimationClass *klass) P_("Object to which the animation applies"), G_TYPE_OBJECT, CLUTTER_PARAM_READWRITE); + obj_props[PROP_OBJECT] = pspec; g_object_class_install_property (gobject_class, PROP_OBJECT, pspec); /** @@ -477,6 +482,7 @@ clutter_animation_class_init (ClutterAnimationClass *klass) 0, G_MAXULONG, CLUTTER_LINEAR, CLUTTER_PARAM_READWRITE); + obj_props[PROP_MODE] = pspec; g_object_class_install_property (gobject_class, PROP_MODE, pspec); /** @@ -491,6 +497,7 @@ clutter_animation_class_init (ClutterAnimationClass *klass) P_("Duration of the animation, in milliseconds"), 0, G_MAXUINT, 0, CLUTTER_PARAM_READWRITE); + obj_props[PROP_DURATION] = pspec; g_object_class_install_property (gobject_class, PROP_DURATION, pspec); /** @@ -505,6 +512,7 @@ clutter_animation_class_init (ClutterAnimationClass *klass) P_("Whether the animation should loop"), FALSE, CLUTTER_PARAM_READWRITE); + obj_props[PROP_LOOP] = pspec; g_object_class_install_property (gobject_class, PROP_LOOP, pspec); /** @@ -519,6 +527,7 @@ clutter_animation_class_init (ClutterAnimationClass *klass) P_("The timeline used by the animation"), CLUTTER_TYPE_TIMELINE, CLUTTER_PARAM_READWRITE); + obj_props[PROP_TIMELINE] = pspec; g_object_class_install_property (gobject_class, PROP_TIMELINE, pspec); /** @@ -533,6 +542,7 @@ clutter_animation_class_init (ClutterAnimationClass *klass) P_("The alpha used by the animation"), CLUTTER_TYPE_ALPHA, CLUTTER_PARAM_READWRITE); + obj_props[PROP_ALPHA] = pspec; g_object_class_install_property (gobject_class, PROP_ALPHA, pspec); /** @@ -1128,7 +1138,7 @@ clutter_animation_get_alpha_internal (ClutterAnimation *animation) priv->alpha = g_object_ref_sink (alpha); - g_object_notify (G_OBJECT (animation), "alpha"); + _clutter_notify_by_pspec (G_OBJECT (animation), obj_props[PROP_ALPHA]); } return priv->alpha; @@ -1163,7 +1173,7 @@ clutter_animation_get_timeline_internal (ClutterAnimation *animation) /* the alpha owns the timeline now */ g_object_unref (timeline); - g_object_notify (G_OBJECT (animation), "timeline"); + _clutter_notify_by_pspec (G_OBJECT (animation), obj_props[PROP_TIMELINE]); return timeline; } @@ -1228,7 +1238,7 @@ clutter_animation_set_object (ClutterAnimation *animation, if (object != NULL) priv->object = g_object_ref (object); - g_object_notify (G_OBJECT (animation), "object"); + _clutter_notify_by_pspec (G_OBJECT (animation), obj_props[PROP_OBJECT]); } /** @@ -1277,7 +1287,7 @@ clutter_animation_set_mode (ClutterAnimation *animation, clutter_alpha_set_mode (alpha, mode); - g_object_notify (G_OBJECT (animation), "mode"); + _clutter_notify_by_pspec (G_OBJECT (animation), obj_props[PROP_MODE]); g_object_thaw_notify (G_OBJECT (animation)); } @@ -1333,7 +1343,7 @@ clutter_animation_set_duration (ClutterAnimation *animation, clutter_timeline_set_duration (timeline, msecs); clutter_timeline_rewind (timeline); - g_object_notify (G_OBJECT (animation), "duration"); + _clutter_notify_by_pspec (G_OBJECT (animation), obj_props[PROP_DURATION]); g_object_thaw_notify (G_OBJECT (animation)); } @@ -1366,7 +1376,7 @@ clutter_animation_set_loop (ClutterAnimation *animation, timeline = clutter_animation_get_timeline_internal (animation); clutter_timeline_set_loop (timeline, loop); - g_object_notify (G_OBJECT (animation), "loop"); + _clutter_notify_by_pspec (G_OBJECT (animation), obj_props[PROP_LOOP]); g_object_thaw_notify (G_OBJECT (animation)); } @@ -1459,9 +1469,9 @@ clutter_animation_set_timeline (ClutterAnimation *animation, alpha = clutter_animation_get_alpha_internal (animation); clutter_alpha_set_timeline (alpha, timeline); - g_object_notify (G_OBJECT (animation), "timeline"); - g_object_notify (G_OBJECT (animation), "duration"); - g_object_notify (G_OBJECT (animation), "loop"); + _clutter_notify_by_pspec (G_OBJECT (animation), obj_props[PROP_TIMELINE]); + _clutter_notify_by_pspec (G_OBJECT (animation), obj_props[PROP_DURATION]); + _clutter_notify_by_pspec (G_OBJECT (animation), obj_props[PROP_LOOP]); if (timeline) { @@ -1589,11 +1599,11 @@ clutter_animation_set_alpha (ClutterAnimation *animation, out: /* emit all relevant notifications */ - g_object_notify (G_OBJECT (animation), "mode"); - g_object_notify (G_OBJECT (animation), "duration"); - g_object_notify (G_OBJECT (animation), "loop"); - g_object_notify (G_OBJECT (animation), "alpha"); - g_object_notify (G_OBJECT (animation), "timeline"); + _clutter_notify_by_pspec (G_OBJECT (animation), obj_props[PROP_MODE]); + _clutter_notify_by_pspec (G_OBJECT (animation), obj_props[PROP_DURATION]); + _clutter_notify_by_pspec (G_OBJECT (animation), obj_props[PROP_LOOP]); + _clutter_notify_by_pspec (G_OBJECT (animation), obj_props[PROP_ALPHA]); + _clutter_notify_by_pspec (G_OBJECT (animation), obj_props[PROP_TIMELINE]); g_object_thaw_notify (G_OBJECT (animation)); } diff --git a/clutter/clutter-animator.c b/clutter/clutter-animator.c index 544081a91..02c74122b 100644 --- a/clutter/clutter-animator.c +++ b/clutter/clutter-animator.c @@ -185,9 +185,13 @@ enum PROP_0, PROP_DURATION, - PROP_TIMELINE + PROP_TIMELINE, + + PROP_LAST }; +static GParamSpec *obj_props[PROP_LAST]; + static void clutter_scriptable_init (ClutterScriptableIface *iface); G_DEFINE_TYPE_WITH_CODE (ClutterAnimator, @@ -1788,6 +1792,7 @@ clutter_animator_class_init (ClutterAnimatorClass *klass) 0, G_MAXUINT, 2000, CLUTTER_PARAM_READWRITE); + obj_props[PROP_DURATION] = pspec; g_object_class_install_property (gobject_class, PROP_DURATION, pspec); /** @@ -1803,6 +1808,7 @@ clutter_animator_class_init (ClutterAnimatorClass *klass) P_("The timeline of the animation"), CLUTTER_TYPE_TIMELINE, CLUTTER_PARAM_READWRITE); + obj_props[PROP_TIMELINE] = pspec; g_object_class_install_property (gobject_class, PROP_TIMELINE, pspec); } diff --git a/clutter/clutter-behaviour-ellipse.c b/clutter/clutter-behaviour-ellipse.c index c1a87e05e..8664fb316 100644 --- a/clutter/clutter-behaviour-ellipse.c +++ b/clutter/clutter-behaviour-ellipse.c @@ -74,8 +74,12 @@ enum PROP_ANGLE_TILT_Y, PROP_ANGLE_TILT_Z, PROP_DIRECTION, + + PROP_LAST }; +static GParamSpec *obj_props[PROP_LAST]; + struct _ClutterBehaviourEllipsePrivate { ClutterKnot center; @@ -391,6 +395,7 @@ clutter_behaviour_ellipse_class_init (ClutterBehaviourEllipseClass *klass) 0.0, 360.0, 0.0, CLUTTER_PARAM_READWRITE); + obj_props[PROP_ANGLE_START] = pspec; g_object_class_install_property (object_class, PROP_ANGLE_START, pspec); /** @@ -406,6 +411,7 @@ clutter_behaviour_ellipse_class_init (ClutterBehaviourEllipseClass *klass) 0.0, 360.0, 0.0, CLUTTER_PARAM_READWRITE); + obj_props[PROP_ANGLE_END] = pspec; g_object_class_install_property (object_class, PROP_ANGLE_END, pspec); /** @@ -421,6 +427,7 @@ clutter_behaviour_ellipse_class_init (ClutterBehaviourEllipseClass *klass) 0.0, 360.0, 360.0, CLUTTER_PARAM_READWRITE); + obj_props[PROP_ANGLE_TILT_X] = pspec; g_object_class_install_property (object_class, PROP_ANGLE_TILT_X, pspec); /** @@ -436,6 +443,7 @@ clutter_behaviour_ellipse_class_init (ClutterBehaviourEllipseClass *klass) 0.0, 360.0, 360.0, CLUTTER_PARAM_READWRITE); + obj_props[PROP_ANGLE_TILT_Y] = pspec; g_object_class_install_property (object_class, PROP_ANGLE_TILT_Y, pspec); /** @@ -451,6 +459,7 @@ clutter_behaviour_ellipse_class_init (ClutterBehaviourEllipseClass *klass) 0.0, 360.0, 360.0, CLUTTER_PARAM_READWRITE); + obj_props[PROP_ANGLE_TILT_Z] = pspec; g_object_class_install_property (object_class, PROP_ANGLE_TILT_Z, pspec); /** @@ -466,6 +475,7 @@ clutter_behaviour_ellipse_class_init (ClutterBehaviourEllipseClass *klass) 0, G_MAXINT, 100, CLUTTER_PARAM_READWRITE); + obj_props[PROP_WIDTH] = pspec; g_object_class_install_property (object_class, PROP_WIDTH, pspec); /** @@ -481,6 +491,7 @@ clutter_behaviour_ellipse_class_init (ClutterBehaviourEllipseClass *klass) 0, G_MAXINT, 50, CLUTTER_PARAM_READWRITE); + obj_props[PROP_HEIGHT] = pspec; g_object_class_install_property (object_class, PROP_HEIGHT, pspec); /** @@ -495,6 +506,7 @@ clutter_behaviour_ellipse_class_init (ClutterBehaviourEllipseClass *klass) P_("Center of ellipse"), CLUTTER_TYPE_KNOT, CLUTTER_PARAM_READWRITE); + obj_props[PROP_CENTER] = pspec; g_object_class_install_property (object_class, PROP_CENTER, pspec); /** @@ -510,6 +522,7 @@ clutter_behaviour_ellipse_class_init (ClutterBehaviourEllipseClass *klass) CLUTTER_TYPE_ROTATE_DIRECTION, CLUTTER_ROTATE_CW, CLUTTER_PARAM_READWRITE); + obj_props[PROP_DIRECTION] = pspec; g_object_class_install_property (object_class, PROP_DIRECTION, pspec); } @@ -609,7 +622,7 @@ clutter_behaviour_ellipse_set_center (ClutterBehaviourEllipse *self, priv->center.x = x; priv->center.y = y; - g_object_notify (G_OBJECT (self), "center"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_CENTER]); } } @@ -665,7 +678,7 @@ clutter_behaviour_ellipse_set_width (ClutterBehaviourEllipse *self, { priv->a = width / 2; - g_object_notify (G_OBJECT (self), "width"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_WIDTH]); } } @@ -710,7 +723,7 @@ clutter_behaviour_ellipse_set_height (ClutterBehaviourEllipse *self, { priv->b = height / 2; - g_object_notify (G_OBJECT (self), "height"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_HEIGHT]); } } @@ -758,7 +771,7 @@ clutter_behaviour_ellipse_set_angle_start (ClutterBehaviourEllipse *self, if (priv->angle_start != new_angle) { priv->angle_start = new_angle; - g_object_notify (G_OBJECT (self), "angle-start"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_ANGLE_START]); } } @@ -807,7 +820,7 @@ clutter_behaviour_ellipse_set_angle_end (ClutterBehaviourEllipse *self, { priv->angle_end = new_angle; - g_object_notify (G_OBJECT (self), "angle-end"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_ANGLE_END]); } } @@ -858,7 +871,7 @@ clutter_behaviour_ellipse_set_angle_tilt (ClutterBehaviourEllipse *self, { priv->angle_tilt_x = angle_tilt; - g_object_notify (G_OBJECT (self), "angle-tilt-x"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_ANGLE_TILT_X]); } break; @@ -867,7 +880,7 @@ clutter_behaviour_ellipse_set_angle_tilt (ClutterBehaviourEllipse *self, { priv->angle_tilt_y = angle_tilt; - g_object_notify (G_OBJECT (self), "angle-tilt-y"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_ANGLE_TILT_Y]); } break; @@ -876,7 +889,7 @@ clutter_behaviour_ellipse_set_angle_tilt (ClutterBehaviourEllipse *self, { priv->angle_tilt_z = angle_tilt; - g_object_notify (G_OBJECT (self), "angle-tilt-z"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_ANGLE_TILT_Z]); } break; } @@ -943,21 +956,21 @@ clutter_behaviour_ellipse_set_tilt (ClutterBehaviourEllipse *self, { priv->angle_tilt_x = angle_tilt_x; - g_object_notify (G_OBJECT (self), "angle-tilt-x"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_ANGLE_TILT_X]); } if (priv->angle_tilt_y != angle_tilt_y) { priv->angle_tilt_y = angle_tilt_y; - g_object_notify (G_OBJECT (self), "angle-tilt-y"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_ANGLE_TILT_Y]); } if (priv->angle_tilt_z != angle_tilt_z) { priv->angle_tilt_z = angle_tilt_z; - g_object_notify (G_OBJECT (self), "angle-tilt-z"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_ANGLE_TILT_Z]); } g_object_thaw_notify (G_OBJECT (self)); @@ -1038,6 +1051,6 @@ clutter_behaviour_ellipse_set_direction (ClutterBehaviourEllipse *self, { priv->direction = direction; - g_object_notify (G_OBJECT (self), "direction"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_DIRECTION]); } } diff --git a/clutter/clutter-behaviour-opacity.c b/clutter/clutter-behaviour-opacity.c index 833182d3d..3f141422b 100644 --- a/clutter/clutter-behaviour-opacity.c +++ b/clutter/clutter-behaviour-opacity.c @@ -72,9 +72,13 @@ enum PROP_0, PROP_OPACITY_START, - PROP_OPACITY_END + PROP_OPACITY_END, + + PROP_LAST }; +static GParamSpec *obj_props[PROP_LAST]; + static void alpha_notify_foreach (ClutterBehaviour *behaviour, ClutterActor *actor, @@ -182,6 +186,7 @@ clutter_behaviour_opacity_class_init (ClutterBehaviourOpacityClass *klass) 0, 255, 0, CLUTTER_PARAM_READWRITE); + obj_props[PROP_OPACITY_START] = pspec; g_object_class_install_property (gobject_class, PROP_OPACITY_START, pspec); /** @@ -197,6 +202,7 @@ clutter_behaviour_opacity_class_init (ClutterBehaviourOpacityClass *klass) 0, 255, 0, CLUTTER_PARAM_READWRITE); + obj_props[PROP_OPACITY_END] = pspec; g_object_class_install_property (gobject_class, PROP_OPACITY_END, pspec); behave_class->alpha_notify = clutter_behaviour_alpha_notify; @@ -265,14 +271,14 @@ clutter_behaviour_opacity_set_bounds (ClutterBehaviourOpacity *behaviour, { priv->opacity_start = opacity_start; - g_object_notify (G_OBJECT (behaviour), "opacity-start"); + _clutter_notify_by_pspec (G_OBJECT (behaviour), obj_props[PROP_OPACITY_START]); } if (priv->opacity_end != opacity_end) { priv->opacity_end = opacity_end; - g_object_notify (G_OBJECT (behaviour), "opacity-end"); + _clutter_notify_by_pspec (G_OBJECT (behaviour), obj_props[PROP_OPACITY_END]); } g_object_thaw_notify (G_OBJECT (behaviour)); diff --git a/clutter/clutter-behaviour-path.c b/clutter/clutter-behaviour-path.c index e665a4789..c0238fa6c 100644 --- a/clutter/clutter-behaviour-path.c +++ b/clutter/clutter-behaviour-path.c @@ -107,9 +107,13 @@ enum { PROP_0, - PROP_PATH + PROP_PATH, + + PROP_LAST }; +static GParamSpec *obj_props[PROP_LAST]; + static void actor_apply_knot_foreach (ClutterBehaviour *behaviour, ClutterActor *actor, @@ -215,6 +219,7 @@ clutter_behaviour_path_class_init (ClutterBehaviourPathClass *klass) "to animate along"), CLUTTER_TYPE_PATH, CLUTTER_PARAM_READWRITE); + obj_props[PROP_PATH] = pspec; g_object_class_install_property (gobject_class, PROP_PATH, pspec); /** @@ -418,7 +423,7 @@ clutter_behaviour_path_set_path (ClutterBehaviourPath *pathb, priv->path = path; - g_object_notify (G_OBJECT (pathb), "path"); + _clutter_notify_by_pspec (G_OBJECT (pathb), obj_props[PROP_PATH]); } /** diff --git a/clutter/clutter-behaviour-rotate.c b/clutter/clutter-behaviour-rotate.c index 67c408ac4..8387f4d7e 100644 --- a/clutter/clutter-behaviour-rotate.c +++ b/clutter/clutter-behaviour-rotate.c @@ -78,9 +78,13 @@ enum PROP_DIRECTION, PROP_CENTER_X, PROP_CENTER_Y, - PROP_CENTER_Z + PROP_CENTER_Z, + + PROP_LAST }; +static GParamSpec *obj_props[PROP_LAST]; + typedef struct { gdouble angle; } RotateFrameClosure; @@ -275,6 +279,7 @@ clutter_behaviour_rotate_class_init (ClutterBehaviourRotateClass *klass) 0.0, 360.0, 0.0, CLUTTER_PARAM_READWRITE); + obj_props[PROP_ANGLE_START] = pspec; g_object_class_install_property (gobject_class, PROP_ANGLE_START, pspec); @@ -292,6 +297,7 @@ clutter_behaviour_rotate_class_init (ClutterBehaviourRotateClass *klass) 0.0, 360.0, 0.0, CLUTTER_PARAM_READWRITE); + obj_props[PROP_ANGLE_END] = pspec; g_object_class_install_property (gobject_class, PROP_ANGLE_END, pspec); @@ -309,6 +315,7 @@ clutter_behaviour_rotate_class_init (ClutterBehaviourRotateClass *klass) CLUTTER_TYPE_ROTATE_AXIS, CLUTTER_Z_AXIS, CLUTTER_PARAM_READWRITE); + obj_props[PROP_AXIS] = pspec; g_object_class_install_property (gobject_class, PROP_AXIS, pspec); @@ -326,6 +333,7 @@ clutter_behaviour_rotate_class_init (ClutterBehaviourRotateClass *klass) CLUTTER_TYPE_ROTATE_DIRECTION, CLUTTER_ROTATE_CW, CLUTTER_PARAM_READWRITE); + obj_props[PROP_DIRECTION] = pspec; g_object_class_install_property (gobject_class, PROP_DIRECTION, pspec); @@ -343,6 +351,7 @@ clutter_behaviour_rotate_class_init (ClutterBehaviourRotateClass *klass) -G_MAXINT, G_MAXINT, 0, CLUTTER_PARAM_READWRITE); + obj_props[PROP_CENTER_X] = pspec; g_object_class_install_property (gobject_class, PROP_CENTER_X, pspec); @@ -360,6 +369,7 @@ clutter_behaviour_rotate_class_init (ClutterBehaviourRotateClass *klass) -G_MAXINT, G_MAXINT, 0, CLUTTER_PARAM_READWRITE); + obj_props[PROP_CENTER_Y] = pspec; g_object_class_install_property (gobject_class, PROP_CENTER_Y, pspec); @@ -377,6 +387,7 @@ clutter_behaviour_rotate_class_init (ClutterBehaviourRotateClass *klass) -G_MAXINT, G_MAXINT, 0, CLUTTER_PARAM_READWRITE); + obj_props[PROP_CENTER_Z] = pspec; g_object_class_install_property (gobject_class, PROP_CENTER_Z, pspec); @@ -475,7 +486,7 @@ clutter_behaviour_rotate_set_axis (ClutterBehaviourRotate *rotate, { priv->axis = axis; - g_object_notify (G_OBJECT (rotate), "axis"); + _clutter_notify_by_pspec (G_OBJECT (rotate), obj_props[PROP_AXIS]); } } @@ -521,7 +532,7 @@ clutter_behaviour_rotate_set_direction (ClutterBehaviourRotate *rotate, { priv->direction = direction; - g_object_notify (G_OBJECT (rotate), "direction"); + _clutter_notify_by_pspec (G_OBJECT (rotate), obj_props[PROP_DIRECTION]); } } @@ -581,14 +592,14 @@ clutter_behaviour_rotate_set_bounds (ClutterBehaviourRotate *rotate, { priv->angle_start = clamp_angle (angle_start); - g_object_notify (G_OBJECT (rotate), "angle-start"); + _clutter_notify_by_pspec (G_OBJECT (rotate), obj_props[PROP_ANGLE_START]); } if (priv->angle_end != angle_end) { priv->angle_end = clamp_angle (angle_end); - g_object_notify (G_OBJECT (rotate), "angle-end"); + _clutter_notify_by_pspec (G_OBJECT (rotate), obj_props[PROP_ANGLE_END]); } g_object_thaw_notify (G_OBJECT (rotate)); @@ -623,19 +634,19 @@ clutter_behaviour_rotate_set_center (ClutterBehaviourRotate *rotate, if (priv->center_x != x) { priv->center_x = x; - g_object_notify (G_OBJECT (rotate), "center-x"); + _clutter_notify_by_pspec (G_OBJECT (rotate), obj_props[PROP_CENTER_X]); } if (priv->center_y != y) { priv->center_y = y; - g_object_notify (G_OBJECT (rotate), "center-y"); + _clutter_notify_by_pspec (G_OBJECT (rotate), obj_props[PROP_CENTER_Y]); } if (priv->center_z != z) { priv->center_z = z; - g_object_notify (G_OBJECT (rotate), "center-z"); + _clutter_notify_by_pspec (G_OBJECT (rotate), obj_props[PROP_CENTER_Z]); } g_object_thaw_notify (G_OBJECT (rotate)); diff --git a/clutter/clutter-behaviour-scale.c b/clutter/clutter-behaviour-scale.c index 7b2340e7d..5014c0dbc 100644 --- a/clutter/clutter-behaviour-scale.c +++ b/clutter/clutter-behaviour-scale.c @@ -66,8 +66,12 @@ enum PROP_Y_SCALE_START, PROP_X_SCALE_END, PROP_Y_SCALE_END, + + PROP_LAST }; +static GParamSpec *obj_props[PROP_LAST]; + typedef struct { gdouble scale_x; gdouble scale_y; @@ -214,6 +218,7 @@ clutter_behaviour_scale_class_init (ClutterBehaviourScaleClass *klass) 0.0, G_MAXDOUBLE, 1.0, CLUTTER_PARAM_READWRITE); + obj_props[PROP_X_SCALE_START] = pspec; g_object_class_install_property (gobject_class, PROP_X_SCALE_START, pspec); @@ -230,6 +235,7 @@ clutter_behaviour_scale_class_init (ClutterBehaviourScaleClass *klass) 0.0, G_MAXDOUBLE, 1.0, CLUTTER_PARAM_READWRITE); + obj_props[PROP_X_SCALE_END] = pspec; g_object_class_install_property (gobject_class, PROP_X_SCALE_END, pspec); @@ -246,6 +252,7 @@ clutter_behaviour_scale_class_init (ClutterBehaviourScaleClass *klass) 0.0, G_MAXDOUBLE, 1.0, CLUTTER_PARAM_READWRITE); + obj_props[PROP_Y_SCALE_START] = pspec; g_object_class_install_property (gobject_class, PROP_Y_SCALE_START, pspec); @@ -262,6 +269,7 @@ clutter_behaviour_scale_class_init (ClutterBehaviourScaleClass *klass) 0.0, G_MAXDOUBLE, 1.0, CLUTTER_PARAM_READWRITE); + obj_props[PROP_Y_SCALE_END] = pspec; g_object_class_install_property (gobject_class, PROP_Y_SCALE_END, pspec); @@ -342,25 +350,25 @@ clutter_behaviour_scale_set_bounds (ClutterBehaviourScale *scale, if (priv->x_scale_start != x_scale_start) { priv->x_scale_start = x_scale_start; - g_object_notify (G_OBJECT (scale), "x-scale-start"); + _clutter_notify_by_pspec (G_OBJECT (scale), obj_props[PROP_X_SCALE_START]); } if (priv->y_scale_start != y_scale_start) { priv->y_scale_start = y_scale_start; - g_object_notify (G_OBJECT (scale), "y-scale-start"); + _clutter_notify_by_pspec (G_OBJECT (scale), obj_props[PROP_Y_SCALE_START]); } if (priv->x_scale_end != x_scale_end) { priv->x_scale_end = x_scale_end; - g_object_notify (G_OBJECT (scale), "x-scale-end"); + _clutter_notify_by_pspec (G_OBJECT (scale), obj_props[PROP_X_SCALE_END]); } if (priv->y_scale_end != y_scale_end) { priv->y_scale_end = y_scale_end; - g_object_notify (G_OBJECT (scale), "y-scale-end"); + _clutter_notify_by_pspec (G_OBJECT (scale), obj_props[PROP_Y_SCALE_END]); } g_object_thaw_notify (G_OBJECT (scale)); diff --git a/clutter/clutter-behaviour.c b/clutter/clutter-behaviour.c index f1636e45e..93bc493fe 100644 --- a/clutter/clutter-behaviour.c +++ b/clutter/clutter-behaviour.c @@ -176,9 +176,13 @@ struct _ClutterBehaviourPrivate enum { PROP_0, - PROP_ALPHA + PROP_ALPHA, + + PROP_LAST }; +static GParamSpec *obj_props[PROP_LAST]; + enum { APPLIED, REMOVED, @@ -305,6 +309,7 @@ clutter_behaviour_class_init (ClutterBehaviourClass *klass) P_("Alpha Object to drive the behaviour"), CLUTTER_TYPE_ALPHA, CLUTTER_PARAM_READWRITE); + obj_props[PROP_ALPHA] = pspec; g_object_class_install_property (object_class, PROP_ALPHA, pspec); klass->alpha_notify = clutter_behaviour_alpha_notify_unimplemented; @@ -639,7 +644,7 @@ clutter_behaviour_set_alpha (ClutterBehaviour *behave, priv->alpha, priv->notify_id); } - g_object_notify (G_OBJECT (behave), "alpha"); + _clutter_notify_by_pspec (G_OBJECT (behave), obj_props[PROP_ALPHA]); } /** diff --git a/clutter/clutter-bin-layout.c b/clutter/clutter-bin-layout.c index 158485e02..e13f50404 100644 --- a/clutter/clutter-bin-layout.c +++ b/clutter/clutter-bin-layout.c @@ -140,9 +140,13 @@ enum PROP_0, PROP_X_ALIGN, - PROP_Y_ALIGN + PROP_Y_ALIGN, + + PROP_LAST }; +static GParamSpec *obj_props[PROP_LAST]; + G_DEFINE_TYPE (ClutterBinLayer, clutter_bin_layer, CLUTTER_TYPE_LAYOUT_META); @@ -171,7 +175,7 @@ set_layer_x_align (ClutterBinLayer *self, manager = clutter_layout_meta_get_manager (meta); clutter_layout_manager_layout_changed (manager); - g_object_notify (G_OBJECT (self), "x-align"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_X_ALIGN]); } static void @@ -190,7 +194,7 @@ set_layer_y_align (ClutterBinLayer *self, manager = clutter_layout_meta_get_manager (meta); clutter_layout_manager_layout_changed (manager); - g_object_notify (G_OBJECT (self), "y-align"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_Y_ALIGN]); } static void @@ -257,6 +261,7 @@ clutter_bin_layer_class_init (ClutterBinLayerClass *klass) CLUTTER_TYPE_BIN_ALIGNMENT, CLUTTER_BIN_ALIGNMENT_CENTER, CLUTTER_PARAM_READWRITE); + obj_props[PROP_LAYER_X_ALIGN] = pspec; g_object_class_install_property (gobject_class, PROP_LAYER_X_ALIGN, pspec); @@ -268,6 +273,7 @@ clutter_bin_layer_class_init (ClutterBinLayerClass *klass) CLUTTER_TYPE_BIN_ALIGNMENT, CLUTTER_BIN_ALIGNMENT_CENTER, CLUTTER_PARAM_READWRITE); + obj_props[PROP_LAYER_Y_ALIGN] = pspec; g_object_class_install_property (gobject_class, PROP_LAYER_Y_ALIGN, pspec); @@ -299,7 +305,7 @@ set_x_align (ClutterBinLayout *self, manager = CLUTTER_LAYOUT_MANAGER (self); clutter_layout_manager_layout_changed (manager); - g_object_notify (G_OBJECT (self), "x-align"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_X_ALIGN]); } } @@ -318,7 +324,7 @@ set_y_align (ClutterBinLayout *self, manager = CLUTTER_LAYOUT_MANAGER (self); clutter_layout_manager_layout_changed (manager); - g_object_notify (G_OBJECT (self), "y-align"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_Y_ALIGN]); } } @@ -646,6 +652,7 @@ clutter_bin_layout_class_init (ClutterBinLayoutClass *klass) CLUTTER_TYPE_BIN_ALIGNMENT, CLUTTER_BIN_ALIGNMENT_CENTER, CLUTTER_PARAM_READWRITE); + obj_props[PROP_X_ALIGN] = pspec; g_object_class_install_property (gobject_class, PROP_X_ALIGN, pspec); /** @@ -663,6 +670,7 @@ clutter_bin_layout_class_init (ClutterBinLayoutClass *klass) CLUTTER_TYPE_BIN_ALIGNMENT, CLUTTER_BIN_ALIGNMENT_CENTER, CLUTTER_PARAM_READWRITE); + obj_props[PROP_Y_ALIGN] = pspec; g_object_class_install_property (gobject_class, PROP_Y_ALIGN, pspec); layout_class->get_preferred_width = diff --git a/clutter/clutter-bind-constraint.c b/clutter/clutter-bind-constraint.c index 1603f7f92..33528e0b2 100644 --- a/clutter/clutter-bind-constraint.c +++ b/clutter/clutter-bind-constraint.c @@ -117,9 +117,13 @@ enum PROP_SOURCE, PROP_COORDINATE, - PROP_OFFSET + PROP_OFFSET, + + PROP_LAST }; +static GParamSpec *obj_props[PROP_LAST]; + G_DEFINE_TYPE (ClutterBindConstraint, clutter_bind_constraint, CLUTTER_TYPE_CONSTRAINT); @@ -272,6 +276,7 @@ clutter_bind_constraint_class_init (ClutterBindConstraintClass *klass) CLUTTER_TYPE_ACTOR, CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT); + obj_props[PROP_SOURCE] = pspec; g_object_class_install_property (gobject_class, PROP_SOURCE, pspec); /** @@ -288,6 +293,7 @@ clutter_bind_constraint_class_init (ClutterBindConstraintClass *klass) CLUTTER_BIND_X, CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT); + obj_props[PROP_COORDINATE] = pspec; g_object_class_install_property (gobject_class, PROP_COORDINATE, pspec); /** @@ -304,6 +310,7 @@ clutter_bind_constraint_class_init (ClutterBindConstraintClass *klass) 0.0f, CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT); + obj_props[PROP_OFFSET] = pspec; g_object_class_install_property (gobject_class, PROP_OFFSET, pspec); } @@ -391,7 +398,7 @@ clutter_bind_constraint_set_source (ClutterBindConstraint *constraint, update_actor_coords (constraint); } - g_object_notify (G_OBJECT (constraint), "source"); + _clutter_notify_by_pspec (G_OBJECT (constraint), obj_props[PROP_SOURCE]); } /** @@ -434,7 +441,7 @@ clutter_bind_constraint_set_coordinate (ClutterBindConstraint *constraint, update_actor_coords (constraint); - g_object_notify (G_OBJECT (constraint), "coordinate"); + _clutter_notify_by_pspec (G_OBJECT (constraint), obj_props[PROP_COORDINATE]); } /** @@ -478,7 +485,7 @@ clutter_bind_constraint_set_offset (ClutterBindConstraint *constraint, update_actor_coords (constraint); - g_object_notify (G_OBJECT (constraint), "offset"); + _clutter_notify_by_pspec (G_OBJECT (constraint), obj_props[PROP_OFFSET]); } /** diff --git a/clutter/clutter-binding-pool.c b/clutter/clutter-binding-pool.c index 1d41829d4..b68e7568a 100644 --- a/clutter/clutter-binding-pool.c +++ b/clutter/clutter-binding-pool.c @@ -153,9 +153,13 @@ enum { PROP_0, - PROP_NAME + PROP_NAME, + + PROP_LAST }; +static GParamSpec *obj_props[PROP_LAST]; + G_DEFINE_TYPE (ClutterBindingPool, clutter_binding_pool, G_TYPE_OBJECT); static guint @@ -318,6 +322,7 @@ clutter_binding_pool_class_init (ClutterBindingPoolClass *klass) NULL, CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); + obj_props[PROP_NAME] = pspec; g_object_class_install_property (gobject_class, PROP_NAME, pspec); } diff --git a/clutter/clutter-box.c b/clutter/clutter-box.c index 763fbd285..694e1a0e6 100644 --- a/clutter/clutter-box.c +++ b/clutter/clutter-box.c @@ -101,9 +101,13 @@ enum PROP_LAYOUT_MANAGER, PROP_COLOR, - PROP_COLOR_SET + PROP_COLOR_SET, + + PROP_LAST }; +static GParamSpec *obj_props[PROP_LAST]; + static const ClutterColor default_box_color = { 255, 255, 255, 255 }; static void clutter_container_iface_init (ClutterContainerIface *iface); @@ -394,7 +398,7 @@ set_layout_manager (ClutterBox *self, clutter_actor_queue_relayout (CLUTTER_ACTOR (self)); - g_object_notify (G_OBJECT (self), "layout-manager"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_LAYOUT_MANAGER]); } static void @@ -492,6 +496,7 @@ clutter_box_class_init (ClutterBoxClass *klass) CLUTTER_TYPE_LAYOUT_MANAGER, CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT); + obj_props[PROP_LAYOUT_MANAGER] = pspec; g_object_class_install_property (gobject_class, PROP_LAYOUT_MANAGER, pspec); @@ -510,6 +515,7 @@ clutter_box_class_init (ClutterBoxClass *klass) P_("The background color of the box"), &default_box_color, CLUTTER_PARAM_READWRITE); + obj_props[PROP_COLOR] = pspec; g_object_class_install_property (gobject_class, PROP_COLOR, pspec); /** @@ -524,6 +530,7 @@ clutter_box_class_init (ClutterBoxClass *klass) P_("Whether the background color is set"), FALSE, CLUTTER_PARAM_READWRITE); + obj_props[PROP_COLOR_SET] = pspec; g_object_class_install_property (gobject_class, PROP_COLOR_SET, pspec); } @@ -967,8 +974,8 @@ clutter_box_set_color (ClutterBox *box, clutter_actor_queue_redraw (CLUTTER_ACTOR (box)); - g_object_notify (G_OBJECT (box), "color-set"); - g_object_notify (G_OBJECT (box), "color"); + _clutter_notify_by_pspec (G_OBJECT (box), obj_props[PROP_COLOR_SET]); + _clutter_notify_by_pspec (G_OBJECT (box), obj_props[PROP_COLOR]); } /** diff --git a/clutter/clutter-cairo-texture.c b/clutter/clutter-cairo-texture.c index b31fa77ba..a4d02951a 100644 --- a/clutter/clutter-cairo-texture.c +++ b/clutter/clutter-cairo-texture.c @@ -91,9 +91,13 @@ enum PROP_0, PROP_SURFACE_WIDTH, - PROP_SURFACE_HEIGHT + PROP_SURFACE_HEIGHT, + + PROP_LAST }; +static GParamSpec *obj_props[PROP_LAST]; + #ifdef CLUTTER_ENABLE_DEBUG #define clutter_warn_if_paint_fail(obj) G_STMT_START { \ if (CLUTTER_ACTOR_IN_PAINT (obj)) { \ @@ -395,6 +399,7 @@ clutter_cairo_texture_class_init (ClutterCairoTextureClass *klass) 0, G_MAXUINT, 0, CLUTTER_PARAM_READWRITE); + obj_props[PROP_SURFACE_WIDTH] = pspec; g_object_class_install_property (gobject_class, PROP_SURFACE_WIDTH, pspec); @@ -412,6 +417,7 @@ clutter_cairo_texture_class_init (ClutterCairoTextureClass *klass) 0, G_MAXUINT, 0, CLUTTER_PARAM_READWRITE); + obj_props[PROP_SURFACE_HEIGHT] = pspec; g_object_class_install_property (gobject_class, PROP_SURFACE_HEIGHT, pspec); @@ -709,13 +715,13 @@ clutter_cairo_texture_set_surface_size (ClutterCairoTexture *self, if (priv->width != width) { priv->width = width; - g_object_notify (G_OBJECT (self), "surface-width"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_SURFACE_WIDTH]); } if (priv->height != height) { priv->height = height; - g_object_notify (G_OBJECT (self), "surface-height"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_SURFACE_HEIGHT]); } clutter_cairo_texture_surface_resize_internal (self); diff --git a/clutter/clutter-child-meta.c b/clutter/clutter-child-meta.c index dc2ec923f..93e50df25 100644 --- a/clutter/clutter-child-meta.c +++ b/clutter/clutter-child-meta.c @@ -52,9 +52,13 @@ enum PROP_0, PROP_CONTAINER, - PROP_ACTOR + PROP_ACTOR, + + PROP_LAST }; +static GParamSpec *obj_props[PROP_LAST]; + static void clutter_child_meta_set_property (GObject *object, guint prop_id, @@ -125,6 +129,7 @@ clutter_child_meta_class_init (ClutterChildMetaClass *klass) CLUTTER_TYPE_CONTAINER, G_PARAM_CONSTRUCT_ONLY | CLUTTER_PARAM_READWRITE); + obj_props[PROP_CONTAINER] = pspec; g_object_class_install_property (gobject_class, PROP_CONTAINER, pspec); /** @@ -140,6 +145,7 @@ clutter_child_meta_class_init (ClutterChildMetaClass *klass) CLUTTER_TYPE_ACTOR, G_PARAM_CONSTRUCT_ONLY | CLUTTER_PARAM_READWRITE); + obj_props[PROP_ACTOR] = pspec; g_object_class_install_property (gobject_class, PROP_ACTOR, pspec); } diff --git a/clutter/clutter-click-action.c b/clutter/clutter-click-action.c index f9bf41cd8..019df8d3f 100644 --- a/clutter/clutter-click-action.c +++ b/clutter/clutter-click-action.c @@ -74,9 +74,13 @@ enum PROP_0, PROP_HELD, - PROP_PRESSED + PROP_PRESSED, + + PROP_LAST }; +static GParamSpec *obj_props[PROP_LAST]; + enum { CLICKED, @@ -98,7 +102,7 @@ click_action_set_pressed (ClutterClickAction *action, return; priv->is_pressed = is_pressed; - g_object_notify (G_OBJECT (action), "pressed"); + _clutter_notify_by_pspec (G_OBJECT (action), obj_props[PROP_PRESSED]); } static gboolean @@ -237,6 +241,7 @@ clutter_click_action_class_init (ClutterClickActionClass *klass) P_("Whether the clickable should be in pressed state"), FALSE, CLUTTER_PARAM_READABLE); + obj_props[PROP_PRESSED] = pspec; g_object_class_install_property (gobject_class, PROP_PRESSED, pspec); /** @@ -251,6 +256,7 @@ clutter_click_action_class_init (ClutterClickActionClass *klass) P_("Whether the clickable has a grab"), FALSE, CLUTTER_PARAM_READABLE); + obj_props[PROP_HELD] = pspec; g_object_class_install_property (gobject_class, PROP_HELD, pspec); /** diff --git a/clutter/clutter-clone.c b/clutter/clutter-clone.c index 6de9668f8..075bff397 100644 --- a/clutter/clutter-clone.c +++ b/clutter/clutter-clone.c @@ -55,9 +55,13 @@ enum { PROP_0, - PROP_SOURCE + PROP_SOURCE, + + PROP_LAST }; +static GParamSpec *obj_props[PROP_LAST]; + #define CLUTTER_CLONE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CLUTTER_TYPE_CLONE, ClutterClonePrivate)) struct _ClutterClonePrivate @@ -276,6 +280,7 @@ clutter_clone_class_init (ClutterCloneClass *klass) CLUTTER_TYPE_ACTOR, G_PARAM_CONSTRUCT | CLUTTER_PARAM_READWRITE); + obj_props[PROP_SOURCE] = pspec; g_object_class_install_property (gobject_class, PROP_SOURCE, pspec); } @@ -352,7 +357,7 @@ clutter_clone_set_source_internal (ClutterClone *clone, G_CALLBACK (clone_source_queue_relayout_cb), clone); } - g_object_notify (G_OBJECT (clone), "source"); + _clutter_notify_by_pspec (G_OBJECT (clone), obj_props[PROP_SOURCE]); clutter_actor_queue_relayout (CLUTTER_ACTOR (clone)); } diff --git a/clutter/clutter-colorize-effect.c b/clutter/clutter-colorize-effect.c index 721f08d3b..3ba298070 100644 --- a/clutter/clutter-colorize-effect.c +++ b/clutter/clutter-colorize-effect.c @@ -97,9 +97,13 @@ enum { PROP_0, - PROP_TINT + PROP_TINT, + + PROP_LAST }; +static GParamSpec *obj_props[PROP_LAST]; + G_DEFINE_TYPE (ClutterColorizeEffect, clutter_colorize_effect, CLUTTER_TYPE_SHADER_EFFECT); @@ -212,6 +216,7 @@ clutter_colorize_effect_class_init (ClutterColorizeEffectClass *klass) P_("The tint to apply"), &default_tint, CLUTTER_PARAM_READWRITE); + obj_props[PROP_TINT] = pspec; g_object_class_install_property (gobject_class, PROP_TINT, pspec); } @@ -260,7 +265,7 @@ clutter_colorize_effect_set_tint (ClutterColorizeEffect *effect, if (effect->actor != NULL) clutter_actor_queue_redraw (effect->actor); - g_object_notify (G_OBJECT (effect), "tint"); + _clutter_notify_by_pspec (G_OBJECT (effect), obj_props[PROP_TINT]); } /** diff --git a/clutter/clutter-deform-effect.c b/clutter/clutter-deform-effect.c index c15204ce8..a21e533e6 100644 --- a/clutter/clutter-deform-effect.c +++ b/clutter/clutter-deform-effect.c @@ -93,9 +93,13 @@ enum PROP_X_TILES, PROP_Y_TILES, - PROP_BACK_MATERIAL + PROP_BACK_MATERIAL, + + PROP_LAST }; +static GParamSpec *obj_props[PROP_LAST]; + G_DEFINE_ABSTRACT_TYPE (ClutterDeformEffect, clutter_deform_effect, CLUTTER_TYPE_OFFSCREEN_EFFECT); @@ -523,6 +527,7 @@ clutter_deform_effect_class_init (ClutterDeformEffectClass *klass) 1, G_MAXUINT, DEFAULT_N_TILES, CLUTTER_PARAM_READWRITE); + obj_props[PROP_X_TILES] = pspec; g_object_class_install_property (gobject_class, PROP_X_TILES, pspec); /** @@ -539,6 +544,7 @@ clutter_deform_effect_class_init (ClutterDeformEffectClass *klass) 1, G_MAXUINT, DEFAULT_N_TILES, CLUTTER_PARAM_READWRITE); + obj_props[PROP_Y_TILES] = pspec; g_object_class_install_property (gobject_class, PROP_Y_TILES, pspec); /** @@ -556,6 +562,7 @@ clutter_deform_effect_class_init (ClutterDeformEffectClass *klass) P_("The material to be used when painting the back of the actor"), COGL_TYPE_HANDLE, CLUTTER_PARAM_READWRITE); + obj_props[PROP_BACK_MATERIAL] = pspec; g_object_class_install_property (gobject_class, PROP_BACK_MATERIAL, pspec); meta_class->set_actor = clutter_deform_effect_set_actor; @@ -661,7 +668,7 @@ clutter_deform_effect_set_n_tiles (ClutterDeformEffect *effect, { priv->x_tiles = x_tiles; - g_object_notify (G_OBJECT (effect), "x-tiles"); + _clutter_notify_by_pspec (G_OBJECT (effect), obj_props[PROP_X_TILES]); tiles_changed = TRUE; } @@ -670,7 +677,7 @@ clutter_deform_effect_set_n_tiles (ClutterDeformEffect *effect, { priv->y_tiles = y_tiles; - g_object_notify (G_OBJECT (effect), "y-tiles"); + _clutter_notify_by_pspec (G_OBJECT (effect), obj_props[PROP_Y_TILES]); tiles_changed = TRUE; } diff --git a/clutter/clutter-desaturate-effect.c b/clutter/clutter-desaturate-effect.c index b397fe5e1..f97d8d2d7 100644 --- a/clutter/clutter-desaturate-effect.c +++ b/clutter/clutter-desaturate-effect.c @@ -103,9 +103,13 @@ enum { PROP_0, - PROP_FACTOR + PROP_FACTOR, + + PROP_LAST }; +static GParamSpec *obj_props[PROP_LAST]; + G_DEFINE_TYPE (ClutterDesaturateEffect, clutter_desaturate_effect, CLUTTER_TYPE_SHADER_EFFECT); @@ -219,6 +223,7 @@ clutter_desaturate_effect_class_init (ClutterDesaturateEffectClass *klass) 0.0, 1.0, 1.0, CLUTTER_PARAM_READWRITE); + obj_props[PROP_FACTOR] = pspec; g_object_class_install_property (gobject_class, PROP_FACTOR, pspec); } @@ -273,7 +278,7 @@ clutter_desaturate_effect_set_factor (ClutterDesaturateEffect *effect, if (effect->actor != NULL) clutter_actor_queue_redraw (effect->actor); - g_object_notify (G_OBJECT (effect), "factor"); + _clutter_notify_by_pspec (G_OBJECT (effect), obj_props[PROP_FACTOR]); } } diff --git a/clutter/clutter-device-manager.c b/clutter/clutter-device-manager.c index 2afcf8433..b972fa19c 100644 --- a/clutter/clutter-device-manager.c +++ b/clutter/clutter-device-manager.c @@ -58,9 +58,13 @@ enum { PROP_0, - PROP_BACKEND + PROP_BACKEND, + + PROP_LAST }; +static GParamSpec *obj_props[PROP_LAST]; + enum { DEVICE_ADDED, @@ -130,6 +134,7 @@ clutter_device_manager_class_init (ClutterDeviceManagerClass *klass) CLUTTER_TYPE_BACKEND, CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); + obj_props[PROP_BACKEND] = pspec; g_object_class_install_property (gobject_class, PROP_BACKEND, pspec); /** diff --git a/clutter/clutter-drag-action.c b/clutter/clutter-drag-action.c index 3ae618474..71804bc38 100644 --- a/clutter/clutter-drag-action.c +++ b/clutter/clutter-drag-action.c @@ -100,9 +100,13 @@ enum PROP_DRAG_THRESHOLD, PROP_DRAG_HANDLE, - PROP_DRAG_AXIS + PROP_DRAG_AXIS, + + PROP_LAST }; +static GParamSpec *obj_props[PROP_LAST]; + enum { DRAG_BEGIN, @@ -472,6 +476,7 @@ clutter_drag_action_class_init (ClutterDragActionClass *klass) 0, G_MAXUINT, 0, CLUTTER_PARAM_READWRITE); + obj_props[PROP_DRAG_THRESHOLD] = pspec; g_object_class_install_property (gobject_class, PROP_DRAG_THRESHOLD, pspec); /** @@ -493,6 +498,7 @@ clutter_drag_action_class_init (ClutterDragActionClass *klass) P_("The actor that is being dragged"), CLUTTER_TYPE_ACTOR, CLUTTER_PARAM_READWRITE); + obj_props[PROP_DRAG_HANDLE] = pspec; g_object_class_install_property (gobject_class, PROP_DRAG_HANDLE, pspec); /** @@ -508,6 +514,7 @@ clutter_drag_action_class_init (ClutterDragActionClass *klass) CLUTTER_TYPE_DRAG_AXIS, CLUTTER_DRAG_AXIS_NONE, CLUTTER_PARAM_READWRITE); + obj_props[PROP_DRAG_AXIS] = pspec; g_object_class_install_property (gobject_class, PROP_DRAG_AXIS, pspec); /** @@ -657,7 +664,7 @@ clutter_drag_action_set_drag_threshold (ClutterDragAction *action, priv->drag_threshold = threshold; - g_object_notify (G_OBJECT (action), "drag-threshold"); + _clutter_notify_by_pspec (G_OBJECT (action), obj_props[PROP_DRAG_THRESHOLD]); } /** @@ -703,7 +710,7 @@ clutter_drag_action_set_drag_handle (ClutterDragAction *action, priv->drag_handle = handle; - g_object_notify (G_OBJECT (action), "drag-handle"); + _clutter_notify_by_pspec (G_OBJECT (action), obj_props[PROP_DRAG_HANDLE]); } /** @@ -751,7 +758,7 @@ clutter_drag_action_set_drag_axis (ClutterDragAction *action, priv->drag_axis = axis; - g_object_notify (G_OBJECT (action), "drag-axis"); + _clutter_notify_by_pspec (G_OBJECT (action), obj_props[PROP_DRAG_AXIS]); } /** diff --git a/clutter/clutter-input-device.c b/clutter/clutter-input-device.c index d81ba4e0b..7d9a2858e 100644 --- a/clutter/clutter-input-device.c +++ b/clutter/clutter-input-device.c @@ -46,9 +46,13 @@ enum PROP_ID, PROP_DEVICE_TYPE, - PROP_NAME + PROP_NAME, + + PROP_LAST }; +static GParamSpec *obj_props[PROP_LAST]; + G_DEFINE_TYPE (ClutterInputDevice, clutter_input_device, G_TYPE_OBJECT); static void @@ -130,6 +134,7 @@ clutter_input_device_class_init (ClutterInputDeviceClass *klass) 0, CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); + obj_props[PROP_ID] = pspec; g_object_class_install_property (gobject_class, PROP_ID, pspec); /** @@ -145,6 +150,7 @@ clutter_input_device_class_init (ClutterInputDeviceClass *klass) NULL, CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); + obj_props[PROP_NAME] = pspec; g_object_class_install_property (gobject_class, PROP_NAME, pspec); /** @@ -161,6 +167,7 @@ clutter_input_device_class_init (ClutterInputDeviceClass *klass) CLUTTER_POINTER_DEVICE, CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); + obj_props[PROP_DEVICE_TYPE] = pspec; g_object_class_install_property (gobject_class, PROP_DEVICE_TYPE, pspec); } diff --git a/clutter/clutter-interval.c b/clutter/clutter-interval.c index 6b6acdc9e..224e0f012 100644 --- a/clutter/clutter-interval.c +++ b/clutter/clutter-interval.c @@ -75,9 +75,13 @@ enum { PROP_0, - PROP_VALUE_TYPE + PROP_VALUE_TYPE, + + PROP_LAST }; +static GParamSpec *obj_props[PROP_LAST]; + enum { INITIAL = 0, @@ -409,6 +413,7 @@ clutter_interval_class_init (ClutterIntervalClass *klass) P_("The type of the values in the interval"), G_TYPE_NONE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); + obj_props[PROP_VALUE_TYPE] = pspec; g_object_class_install_property (gobject_class, PROP_VALUE_TYPE, pspec); } diff --git a/clutter/clutter-layout-meta.c b/clutter/clutter-layout-meta.c index f9d03df15..af106244e 100644 --- a/clutter/clutter-layout-meta.c +++ b/clutter/clutter-layout-meta.c @@ -50,9 +50,13 @@ enum { PROP_0, - PROP_MANAGER + PROP_MANAGER, + + PROP_LAST }; +static GParamSpec *obj_props[PROP_LAST]; + static void clutter_layout_meta_set_property (GObject *object, guint prop_id, @@ -115,6 +119,7 @@ clutter_layout_meta_class_init (ClutterLayoutMetaClass *klass) CLUTTER_TYPE_LAYOUT_MANAGER, G_PARAM_CONSTRUCT_ONLY | CLUTTER_PARAM_READWRITE); + obj_props[PROP_MANAGER] = pspec; g_object_class_install_property (gobject_class, PROP_MANAGER, pspec); } diff --git a/clutter/clutter-page-turn-effect.c b/clutter/clutter-page-turn-effect.c index 2246b8314..add0c67dc 100644 --- a/clutter/clutter-page-turn-effect.c +++ b/clutter/clutter-page-turn-effect.c @@ -71,9 +71,13 @@ enum PROP_PERIOD, PROP_ANGLE, - PROP_RADIUS + PROP_RADIUS, + + PROP_LAST }; +static GParamSpec *obj_props[PROP_LAST]; + G_DEFINE_TYPE (ClutterPageTurnEffect, clutter_page_turn_effect, CLUTTER_TYPE_DEFORM_EFFECT); @@ -223,6 +227,7 @@ clutter_page_turn_effect_class_init (ClutterPageTurnEffectClass *klass) 0.0, 1.0, 0.0, CLUTTER_PARAM_READWRITE); + obj_props[PROP_PERIOD] = pspec; g_object_class_install_property (gobject_class, PROP_PERIOD, pspec); /** @@ -238,6 +243,7 @@ clutter_page_turn_effect_class_init (ClutterPageTurnEffectClass *klass) 0.0, 360.0, 0.0, CLUTTER_PARAM_READWRITE); + obj_props[PROP_ANGLE] = pspec; g_object_class_install_property (gobject_class, PROP_ANGLE, pspec); /** @@ -253,6 +259,7 @@ clutter_page_turn_effect_class_init (ClutterPageTurnEffectClass *klass) -G_MAXFLOAT, G_MAXFLOAT, 24.0, CLUTTER_PARAM_READWRITE); + obj_props[PROP_RADIUS] = pspec; g_object_class_install_property (gobject_class, PROP_RADIUS, pspec); deform_class->deform_vertex = clutter_page_turn_effect_deform_vertex; @@ -314,7 +321,7 @@ clutter_page_turn_effect_set_period (ClutterPageTurnEffect *effect, clutter_deform_effect_invalidate (CLUTTER_DEFORM_EFFECT (effect)); - g_object_notify (G_OBJECT (effect), "period"); + _clutter_notify_by_pspec (G_OBJECT (effect), obj_props[PROP_PERIOD]); } /** @@ -355,7 +362,7 @@ clutter_page_turn_effect_set_angle (ClutterPageTurnEffect *effect, clutter_deform_effect_invalidate (CLUTTER_DEFORM_EFFECT (effect)); - g_object_notify (G_OBJECT (effect), "angle"); + _clutter_notify_by_pspec (G_OBJECT (effect), obj_props[PROP_ANGLE]); } /** @@ -395,7 +402,7 @@ clutter_page_turn_effect_set_radius (ClutterPageTurnEffect *effect, clutter_deform_effect_invalidate (CLUTTER_DEFORM_EFFECT (effect)); - g_object_notify (G_OBJECT (effect), "radius"); + _clutter_notify_by_pspec (G_OBJECT (effect), obj_props[PROP_RADIUS]); } /** diff --git a/clutter/clutter-path.c b/clutter/clutter-path.c index a391e26df..7f6eafc61 100644 --- a/clutter/clutter-path.c +++ b/clutter/clutter-path.c @@ -108,9 +108,13 @@ enum PROP_0, PROP_DESCRIPTION, - PROP_LENGTH + PROP_LENGTH, + + PROP_LAST }; +static GParamSpec *obj_props[PROP_LAST]; + typedef struct _ClutterPathNodeFull ClutterPathNodeFull; struct _ClutterPathNodeFull @@ -196,6 +200,7 @@ clutter_path_class_init (ClutterPathClass *klass) "SVG-style description of the path", "", CLUTTER_PARAM_READWRITE); + obj_props[PROP_DESCRIPTION] = pspec; g_object_class_install_property (gobject_class, PROP_DESCRIPTION, pspec); pspec = g_param_spec_uint ("length", @@ -204,6 +209,7 @@ clutter_path_class_init (ClutterPathClass *klass) "of the path.", 0, G_MAXUINT, 0, 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)); diff --git a/clutter/clutter-private.h b/clutter/clutter-private.h index d85eca790..fc50b0dc1 100644 --- a/clutter/clutter-private.h +++ b/clutter/clutter-private.h @@ -369,6 +369,18 @@ void _clutter_event_set_platform_data (ClutterEvent *event, gpointer data); gpointer _clutter_event_get_platform_data (const ClutterEvent *event); +#if GLIB_CHECK_VERSION (2, 25, 9) + +#define _clutter_notify_by_pspec(obj, pspec) \ + g_object_notify_by_pspec ((obj), (pspec)) + +#else + +#define _clutter_notify_by_pspec(obj, pspec) \ + g_object_notify ((obj), (pspec)->name) + +#endif + G_END_DECLS #endif /* _HAVE_CLUTTER_PRIVATE_H */ diff --git a/clutter/clutter-script.c b/clutter/clutter-script.c index 8882ed181..65ca07249 100644 --- a/clutter/clutter-script.c +++ b/clutter/clutter-script.c @@ -217,9 +217,13 @@ enum PROP_0, PROP_FILENAME_SET, - PROP_FILENAME + PROP_FILENAME, + + PROP_LAST }; +static GParamSpec *obj_props[PROP_LAST]; + #define CLUTTER_SCRIPT_GET_PRIVATE(obj) \ (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CLUTTER_TYPE_SCRIPT, ClutterScriptPrivate)) @@ -401,6 +405,7 @@ clutter_script_class_init (ClutterScriptClass *klass) P_("Whether the :filename property is set"), FALSE, CLUTTER_PARAM_READABLE); + obj_props[PROP_FILENAME_SET] = pspec; g_object_class_install_property (gobject_class, PROP_FILENAME_SET, pspec); /** @@ -416,6 +421,7 @@ clutter_script_class_init (ClutterScriptClass *klass) P_("The path of the currently parsed file"), NULL, CLUTTER_PARAM_READABLE); + obj_props[PROP_FILENAME] = pspec; g_object_class_install_property (gobject_class, PROP_FILENAME, pspec); } diff --git a/clutter/clutter-settings.c b/clutter/clutter-settings.c index 0a3bb7ea6..4ca3af146 100644 --- a/clutter/clutter-settings.c +++ b/clutter/clutter-settings.c @@ -81,9 +81,13 @@ enum PROP_FONT_DPI, PROP_FONT_HINTING, PROP_FONT_HINT_STYLE, - PROP_FONT_RGBA + PROP_FONT_RGBA, + + PROP_LAST }; +static GParamSpec *obj_props[PROP_LAST]; + G_DEFINE_TYPE (ClutterSettings, clutter_settings, G_TYPE_OBJECT); static inline void @@ -328,6 +332,7 @@ clutter_settings_class_init (ClutterSettingsClass *klass) CLUTTER_TYPE_BACKEND, CLUTTER_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY); + obj_props[PROP_BACKEND] = pspec; g_object_class_install_property (gobject_class, PROP_BACKEND, pspec); /** @@ -345,6 +350,7 @@ clutter_settings_class_init (ClutterSettingsClass *klass) 0, G_MAXINT, 250, CLUTTER_PARAM_READWRITE); + obj_props[PROP_DOUBLE_CLICK_TIME] = pspec; g_object_class_install_property (gobject_class, PROP_DOUBLE_CLICK_TIME, pspec); @@ -364,6 +370,7 @@ clutter_settings_class_init (ClutterSettingsClass *klass) 0, G_MAXINT, 5, CLUTTER_PARAM_READWRITE); + obj_props[PROP_DOUBLE_CLICK_DISTANCE] = pspec; g_object_class_install_property (gobject_class, PROP_DOUBLE_CLICK_DISTANCE, pspec); @@ -382,6 +389,7 @@ clutter_settings_class_init (ClutterSettingsClass *klass) "one that could be parsed by Pango", NULL, CLUTTER_PARAM_READWRITE); + obj_props[PROP_FONT_NAME] = pspec; g_object_class_install_property (gobject_class, PROP_FONT_NAME, pspec); @@ -402,6 +410,7 @@ clutter_settings_class_init (ClutterSettingsClass *klass) -1, 1, -1, CLUTTER_PARAM_READWRITE); + obj_props[PROP_FONT_ANTIALIAS] = pspec; g_object_class_install_property (gobject_class, PROP_FONT_ANTIALIAS, pspec); @@ -422,6 +431,7 @@ clutter_settings_class_init (ClutterSettingsClass *klass) -1, 1024 * 1024, -1, CLUTTER_PARAM_READWRITE); + obj_props[PROP_FONT_DPI] = pspec; g_object_class_install_property (gobject_class, PROP_FONT_DPI, pspec); @@ -442,6 +452,7 @@ clutter_settings_class_init (ClutterSettingsClass *klass) -1, 1, -1, CLUTTER_PARAM_READWRITE); + obj_props[PROP_FONT_HINTING] = pspec; g_object_class_install_property (gobject_class, PROP_FONT_HINTING, pspec); @@ -466,6 +477,7 @@ clutter_settings_class_init (ClutterSettingsClass *klass) "hintmedium, hintfull)", NULL, CLUTTER_PARAM_READWRITE); + obj_props[PROP_FONT_HINT_STYLE] = pspec; g_object_class_install_property (gobject_class, PROP_FONT_HINT_STYLE, pspec); @@ -491,6 +503,7 @@ clutter_settings_class_init (ClutterSettingsClass *klass) "bgr, vrgb, vbgr)", NULL, CLUTTER_PARAM_READWRITE); + obj_props[PROP_FONT_RGBA] = pspec; g_object_class_install_property (gobject_class, PROP_FONT_RGBA, pspec); diff --git a/clutter/clutter-shader-effect.c b/clutter/clutter-shader-effect.c index bb1989766..f72ddee52 100644 --- a/clutter/clutter-shader-effect.c +++ b/clutter/clutter-shader-effect.c @@ -144,9 +144,13 @@ enum { PROP_0, - PROP_SHADER_TYPE + PROP_SHADER_TYPE, + + PROP_LAST }; +static GParamSpec *obj_props[PROP_LAST]; + G_DEFINE_ABSTRACT_TYPE (ClutterShaderEffect, clutter_shader_effect, CLUTTER_TYPE_OFFSCREEN_EFFECT); @@ -435,6 +439,7 @@ clutter_shader_effect_class_init (ClutterShaderEffectClass *klass) CLUTTER_FRAGMENT_SHADER, CLUTTER_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY); + obj_props[PROP_SHADER_TYPE] = pspec; g_object_class_install_property (gobject_class, PROP_SHADER_TYPE, pspec); meta_class->set_actor = clutter_shader_effect_set_actor; diff --git a/clutter/clutter-shader.c b/clutter/clutter-shader.c index f094bea46..ce477840e 100644 --- a/clutter/clutter-shader.c +++ b/clutter/clutter-shader.c @@ -86,9 +86,13 @@ enum PROP_VERTEX_SOURCE, PROP_FRAGMENT_SOURCE, PROP_COMPILED, - PROP_ENABLED + PROP_ENABLED, + + PROP_LAST }; +static GParamSpec *obj_props[PROP_LAST]; + G_DEFINE_TYPE (ClutterShader, clutter_shader, G_TYPE_OBJECT); static void @@ -212,6 +216,7 @@ clutter_shader_class_init (ClutterShaderClass *klass) P_("Source of vertex shader"), NULL, CLUTTER_PARAM_READWRITE); + obj_props[PROP_VERTEX_SOURCE] = pspec; g_object_class_install_property (object_class, PROP_VERTEX_SOURCE, pspec); /** @@ -226,6 +231,7 @@ clutter_shader_class_init (ClutterShaderClass *klass) P_("Source of fragment shader"), NULL, CLUTTER_PARAM_READWRITE); + obj_props[PROP_FRAGMENT_SOURCE] = pspec; g_object_class_install_property (object_class, PROP_FRAGMENT_SOURCE, pspec); /** @@ -241,6 +247,7 @@ clutter_shader_class_init (ClutterShaderClass *klass) P_("Whether the shader is compiled and linked"), FALSE, CLUTTER_PARAM_READABLE); + obj_props[PROP_COMPILED] = pspec; g_object_class_install_property (object_class, PROP_COMPILED, pspec); /** @@ -255,6 +262,7 @@ clutter_shader_class_init (ClutterShaderClass *klass) P_("Whether the shader is enabled"), FALSE, CLUTTER_PARAM_READWRITE); + obj_props[PROP_ENABLED] = pspec; g_object_class_install_property (object_class, PROP_ENABLED, pspec); } @@ -325,7 +333,7 @@ clutter_shader_set_source (ClutterShader *shader, priv->fragment_source = g_strndup (data, length); priv->fragment_is_glsl = is_glsl; - g_object_notify (G_OBJECT (shader), "fragment-source"); + _clutter_notify_by_pspec (G_OBJECT (shader), obj_props[PROP_FRAGMENT_SOURCE]); break; case CLUTTER_VERTEX_SHADER: @@ -333,7 +341,7 @@ clutter_shader_set_source (ClutterShader *shader, priv->vertex_source = g_strndup (data, length); priv->vertex_is_glsl = is_glsl; - g_object_notify (G_OBJECT (shader), "vertex-source"); + _clutter_notify_by_pspec (G_OBJECT (shader), obj_props[PROP_VERTEX_SOURCE]); break; } @@ -560,7 +568,7 @@ clutter_shader_compile (ClutterShader *shader, } priv->compiled = bind_glsl_shader (shader, error); - g_object_notify (G_OBJECT (shader), "compiled"); + _clutter_notify_by_pspec (G_OBJECT (shader), obj_props[PROP_COMPILED]); return priv->compiled; } @@ -601,7 +609,7 @@ clutter_shader_release (ClutterShader *shader) priv->program = COGL_INVALID_HANDLE; priv->compiled = FALSE; - g_object_notify (G_OBJECT (shader), "compiled"); + _clutter_notify_by_pspec (G_OBJECT (shader), obj_props[PROP_COMPILED]); } /** @@ -669,7 +677,7 @@ clutter_shader_set_is_enabled (ClutterShader *shader, else cogl_program_use (COGL_INVALID_HANDLE); - g_object_notify (G_OBJECT (shader), "enabled"); + _clutter_notify_by_pspec (G_OBJECT (shader), obj_props[PROP_ENABLED]); } } diff --git a/clutter/clutter-state.c b/clutter/clutter-state.c index 5ebfa8005..def4ed967 100644 --- a/clutter/clutter-state.c +++ b/clutter/clutter-state.c @@ -118,9 +118,13 @@ enum { PROP_0, PROP_DURATION, - PROP_STATE + PROP_STATE, + + PROP_LAST }; +static GParamSpec *obj_props[PROP_LAST]; + enum { COMPLETED, @@ -477,7 +481,7 @@ clutter_state_change (ClutterState *state, priv->source_state_name = priv->target_state_name; priv->target_state_name = target_state_name; - g_object_notify (G_OBJECT (state), "state"); + _clutter_notify_by_pspec (G_OBJECT (state), obj_props[PROP_STATE]); duration = clutter_state_get_duration (state, priv->source_state_name, @@ -1160,6 +1164,7 @@ clutter_state_class_init (ClutterStateClass *klass) P_("Currently set state, (transition to this state might not be complete)"), NULL, CLUTTER_PARAM_READWRITE); + obj_props[PROP_STATE] = pspec; g_object_class_install_property (gobject_class, PROP_STATE, pspec); /** @@ -1173,6 +1178,7 @@ clutter_state_class_init (ClutterStateClass *klass) P_("Default transition duration"), 0, 86400000, 1000, CLUTTER_PARAM_READWRITE); + obj_props[PROP_DURATION] = pspec; g_object_class_install_property (gobject_class, PROP_DURATION, pspec); } diff --git a/clutter/clutter-text.c b/clutter/clutter-text.c index 9c3a1fe10..c428a4e1f 100644 --- a/clutter/clutter-text.c +++ b/clutter/clutter-text.c @@ -217,9 +217,13 @@ enum PROP_ACTIVATABLE, PROP_PASSWORD_CHAR, PROP_MAX_LENGTH, - PROP_SINGLE_LINE_MODE + PROP_SINGLE_LINE_MODE, + + PROP_LAST }; +static GParamSpec *obj_props[PROP_LAST]; + enum { TEXT_CHANGED, @@ -263,7 +267,7 @@ clutter_text_clear_selection (ClutterText *self) if (priv->selection_bound != priv->position) { priv->selection_bound = priv->position; - g_object_notify (G_OBJECT (self), "selection-bound"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_SELECTION_BOUND]); clutter_actor_queue_redraw (CLUTTER_ACTOR (self)); } } @@ -483,7 +487,7 @@ clutter_text_set_font_description_internal (ClutterText *self, if (priv->text && priv->text[0] != '\0') clutter_actor_queue_relayout (CLUTTER_ACTOR (self)); - g_object_notify (G_OBJECT (self), "font-description"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_FONT_DESCRIPTION]); } static void @@ -936,10 +940,10 @@ clutter_text_delete_selection (ClutterText *self) /* Not required to be guarded by g_object_freeze/thaw_notify */ if (priv->position != old_position) - g_object_notify (G_OBJECT (self), "position"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_POSITION]); if (priv->selection_bound != old_selection) - g_object_notify (G_OBJECT (self), "selection-bound"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_SELECTION_BOUND]); return TRUE; } @@ -1010,7 +1014,7 @@ clutter_text_set_text_internal (ClutterText *self, clutter_actor_queue_relayout (CLUTTER_ACTOR (self)); g_signal_emit (self, text_signals[TEXT_CHANGED], 0); - g_object_notify (G_OBJECT (self), "text"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_TEXT]); g_object_thaw_notify (G_OBJECT (self)); } @@ -2506,6 +2510,7 @@ clutter_text_class_init (ClutterTextClass *klass) P_("The font to be used by the text"), NULL, CLUTTER_PARAM_READWRITE); + obj_props[PROP_FONT_NAME] = pspec; g_object_class_install_property (gobject_class, PROP_FONT_NAME, pspec); /** @@ -2523,6 +2528,7 @@ clutter_text_class_init (ClutterTextClass *klass) P_("The font description to be used"), PANGO_TYPE_FONT_DESCRIPTION, CLUTTER_PARAM_READWRITE); + obj_props[PROP_FONT_DESCRIPTION] = pspec; g_object_class_install_property (gobject_class, PROP_FONT_DESCRIPTION, pspec); @@ -2539,6 +2545,7 @@ clutter_text_class_init (ClutterTextClass *klass) P_("The text to render"), "", CLUTTER_PARAM_READWRITE); + obj_props[PROP_TEXT] = pspec; g_object_class_install_property (gobject_class, PROP_TEXT, pspec); /** @@ -2553,6 +2560,7 @@ clutter_text_class_init (ClutterTextClass *klass) P_("Color of the font used by the text"), &default_text_color, CLUTTER_PARAM_READWRITE); + obj_props[PROP_COLOR] = pspec; g_object_class_install_property (gobject_class, PROP_COLOR, pspec); /** @@ -2567,6 +2575,7 @@ clutter_text_class_init (ClutterTextClass *klass) P_("Whether the text is editable"), TRUE, G_PARAM_READWRITE); + obj_props[PROP_EDITABLE] = pspec; g_object_class_install_property (gobject_class, PROP_EDITABLE, pspec); /** @@ -2582,6 +2591,7 @@ clutter_text_class_init (ClutterTextClass *klass) P_("Whether the text is selectable"), TRUE, G_PARAM_READWRITE); + obj_props[PROP_SELECTABLE] = pspec; g_object_class_install_property (gobject_class, PROP_SELECTABLE, pspec); /** @@ -2596,6 +2606,7 @@ clutter_text_class_init (ClutterTextClass *klass) P_("Whether pressing return causes the activate signal to be emitted"), TRUE, G_PARAM_READWRITE); + obj_props[PROP_ACTIVATABLE] = pspec; g_object_class_install_property (gobject_class, PROP_ACTIVATABLE, pspec); /** @@ -2612,6 +2623,7 @@ clutter_text_class_init (ClutterTextClass *klass) P_("Whether the input cursor is visible"), TRUE, CLUTTER_PARAM_READWRITE); + obj_props[PROP_CURSOR_VISIBLE] = pspec; g_object_class_install_property (gobject_class, PROP_CURSOR_VISIBLE, pspec); /** @@ -2626,6 +2638,7 @@ clutter_text_class_init (ClutterTextClass *klass) P_("Cursor Color"), &default_cursor_color, CLUTTER_PARAM_READWRITE); + obj_props[PROP_CURSOR_COLOR] = pspec; g_object_class_install_property (gobject_class, PROP_CURSOR_COLOR, pspec); /** @@ -2640,6 +2653,7 @@ clutter_text_class_init (ClutterTextClass *klass) P_("Whether the cursor color has been set"), FALSE, CLUTTER_PARAM_READABLE); + obj_props[PROP_CURSOR_COLOR_SET] = pspec; g_object_class_install_property (gobject_class, PROP_CURSOR_COLOR_SET, pspec); /** @@ -2655,6 +2669,7 @@ clutter_text_class_init (ClutterTextClass *klass) P_("The width of the cursor, in pixels"), -1, G_MAXINT, DEFAULT_CURSOR_SIZE, CLUTTER_PARAM_READWRITE); + obj_props[PROP_CURSOR_SIZE] = pspec; g_object_class_install_property (gobject_class, PROP_CURSOR_SIZE, pspec); /** @@ -2670,6 +2685,7 @@ clutter_text_class_init (ClutterTextClass *klass) -1, G_MAXINT, -1, CLUTTER_PARAM_READWRITE); + obj_props[PROP_POSITION] = pspec; g_object_class_install_property (gobject_class, PROP_POSITION, pspec); /** @@ -2685,6 +2701,7 @@ clutter_text_class_init (ClutterTextClass *klass) -1, G_MAXINT, -1, CLUTTER_PARAM_READWRITE); + obj_props[PROP_SELECTION_BOUND] = pspec; g_object_class_install_property (gobject_class, PROP_SELECTION_BOUND, pspec); /** @@ -2699,6 +2716,7 @@ clutter_text_class_init (ClutterTextClass *klass) P_("Selection Color"), &default_selection_color, CLUTTER_PARAM_READWRITE); + obj_props[PROP_SELECTION_COLOR] = pspec; g_object_class_install_property (gobject_class, PROP_SELECTION_COLOR, pspec); /** @@ -2713,6 +2731,7 @@ clutter_text_class_init (ClutterTextClass *klass) P_("Whether the selection color has been set"), FALSE, CLUTTER_PARAM_READABLE); + obj_props[PROP_SELECTION_COLOR_SET] = pspec; g_object_class_install_property (gobject_class, PROP_SELECTION_COLOR_SET, pspec); /** @@ -2728,6 +2747,7 @@ clutter_text_class_init (ClutterTextClass *klass) P_("A list of style attributes to apply to the contents of the actor"), PANGO_TYPE_ATTR_LIST, CLUTTER_PARAM_READWRITE); + obj_props[PROP_ATTRIBUTES] = pspec; g_object_class_install_property (gobject_class, PROP_ATTRIBUTES, pspec); /** @@ -2750,6 +2770,7 @@ clutter_text_class_init (ClutterTextClass *klass) P_("Whether or not the text includes Pango markup"), FALSE, CLUTTER_PARAM_READWRITE); + obj_props[PROP_USE_MARKUP] = pspec; g_object_class_install_property (gobject_class, PROP_USE_MARKUP, pspec); /** @@ -2766,6 +2787,7 @@ clutter_text_class_init (ClutterTextClass *klass) P_("If set, wrap the lines if the text becomes too wide"), FALSE, CLUTTER_PARAM_READWRITE); + obj_props[PROP_LINE_WRAP] = pspec; g_object_class_install_property (gobject_class, PROP_LINE_WRAP, pspec); /** @@ -2782,6 +2804,7 @@ clutter_text_class_init (ClutterTextClass *klass) PANGO_TYPE_WRAP_MODE, PANGO_WRAP_WORD, CLUTTER_PARAM_READWRITE); + obj_props[PROP_LINE_WRAP_MODE] = pspec; g_object_class_install_property (gobject_class, PROP_LINE_WRAP_MODE, pspec); /** @@ -2797,6 +2820,7 @@ clutter_text_class_init (ClutterTextClass *klass) PANGO_TYPE_ELLIPSIZE_MODE, PANGO_ELLIPSIZE_NONE, CLUTTER_PARAM_READWRITE); + obj_props[PROP_ELLIPSIZE] = pspec; g_object_class_install_property (gobject_class, PROP_ELLIPSIZE, pspec); /** @@ -2813,6 +2837,7 @@ clutter_text_class_init (ClutterTextClass *klass) PANGO_TYPE_ALIGNMENT, PANGO_ALIGN_LEFT, CLUTTER_PARAM_READWRITE); + obj_props[PROP_LINE_ALIGNMENT] = pspec; g_object_class_install_property (gobject_class, PROP_LINE_ALIGNMENT, pspec); /** @@ -2828,6 +2853,7 @@ clutter_text_class_init (ClutterTextClass *klass) P_("Whether the text should be justified"), FALSE, CLUTTER_PARAM_READWRITE); + obj_props[PROP_JUSTIFY] = pspec; g_object_class_install_property (gobject_class, PROP_JUSTIFY, pspec); /** @@ -2843,6 +2869,7 @@ clutter_text_class_init (ClutterTextClass *klass) P_("If non-zero, use this character to display the actor's contents"), 0, CLUTTER_PARAM_READWRITE); + obj_props[PROP_PASSWORD_CHAR] = pspec; g_object_class_install_property (gobject_class, PROP_PASSWORD_CHAR, pspec); /** @@ -2857,6 +2884,7 @@ clutter_text_class_init (ClutterTextClass *klass) P_("Maximum length of the text inside the actor"), -1, G_MAXINT, 0, CLUTTER_PARAM_READWRITE); + obj_props[PROP_MAX_LENGTH] = pspec; g_object_class_install_property (gobject_class, PROP_MAX_LENGTH, pspec); /** @@ -2880,6 +2908,7 @@ clutter_text_class_init (ClutterTextClass *klass) P_("Whether the text should be a single line"), FALSE, CLUTTER_PARAM_READWRITE); + obj_props[PROP_SINGLE_LINE_MODE] = pspec; g_object_class_install_property (gobject_class, PROP_SINGLE_LINE_MODE, pspec); /** @@ -3247,7 +3276,7 @@ clutter_text_set_editable (ClutterText *self, clutter_actor_queue_redraw (CLUTTER_ACTOR (self)); - g_object_notify (G_OBJECT (self), "editable"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_EDITABLE]); } } @@ -3297,7 +3326,7 @@ clutter_text_set_selectable (ClutterText *self, clutter_actor_queue_redraw (CLUTTER_ACTOR (self)); - g_object_notify (G_OBJECT (self), "selectable"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_SELECTABLE]); } } @@ -3351,7 +3380,7 @@ clutter_text_set_activatable (ClutterText *self, clutter_actor_queue_redraw (CLUTTER_ACTOR (self)); - g_object_notify (G_OBJECT (self), "activatable"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_ACTIVATABLE]); } } @@ -3442,7 +3471,7 @@ clutter_text_set_cursor_visible (ClutterText *self, clutter_actor_queue_redraw (CLUTTER_ACTOR (self)); - g_object_notify (G_OBJECT (self), "cursor-visible"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_CURSOR_VISIBLE]); } } @@ -3496,8 +3525,8 @@ clutter_text_set_cursor_color (ClutterText *self, clutter_actor_queue_redraw (CLUTTER_ACTOR (self)); - g_object_notify (G_OBJECT (self), "cursor-color"); - g_object_notify (G_OBJECT (self), "cursor-color-set"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_CURSOR_COLOR]); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_CURSOR_COLOR_SET]); } /** @@ -3638,7 +3667,7 @@ clutter_text_set_selection_bound (ClutterText *self, clutter_actor_queue_redraw (CLUTTER_ACTOR (self)); - g_object_notify (G_OBJECT (self), "selection-bound"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_SELECTION_BOUND]); } } @@ -3694,8 +3723,8 @@ clutter_text_set_selection_color (ClutterText *self, clutter_actor_queue_redraw (CLUTTER_ACTOR (self)); - g_object_notify (G_OBJECT (self), "selection-color"); - g_object_notify (G_OBJECT (self), "selection-color-set"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_SELECTION_COLOR]); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_SELECTION_COLOR_SET]); } /** @@ -3841,7 +3870,7 @@ clutter_text_set_font_name (ClutterText *self, clutter_text_set_font_description_internal (self, desc); priv->is_default_font = is_default_font; - g_object_notify (G_OBJECT (self), "font-name"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_FONT_NAME]); } /** @@ -3899,7 +3928,7 @@ clutter_text_set_use_markup_internal (ClutterText *self, priv->markup_attrs = NULL; } - g_object_notify (G_OBJECT (self), "use-markup"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_USE_MARKUP]); } } @@ -4023,7 +4052,7 @@ clutter_text_set_color (ClutterText *self, clutter_actor_queue_redraw (CLUTTER_ACTOR (self)); - g_object_notify (G_OBJECT (self), "color"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_COLOR]); } /** @@ -4080,7 +4109,7 @@ clutter_text_set_ellipsize (ClutterText *self, clutter_actor_queue_relayout (CLUTTER_ACTOR (self)); - g_object_notify (G_OBJECT (self), "ellipsize"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_ELLIPSIZE]); } } @@ -4150,7 +4179,7 @@ clutter_text_set_line_wrap (ClutterText *self, clutter_actor_queue_relayout (CLUTTER_ACTOR (self)); - g_object_notify (G_OBJECT (self), "line-wrap"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_LINE_WRAP]); } } @@ -4183,7 +4212,7 @@ clutter_text_set_line_wrap_mode (ClutterText *self, clutter_actor_queue_relayout (CLUTTER_ACTOR (self)); - g_object_notify (G_OBJECT (self), "line-wrap-mode"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_LINE_WRAP_MODE]); } } @@ -4248,7 +4277,7 @@ clutter_text_set_attributes (ClutterText *self, clutter_text_dirty_cache (self); - g_object_notify (G_OBJECT (self), "attributes"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_ATTRIBUTES]); clutter_actor_queue_relayout (CLUTTER_ACTOR (self)); } @@ -4305,7 +4334,7 @@ clutter_text_set_line_alignment (ClutterText *self, clutter_actor_queue_relayout (CLUTTER_ACTOR (self)); - g_object_notify (G_OBJECT (self), "line-alignment"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_LINE_ALIGNMENT]); } } @@ -4418,7 +4447,7 @@ clutter_text_set_justify (ClutterText *self, clutter_actor_queue_relayout (CLUTTER_ACTOR (self)); - g_object_notify (G_OBJECT (self), "justify"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_JUSTIFY]); } } @@ -4497,7 +4526,7 @@ clutter_text_set_cursor_position (ClutterText *self, clutter_actor_queue_redraw (CLUTTER_ACTOR (self)); - g_object_notify (G_OBJECT (self), "position"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_POSITION]); } /** @@ -4531,7 +4560,7 @@ clutter_text_set_cursor_size (ClutterText *self, clutter_actor_queue_redraw (CLUTTER_ACTOR (self)); - g_object_notify (G_OBJECT (self), "cursor-size"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_CURSOR_SIZE]); } } @@ -4583,7 +4612,7 @@ clutter_text_set_password_char (ClutterText *self, clutter_text_dirty_cache (self); clutter_actor_queue_relayout (CLUTTER_ACTOR (self)); - g_object_notify (G_OBJECT (self), "password-char"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_PASSWORD_CHAR]); } } @@ -4641,7 +4670,7 @@ clutter_text_set_max_length (ClutterText *self, clutter_text_set_text (self, new); g_free (new); - g_object_notify (G_OBJECT (self), "max-length"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_MAX_LENGTH]); } } @@ -4866,7 +4895,7 @@ clutter_text_delete_chars (ClutterText *self, g_string_free (new, TRUE); - g_object_notify (G_OBJECT (self), "text"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_TEXT]); } /** @@ -4953,13 +4982,13 @@ clutter_text_set_single_line_mode (ClutterText *self, { priv->activatable = TRUE; - g_object_notify (G_OBJECT (self), "activatable"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_ACTIVATABLE]); } clutter_text_dirty_cache (self); clutter_actor_queue_relayout (CLUTTER_ACTOR (self)); - g_object_notify (G_OBJECT (self), "single-line-mode"); + _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_SINGLE_LINE_MODE]); g_object_thaw_notify (G_OBJECT (self)); } diff --git a/clutter/clutter-texture.c b/clutter/clutter-texture.c index d7436da48..3f0be08e8 100644 --- a/clutter/clutter-texture.c +++ b/clutter/clutter-texture.c @@ -144,9 +144,13 @@ enum PROP_KEEP_ASPECT_RATIO, PROP_LOAD_ASYNC, PROP_LOAD_DATA_ASYNC, - PROP_PICK_WITH_ALPHA + PROP_PICK_WITH_ALPHA, + + PROP_LAST }; +static GParamSpec *obj_props[PROP_LAST]; + enum { SIZE_CHANGE, @@ -942,6 +946,7 @@ clutter_texture_class_init (ClutterTextureClass *klass) P_("Auto sync size of actor to underlying pixbuf dimensions"), TRUE, CLUTTER_PARAM_READWRITE); + obj_props[PROP_SYNC_SIZE] = pspec; g_object_class_install_property (gobject_class, PROP_SYNC_SIZE, pspec); pspec = g_param_spec_boolean ("disable-slicing", @@ -950,6 +955,7 @@ clutter_texture_class_init (ClutterTextureClass *klass) FALSE, G_PARAM_CONSTRUCT_ONLY | CLUTTER_PARAM_READWRITE); + obj_props[PROP_NO_SLICE] = pspec; g_object_class_install_property (gobject_class, PROP_NO_SLICE, pspec); pspec = g_param_spec_int ("tile-waste", @@ -958,6 +964,7 @@ clutter_texture_class_init (ClutterTextureClass *klass) -1, G_MAXINT, COGL_TEXTURE_MAX_WASTE, CLUTTER_PARAM_READABLE); + obj_props[PROP_MAX_TILE_WASTE] = pspec; g_object_class_install_property (gobject_class, PROP_MAX_TILE_WASTE, pspec); pspec = g_param_spec_boolean ("repeat-x", @@ -965,6 +972,7 @@ clutter_texture_class_init (ClutterTextureClass *klass) P_("Repeat the contents rather than scaling them horizontally."), FALSE, CLUTTER_PARAM_READWRITE); + obj_props[PROP_REPEAT_X] = pspec; g_object_class_install_property (gobject_class, PROP_REPEAT_X, pspec); pspec = g_param_spec_boolean ("repeat-y", @@ -972,6 +980,7 @@ clutter_texture_class_init (ClutterTextureClass *klass) P_("Repeat the contents rather than scaling them vertically."), FALSE, CLUTTER_PARAM_READWRITE); + obj_props[PROP_REPEAT_Y] = pspec; g_object_class_install_property (gobject_class, PROP_REPEAT_Y, pspec); pspec = g_param_spec_enum ("filter-quality", @@ -980,6 +989,7 @@ clutter_texture_class_init (ClutterTextureClass *klass) CLUTTER_TYPE_TEXTURE_QUALITY, CLUTTER_TEXTURE_QUALITY_MEDIUM, G_PARAM_CONSTRUCT | CLUTTER_PARAM_READWRITE); + obj_props[PROP_FILTER_QUALITY] = pspec; g_object_class_install_property (gobject_class, PROP_FILTER_QUALITY, pspec); pspec = g_param_spec_enum ("pixel-format", @@ -988,6 +998,7 @@ clutter_texture_class_init (ClutterTextureClass *klass) COGL_TYPE_PIXEL_FORMAT, COGL_PIXEL_FORMAT_RGBA_8888, CLUTTER_PARAM_READABLE); + obj_props[PROP_PIXEL_FORMAT] = pspec; g_object_class_install_property (gobject_class, PROP_PIXEL_FORMAT, pspec); pspec = g_param_spec_boxed ("cogl-texture", @@ -995,6 +1006,7 @@ clutter_texture_class_init (ClutterTextureClass *klass) P_("The underlying COGL texture handle used to draw this actor"), COGL_TYPE_HANDLE, CLUTTER_PARAM_READWRITE); + obj_props[PROP_COGL_TEXTURE] = pspec; g_object_class_install_property (gobject_class, PROP_COGL_TEXTURE, pspec); pspec = g_param_spec_boxed ("cogl-material", @@ -1002,6 +1014,7 @@ clutter_texture_class_init (ClutterTextureClass *klass) P_("The underlying COGL material handle used to draw this actor"), COGL_TYPE_HANDLE, CLUTTER_PARAM_READWRITE); + obj_props[PROP_COGL_MATERIAL] = pspec; g_object_class_install_property (gobject_class, PROP_COGL_MATERIAL, pspec); /** @@ -1018,6 +1031,7 @@ clutter_texture_class_init (ClutterTextureClass *klass) P_("The path of the file containing the image data"), NULL, CLUTTER_PARAM_READWRITE); + obj_props[PROP_FILENAME] = pspec; g_object_class_install_property (gobject_class, PROP_FILENAME, pspec); pspec = g_param_spec_boolean ("keep-aspect-ratio", @@ -1025,6 +1039,7 @@ clutter_texture_class_init (ClutterTextureClass *klass) P_("Keep the aspect ratio of the texture when requesting the preferred width or height"), FALSE, CLUTTER_PARAM_READWRITE); + obj_props[PROP_KEEP_ASPECT_RATIO] = pspec; g_object_class_install_property (gobject_class, PROP_KEEP_ASPECT_RATIO, pspec); /** @@ -1051,6 +1066,7 @@ clutter_texture_class_init (ClutterTextureClass *klass) P_("Load files inside a thread to avoid blocking when loading images from disk."), FALSE, CLUTTER_PARAM_WRITABLE); + obj_props[PROP_LOAD_ASYNC] = pspec; g_object_class_install_property (gobject_class, PROP_LOAD_ASYNC, pspec); @@ -1067,6 +1083,7 @@ clutter_texture_class_init (ClutterTextureClass *klass) P_("Decode image data files inside a thread to reduce blocking when loading images from disk."), FALSE, CLUTTER_PARAM_WRITABLE); + obj_props[PROP_LOAD_DATA_ASYNC] = pspec; g_object_class_install_property (gobject_class, PROP_LOAD_DATA_ASYNC, pspec); /** @@ -1091,6 +1108,7 @@ clutter_texture_class_init (ClutterTextureClass *klass) P_("Shape actor with alpha channel when picking"), FALSE, CLUTTER_PARAM_READWRITE); + obj_props[PROP_PICK_WITH_ALPHA] = pspec; g_object_class_install_property (gobject_class, PROP_PICK_WITH_ALPHA, pspec); /** @@ -1416,7 +1434,7 @@ clutter_texture_set_cogl_texture (ClutterTexture *texture, /* If resized actor may need resizing but paint() will do this */ clutter_actor_queue_redraw (CLUTTER_ACTOR (texture)); - g_object_notify (G_OBJECT (texture), "cogl-texture"); + _clutter_notify_by_pspec (G_OBJECT (texture), obj_props[PROP_COGL_TEXTURE]); } static gboolean @@ -1965,7 +1983,7 @@ clutter_texture_set_from_file (ClutterTexture *texture, g_signal_emit (texture, texture_signals[LOAD_FINISHED], 0, NULL); - g_object_notify (G_OBJECT (texture), "filename"); + _clutter_notify_by_pspec (G_OBJECT (texture), obj_props[PROP_FILENAME]); return TRUE; } @@ -2013,7 +2031,7 @@ clutter_texture_set_filter_quality (ClutterTexture *texture, clutter_actor_queue_redraw (CLUTTER_ACTOR (texture)); - g_object_notify (G_OBJECT (texture), "filter-quality"); + _clutter_notify_by_pspec (G_OBJECT (texture), obj_props[PROP_FILTER_QUALITY]); } } @@ -2558,7 +2576,7 @@ clutter_texture_set_sync_size (ClutterTexture *texture, clutter_actor_queue_relayout (CLUTTER_ACTOR (texture)); - g_object_notify (G_OBJECT (texture), "sync-size"); + _clutter_notify_by_pspec (G_OBJECT (texture), obj_props[PROP_SYNC_SIZE]); } } @@ -2610,7 +2628,7 @@ clutter_texture_set_repeat (ClutterTexture *texture, { priv->repeat_x = repeat_x; - g_object_notify (G_OBJECT (texture), "repeat-x"); + _clutter_notify_by_pspec (G_OBJECT (texture), obj_props[PROP_REPEAT_X]); changed = TRUE; } @@ -2619,7 +2637,7 @@ clutter_texture_set_repeat (ClutterTexture *texture, { priv->repeat_y = repeat_y; - g_object_notify (G_OBJECT (texture), "repeat-y"); + _clutter_notify_by_pspec (G_OBJECT (texture), obj_props[PROP_REPEAT_Y]); changed = TRUE; } @@ -2713,7 +2731,7 @@ clutter_texture_set_keep_aspect_ratio (ClutterTexture *texture, clutter_actor_queue_relayout (CLUTTER_ACTOR (texture)); - g_object_notify (G_OBJECT (texture), "keep-aspect-ratio"); + _clutter_notify_by_pspec (G_OBJECT (texture), obj_props[PROP_KEEP_ASPECT_RATIO]); } } @@ -2768,8 +2786,8 @@ clutter_texture_set_load_async (ClutterTexture *texture, priv->load_async_set = load_async; - g_object_notify (G_OBJECT (texture), "load-async"); - g_object_notify (G_OBJECT (texture), "load-data-async"); + _clutter_notify_by_pspec (G_OBJECT (texture), obj_props[PROP_LOAD_ASYNC]); + _clutter_notify_by_pspec (G_OBJECT (texture), obj_props[PROP_LOAD_DATA_ASYNC]); } } @@ -2826,8 +2844,8 @@ clutter_texture_set_load_data_async (ClutterTexture *texture, priv->load_async_set = load_async; - g_object_notify (G_OBJECT (texture), "load-async"); - g_object_notify (G_OBJECT (texture), "load-data-async"); + _clutter_notify_by_pspec (G_OBJECT (texture), obj_props[PROP_LOAD_ASYNC]); + _clutter_notify_by_pspec (G_OBJECT (texture), obj_props[PROP_LOAD_DATA_ASYNC]); } } diff --git a/clutter/clutter-timeline.c b/clutter/clutter-timeline.c index beeb3e402..5f1789943 100644 --- a/clutter/clutter-timeline.c +++ b/clutter/clutter-timeline.c @@ -85,9 +85,13 @@ enum PROP_LOOP, PROP_DELAY, PROP_DURATION, - PROP_DIRECTION + PROP_DIRECTION, + + PROP_LAST }; +static GParamSpec *obj_props[PROP_LAST]; + enum { NEW_FRAME, @@ -259,6 +263,7 @@ clutter_timeline_class_init (ClutterTimelineClass *klass) "Should the timeline automatically restart", FALSE, CLUTTER_PARAM_READWRITE); + obj_props[PROP_LOOP] = pspec; g_object_class_install_property (object_class, PROP_LOOP, pspec); /** @@ -275,6 +280,7 @@ clutter_timeline_class_init (ClutterTimelineClass *klass) 0, G_MAXUINT, 0, CLUTTER_PARAM_READWRITE); + obj_props[PROP_DELAY] = pspec; g_object_class_install_property (object_class, PROP_DELAY, pspec); /** @@ -291,6 +297,7 @@ clutter_timeline_class_init (ClutterTimelineClass *klass) 0, G_MAXUINT, 1000, CLUTTER_PARAM_READWRITE); + obj_props[PROP_DURATION] = pspec; g_object_class_install_property (object_class, PROP_DURATION, pspec); /** @@ -307,6 +314,7 @@ clutter_timeline_class_init (ClutterTimelineClass *klass) CLUTTER_TYPE_TIMELINE_DIRECTION, CLUTTER_TIMELINE_FORWARD, CLUTTER_PARAM_READWRITE); + obj_props[PROP_DIRECTION] = pspec; g_object_class_install_property (object_class, PROP_DIRECTION, pspec); /** @@ -812,7 +820,7 @@ clutter_timeline_set_loop (ClutterTimeline *timeline, { timeline->priv->loop = loop; - g_object_notify (G_OBJECT (timeline), "loop"); + _clutter_notify_by_pspec (G_OBJECT (timeline), obj_props[PROP_LOOP]); } } @@ -1037,7 +1045,7 @@ clutter_timeline_set_delay (ClutterTimeline *timeline, if (priv->delay != msecs) { priv->delay = msecs; - g_object_notify (G_OBJECT (timeline), "delay"); + _clutter_notify_by_pspec (G_OBJECT (timeline), obj_props[PROP_DELAY]); } } @@ -1089,7 +1097,7 @@ clutter_timeline_set_duration (ClutterTimeline *timeline, { priv->duration = msecs; - g_object_notify (G_OBJECT (timeline), "duration"); + _clutter_notify_by_pspec (G_OBJECT (timeline), obj_props[PROP_DURATION]); } } @@ -1162,7 +1170,7 @@ clutter_timeline_set_direction (ClutterTimeline *timeline, if (priv->elapsed_time == 0) priv->elapsed_time = priv->duration; - g_object_notify (G_OBJECT (timeline), "direction"); + _clutter_notify_by_pspec (G_OBJECT (timeline), obj_props[PROP_DIRECTION]); } } diff --git a/clutter/x11/clutter-device-manager-x11.c b/clutter/x11/clutter-device-manager-x11.c index 7928efd3e..f0a484d96 100644 --- a/clutter/x11/clutter-device-manager-x11.c +++ b/clutter/x11/clutter-device-manager-x11.c @@ -43,9 +43,13 @@ enum { PROP_0, - PROP_USE_XINPUT_1 + PROP_USE_XINPUT_1, + + PROP_LAST }; +static GParamSpec *obj_props[PROP_LAST]; + G_DEFINE_TYPE (ClutterDeviceManagerX11, clutter_device_manager_x11, CLUTTER_TYPE_DEVICE_MANAGER); @@ -339,6 +343,7 @@ clutter_device_manager_x11_class_init (ClutterDeviceManagerX11Class *klass) FALSE, CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); + obj_props[PROP_USE_XINPUT_1] = pspec; g_object_class_install_property (gobject_class, PROP_USE_XINPUT_1, pspec); } diff --git a/clutter/x11/clutter-input-device-x11.c b/clutter/x11/clutter-input-device-x11.c index b62ca8a0c..b61959490 100644 --- a/clutter/x11/clutter-input-device-x11.c +++ b/clutter/x11/clutter-input-device-x11.c @@ -30,9 +30,13 @@ enum { PROP_0, - PROP_IS_CORE + PROP_IS_CORE, + + PROP_LAST }; +static GParamSpec *obj_props[PROP_LAST]; + G_DEFINE_TYPE (ClutterInputDeviceX11, clutter_input_device_x11, CLUTTER_TYPE_INPUT_DEVICE); @@ -92,6 +96,7 @@ clutter_input_device_x11_class_init (ClutterInputDeviceX11Class *klass) FALSE, CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); + obj_props[PROP_IS_CORE] = pspec; g_object_class_install_property (gobject_class, PROP_IS_CORE, pspec); } diff --git a/clutter/x11/clutter-keymap-x11.c b/clutter/x11/clutter-keymap-x11.c index abd2cb53e..33b690ea9 100644 --- a/clutter/x11/clutter-keymap-x11.c +++ b/clutter/x11/clutter-keymap-x11.c @@ -73,9 +73,13 @@ enum { PROP_0, - PROP_BACKEND + PROP_BACKEND, + + PROP_LAST }; +static GParamSpec *obj_props[PROP_LAST]; + G_DEFINE_TYPE (ClutterKeymapX11, clutter_keymap_x11, G_TYPE_OBJECT); #ifdef HAVE_XKB @@ -325,6 +329,7 @@ clutter_keymap_x11_class_init (ClutterKeymapX11Class *klass) CLUTTER_TYPE_BACKEND, CLUTTER_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY); + obj_props[PROP_BACKEND] = pspec; g_object_class_install_property (gobject_class, PROP_BACKEND, pspec); }