From 050e775da27209c5720d5ba8bffde786add562cd Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Fri, 15 Oct 2010 15:24:27 +0100 Subject: [PATCH] Move more classes to install_properties() --- clutter/clutter-actor-meta.c | 51 +++++---- clutter/clutter-align-constraint.c | 56 +++++----- clutter/clutter-alpha.c | 20 ++-- clutter/clutter-animation.c | 86 +++++++-------- clutter/clutter-animator.c | 33 +++--- clutter/clutter-behaviour.c | 18 +-- clutter/clutter-bin-layout.c | 102 ++++++++--------- clutter/clutter-bind-constraint.c | 51 ++++----- clutter/clutter-binding-pool.c | 20 ++-- clutter/clutter-cairo-texture.c | 39 +++---- clutter/clutter-child-meta.c | 35 +++--- clutter/clutter-click-action.c | 31 +++--- clutter/clutter-clone.c | 20 ++-- clutter/clutter-colorize-effect.c | 18 +-- clutter/clutter-deform-effect.c | 55 +++++----- clutter/clutter-desaturate-effect.c | 28 ++--- clutter/clutter-device-manager.c | 20 ++-- clutter/clutter-flow-layout.c | 165 ++++++++++++++-------------- clutter/clutter-script.c | 36 +++--- clutter/clutter-shader-effect.c | 25 +++-- clutter/clutter-timeline.c | 72 ++++++------ 21 files changed, 491 insertions(+), 490 deletions(-) diff --git a/clutter/clutter-actor-meta.c b/clutter/clutter-actor-meta.c index c28e0ef26..1dbc535d3 100644 --- a/clutter/clutter-actor-meta.c +++ b/clutter/clutter-actor-meta.c @@ -147,16 +147,11 @@ void clutter_actor_meta_class_init (ClutterActorMetaClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - GParamSpec *pspec; g_type_class_add_private (klass, sizeof (ClutterActorMetaPrivate)); klass->set_actor = clutter_actor_meta_real_set_actor; - gobject_class->set_property = clutter_actor_meta_set_property; - gobject_class->get_property = clutter_actor_meta_get_property; - gobject_class->finalize = clutter_actor_meta_finalize; - /** * ClutterActorMeta:actor: * @@ -164,13 +159,12 @@ clutter_actor_meta_class_init (ClutterActorMetaClass *klass) * * Since: 1.4 */ - pspec = g_param_spec_object ("actor", - P_("Actor"), - 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); + obj_props[PROP_ACTOR] = + g_param_spec_object ("actor", + P_("Actor"), + P_("The actor attached to the meta"), + CLUTTER_TYPE_ACTOR, + CLUTTER_PARAM_READABLE); /** * ClutterActorMeta:name: @@ -179,13 +173,12 @@ clutter_actor_meta_class_init (ClutterActorMetaClass *klass) * * Since: 1.4 */ - pspec = g_param_spec_string ("name", - P_("Name"), - 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); + obj_props[PROP_NAME] = + g_param_spec_string ("name", + P_("Name"), + P_("The name of the meta"), + NULL, + CLUTTER_PARAM_READWRITE); /** * ClutterActorMeta:enabled: @@ -194,13 +187,19 @@ clutter_actor_meta_class_init (ClutterActorMetaClass *klass) * * Since: 1.4 */ - pspec = g_param_spec_boolean ("enabled", - P_("Enabled"), - 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); + obj_props[PROP_ENABLED] = + g_param_spec_boolean ("enabled", + P_("Enabled"), + P_("Whether the meta is enabled"), + TRUE, + CLUTTER_PARAM_READWRITE); + + gobject_class->finalize = clutter_actor_meta_finalize; + gobject_class->set_property = clutter_actor_meta_set_property; + gobject_class->get_property = clutter_actor_meta_get_property; + _clutter_object_class_install_properties (gobject_class, + PROP_LAST, + obj_props); } void diff --git a/clutter/clutter-align-constraint.c b/clutter/clutter-align-constraint.c index 753ad7f8c..25bcfc842 100644 --- a/clutter/clutter-align-constraint.c +++ b/clutter/clutter-align-constraint.c @@ -214,10 +214,6 @@ clutter_align_constraint_class_init (ClutterAlignConstraintClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); ClutterActorMetaClass *meta_class = CLUTTER_ACTOR_META_CLASS (klass); ClutterConstraintClass *constraint_class = CLUTTER_CONSTRAINT_CLASS (klass); - GParamSpec *pspec; - - gobject_class->set_property = clutter_align_constraint_set_property; - gobject_class->get_property = clutter_align_constraint_get_property; meta_class->set_actor = clutter_align_constraint_set_actor; @@ -230,14 +226,12 @@ clutter_align_constraint_class_init (ClutterAlignConstraintClass *klass) * * Since: 1.4 */ - pspec = g_param_spec_object ("source", - P_("Source"), - P_("The source of the alignment"), - CLUTTER_TYPE_ACTOR, - CLUTTER_PARAM_READWRITE | - G_PARAM_CONSTRUCT); - obj_props[PROP_SOURCE] = pspec; - g_object_class_install_property (gobject_class, PROP_SOURCE, pspec); + obj_props[PROP_SOURCE] = + g_param_spec_object ("source", + P_("Source"), + P_("The source of the alignment"), + CLUTTER_TYPE_ACTOR, + CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT); /** * ClutterAlignConstraint:align-axis: @@ -246,15 +240,13 @@ clutter_align_constraint_class_init (ClutterAlignConstraintClass *klass) * * Since: 1.4 */ - pspec = g_param_spec_enum ("align-axis", - P_("Align Axis"), - P_("The axis to align the position to"), - CLUTTER_TYPE_ALIGN_AXIS, - 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); + obj_props[PROP_ALIGN_AXIS] = + g_param_spec_enum ("align-axis", + P_("Align Axis"), + P_("The axis to align the position to"), + CLUTTER_TYPE_ALIGN_AXIS, + CLUTTER_ALIGN_X_AXIS, + CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT); /** * ClutterAlignConstraint:factor: @@ -268,15 +260,19 @@ clutter_align_constraint_class_init (ClutterAlignConstraintClass *klass) * * Since: 1.4 */ - pspec = g_param_spec_float ("factor", - P_("Factor"), - P_("The alignment factor, between 0.0 and 1.0"), - 0.0, 1.0, - 0.0, - CLUTTER_PARAM_READWRITE | - G_PARAM_CONSTRUCT); - obj_props[PROP_FACTOR] = pspec; - g_object_class_install_property (gobject_class, PROP_FACTOR, pspec); + obj_props[PROP_FACTOR] = + g_param_spec_float ("factor", + P_("Factor"), + P_("The alignment factor, between 0.0 and 1.0"), + 0.0, 1.0, + 0.0, + CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT); + + gobject_class->set_property = clutter_align_constraint_set_property; + gobject_class->get_property = clutter_align_constraint_get_property; + _clutter_object_class_install_properties (gobject_class, + PROP_LAST, + obj_props); } static void diff --git a/clutter/clutter-alpha.c b/clutter/clutter-alpha.c index 969f0ac48..e65bf0954 100644 --- a/clutter/clutter-alpha.c +++ b/clutter/clutter-alpha.c @@ -319,7 +319,6 @@ static void clutter_alpha_class_init (ClutterAlphaClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - GParamSpec *pspec; object_class->set_property = clutter_alpha_set_property; object_class->get_property = clutter_alpha_get_property; @@ -335,13 +334,12 @@ clutter_alpha_class_init (ClutterAlphaClass *klass) * * Since: 0.2 */ - pspec = g_param_spec_object ("timeline", + obj_props[PROP_TIMELINE] = + g_param_spec_object ("timeline", P_("Timeline"), 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); /** * ClutterAlpha:alpha: @@ -352,14 +350,13 @@ clutter_alpha_class_init (ClutterAlphaClass *klass) * * Since: 0.2 */ - pspec = g_param_spec_double ("alpha", + obj_props[PROP_ALPHA] = + g_param_spec_double ("alpha", P_("Alpha value"), P_("Alpha value as computed by the alpha"), -1.0, 2.0, 0.0, CLUTTER_PARAM_READABLE); - obj_props[PROP_ALPHA] = pspec; - g_object_class_install_property (object_class, PROP_ALPHA, pspec); /** * ClutterAlpha:mode: @@ -374,14 +371,17 @@ clutter_alpha_class_init (ClutterAlphaClass *klass) * * Since: 1.0 */ - pspec = g_param_spec_ulong ("mode", + obj_props[PROP_MODE] = + g_param_spec_ulong ("mode", P_("Mode"), P_("Progress mode"), 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); + + _clutter_object_class_install_properties (object_class, + PROP_LAST, + obj_props); } static void diff --git a/clutter/clutter-animation.c b/clutter/clutter-animation.c index e8b70d8ce..19929b6ab 100644 --- a/clutter/clutter-animation.c +++ b/clutter/clutter-animation.c @@ -438,7 +438,6 @@ static void clutter_animation_class_init (ClutterAnimationClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - GParamSpec *pspec; quark_object_animation = g_quark_from_static_string ("clutter-actor-animation"); @@ -459,13 +458,12 @@ clutter_animation_class_init (ClutterAnimationClass *klass) * * Since: 1.0 */ - pspec = g_param_spec_object ("object", - P_("Object"), - 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); + obj_props[PROP_OBJECT] = + g_param_spec_object ("object", + P_("Object"), + P_("Object to which the animation applies"), + G_TYPE_OBJECT, + CLUTTER_PARAM_READWRITE); /** * ClutterAnimation:mode: @@ -476,14 +474,13 @@ clutter_animation_class_init (ClutterAnimationClass *klass) * * Since: 1.0 */ - pspec = g_param_spec_ulong ("mode", - P_("Mode"), - P_("The mode of the animation"), - 0, G_MAXULONG, - CLUTTER_LINEAR, - CLUTTER_PARAM_READWRITE); - obj_props[PROP_MODE] = pspec; - g_object_class_install_property (gobject_class, PROP_MODE, pspec); + obj_props[PROP_MODE] = + g_param_spec_ulong ("mode", + P_("Mode"), + P_("The mode of the animation"), + 0, G_MAXULONG, + CLUTTER_LINEAR, + CLUTTER_PARAM_READWRITE); /** * ClutterAnimation:duration: @@ -492,13 +489,13 @@ clutter_animation_class_init (ClutterAnimationClass *klass) * * Since: 1.0 */ - pspec = g_param_spec_uint ("duration", - P_("Duration"), - 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); + obj_props[PROP_DURATION] = + g_param_spec_uint ("duration", + P_("Duration"), + P_("Duration of the animation, in milliseconds"), + 0, G_MAXUINT, + 0, + CLUTTER_PARAM_READWRITE); /** * ClutterAnimation:loop: @@ -507,13 +504,12 @@ clutter_animation_class_init (ClutterAnimationClass *klass) * * Since: 1.0 */ - pspec = g_param_spec_boolean ("loop", - P_("Loop"), - 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); + obj_props[PROP_LOOP] = + g_param_spec_boolean ("loop", + P_("Loop"), + P_("Whether the animation should loop"), + FALSE, + CLUTTER_PARAM_READWRITE); /** * ClutterAnimation:timeline: @@ -522,13 +518,12 @@ clutter_animation_class_init (ClutterAnimationClass *klass) * * Since: 1.0 */ - pspec = g_param_spec_object ("timeline", - P_("Timeline"), - 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); + obj_props[PROP_TIMELINE] = + g_param_spec_object ("timeline", + P_("Timeline"), + P_("The timeline used by the animation"), + CLUTTER_TYPE_TIMELINE, + CLUTTER_PARAM_READWRITE); /** * ClutterAnimation:alpha: @@ -537,13 +532,16 @@ clutter_animation_class_init (ClutterAnimationClass *klass) * * Since: 1.0 */ - pspec = g_param_spec_object ("alpha", - P_("Alpha"), - 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); + obj_props[PROP_ALPHA] = + g_param_spec_object ("alpha", + P_("Alpha"), + P_("The alpha used by the animation"), + CLUTTER_TYPE_ALPHA, + CLUTTER_PARAM_READWRITE); + + _clutter_object_class_install_properties (gobject_class, + PROP_LAST, + obj_props); /** * ClutterAnimation::started: diff --git a/clutter/clutter-animator.c b/clutter/clutter-animator.c index d9371907c..4be585b04 100644 --- a/clutter/clutter-animator.c +++ b/clutter/clutter-animator.c @@ -1762,7 +1762,6 @@ static void clutter_animator_class_init (ClutterAnimatorClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - GParamSpec *pspec; g_type_class_add_private (klass, sizeof (ClutterAnimatorPrivate)); @@ -1779,14 +1778,13 @@ clutter_animator_class_init (ClutterAnimatorClass *klass) * * Since: 1.2 */ - pspec = g_param_spec_uint ("duration", - P_("Duration"), - P_("The duration of the animation"), - 0, G_MAXUINT, - 2000, - CLUTTER_PARAM_READWRITE); - obj_props[PROP_DURATION] = pspec; - g_object_class_install_property (gobject_class, PROP_DURATION, pspec); + obj_props[PROP_DURATION] = + g_param_spec_uint ("duration", + P_("Duration"), + P_("The duration of the animation"), + 0, G_MAXUINT, + 2000, + CLUTTER_PARAM_READWRITE); /** * ClutterAnimator:timeline: @@ -1796,13 +1794,16 @@ clutter_animator_class_init (ClutterAnimatorClass *klass) * * Since: 1.2 */ - pspec = g_param_spec_object ("timeline", - P_("Timeline"), - 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); + obj_props[PROP_TIMELINE] = + g_param_spec_object ("timeline", + P_("Timeline"), + P_("The timeline of the animation"), + CLUTTER_TYPE_TIMELINE, + CLUTTER_PARAM_READWRITE); + + _clutter_object_class_install_properties (gobject_class, + PROP_LAST, + obj_props); } static void diff --git a/clutter/clutter-behaviour.c b/clutter/clutter-behaviour.c index 44d383f3d..25e390eb8 100644 --- a/clutter/clutter-behaviour.c +++ b/clutter/clutter-behaviour.c @@ -276,7 +276,6 @@ static void clutter_behaviour_class_init (ClutterBehaviourClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - GParamSpec *pspec; object_class->dispose = clutter_behaviour_dispose; object_class->set_property = clutter_behaviour_set_property; @@ -292,13 +291,16 @@ clutter_behaviour_class_init (ClutterBehaviourClass *klass) * * Since: 0.2 */ - pspec = g_param_spec_object ("alpha", - P_("Alpha"), - 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); + obj_props[PROP_ALPHA] = + g_param_spec_object ("alpha", + P_("Alpha"), + P_("Alpha Object to drive the behaviour"), + CLUTTER_TYPE_ALPHA, + CLUTTER_PARAM_READWRITE); + + _clutter_object_class_install_properties (object_class, + PROP_LAST, + obj_props); klass->alpha_notify = clutter_behaviour_alpha_notify_unimplemented; diff --git a/clutter/clutter-bin-layout.c b/clutter/clutter-bin-layout.c index 971a8f44d..ab0238658 100644 --- a/clutter/clutter-bin-layout.c +++ b/clutter/clutter-bin-layout.c @@ -132,7 +132,9 @@ enum PROP_LAYER_0, PROP_LAYER_X_ALIGN, - PROP_LAYER_Y_ALIGN + PROP_LAYER_Y_ALIGN, + + PROP_LAYER_LAST }; enum @@ -145,7 +147,8 @@ enum PROP_LAST }; -static GParamSpec *obj_props[PROP_LAST]; +static GParamSpec *layer_props[PROP_LAYER_LAST] = { NULL, }; +static GParamSpec *bin_props[PROP_LAST] = { NULL, }; G_DEFINE_TYPE (ClutterBinLayer, clutter_bin_layer, @@ -175,7 +178,7 @@ set_layer_x_align (ClutterBinLayer *self, manager = clutter_layout_meta_get_manager (meta); clutter_layout_manager_layout_changed (manager); - _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_X_ALIGN]); + _clutter_notify_by_pspec (G_OBJECT (self), layer_props[PROP_LAYER_X_ALIGN]); } static void @@ -194,7 +197,7 @@ set_layer_y_align (ClutterBinLayer *self, manager = clutter_layout_meta_get_manager (meta); clutter_layout_manager_layout_changed (manager); - _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_Y_ALIGN]); + _clutter_notify_by_pspec (G_OBJECT (self), layer_props[PROP_LAYER_Y_ALIGN]); } static void @@ -249,34 +252,31 @@ static void clutter_bin_layer_class_init (ClutterBinLayerClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - GParamSpec *pspec; gobject_class->set_property = clutter_bin_layer_set_property; gobject_class->get_property = clutter_bin_layer_get_property; - pspec = g_param_spec_enum ("x-align", - P_("Horizontal Alignment"), - P_("Horizontal alignment for the actor " - "inside the layout manager"), - 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); + layer_props[PROP_LAYER_X_ALIGN] = + g_param_spec_enum ("x-align", + P_("Horizontal Alignment"), + P_("Horizontal alignment for the actor " + "inside the layout manager"), + CLUTTER_TYPE_BIN_ALIGNMENT, + CLUTTER_BIN_ALIGNMENT_CENTER, + CLUTTER_PARAM_READWRITE); - pspec = g_param_spec_enum ("y-align", - P_("Vertical Alignment"), - P_("Vertical alignment for the actor " - "inside the layout manager"), - 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); + layer_props[PROP_LAYER_Y_ALIGN] = + g_param_spec_enum ("y-align", + P_("Vertical Alignment"), + P_("Vertical alignment for the actor " + "inside the layout manager"), + CLUTTER_TYPE_BIN_ALIGNMENT, + CLUTTER_BIN_ALIGNMENT_CENTER, + CLUTTER_PARAM_READWRITE); + + _clutter_object_class_install_properties (gobject_class, + PROP_LAYER_LAST, + layer_props); } static void @@ -305,7 +305,7 @@ set_x_align (ClutterBinLayout *self, manager = CLUTTER_LAYOUT_MANAGER (self); clutter_layout_manager_layout_changed (manager); - _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_X_ALIGN]); + _clutter_notify_by_pspec (G_OBJECT (self), bin_props[PROP_X_ALIGN]); } } @@ -324,7 +324,7 @@ set_y_align (ClutterBinLayout *self, manager = CLUTTER_LAYOUT_MANAGER (self); clutter_layout_manager_layout_changed (manager); - _clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_Y_ALIGN]); + _clutter_notify_by_pspec (G_OBJECT (self), bin_props[PROP_Y_ALIGN]); } } @@ -564,13 +564,9 @@ clutter_bin_layout_class_init (ClutterBinLayoutClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); ClutterLayoutManagerClass *layout_class = CLUTTER_LAYOUT_MANAGER_CLASS (klass); - GParamSpec *pspec; g_type_class_add_private (klass, sizeof (ClutterBinLayoutPrivate)); - gobject_class->set_property = clutter_bin_layout_set_property; - gobject_class->get_property = clutter_bin_layout_get_property; - /** * ClutterBinLayout:x-align: * @@ -579,15 +575,14 @@ clutter_bin_layout_class_init (ClutterBinLayoutClass *klass) * * Since: 1.2 */ - pspec = g_param_spec_enum ("x-align", - P_("Horizontal Alignment"), - P_("Default horizontal alignment for the actors " - "inside the layout manager"), - 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); + bin_props[PROP_X_ALIGN] = + g_param_spec_enum ("x-align", + P_("Horizontal Alignment"), + P_("Default horizontal alignment for the actors " + "inside the layout manager"), + CLUTTER_TYPE_BIN_ALIGNMENT, + CLUTTER_BIN_ALIGNMENT_CENTER, + CLUTTER_PARAM_READWRITE); /** * ClutterBinLayout:y-align: @@ -597,15 +592,20 @@ clutter_bin_layout_class_init (ClutterBinLayoutClass *klass) * * Since: 1.2 */ - pspec = g_param_spec_enum ("y-align", - P_("Vertical Alignment"), - P_("Default vertical alignment for the actors " - "inside the layout manager"), - 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); + bin_props[PROP_Y_ALIGN] = + g_param_spec_enum ("y-align", + P_("Vertical Alignment"), + P_("Default vertical alignment for the actors " + "inside the layout manager"), + CLUTTER_TYPE_BIN_ALIGNMENT, + CLUTTER_BIN_ALIGNMENT_CENTER, + CLUTTER_PARAM_READWRITE); + + gobject_class->set_property = clutter_bin_layout_set_property; + gobject_class->get_property = clutter_bin_layout_get_property; + _clutter_object_class_install_properties (gobject_class, + PROP_LAST, + bin_props); layout_class->get_preferred_width = clutter_bin_layout_get_preferred_width; diff --git a/clutter/clutter-bind-constraint.c b/clutter/clutter-bind-constraint.c index cf9e98a44..ceb537550 100644 --- a/clutter/clutter-bind-constraint.c +++ b/clutter/clutter-bind-constraint.c @@ -265,7 +265,6 @@ clutter_bind_constraint_class_init (ClutterBindConstraintClass *klass) ClutterActorMetaClass *meta_class = CLUTTER_ACTOR_META_CLASS (klass); ClutterConstraintClass *constraint_class = CLUTTER_CONSTRAINT_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - GParamSpec *pspec; gobject_class->set_property = clutter_bind_constraint_set_property; gobject_class->get_property = clutter_bind_constraint_get_property; @@ -280,14 +279,12 @@ clutter_bind_constraint_class_init (ClutterBindConstraintClass *klass) * * Since: 1.4 */ - pspec = g_param_spec_object ("source", - P_("Source"), - P_("The source of the binding"), - CLUTTER_TYPE_ACTOR, - CLUTTER_PARAM_READWRITE | - G_PARAM_CONSTRUCT); - obj_props[PROP_SOURCE] = pspec; - g_object_class_install_property (gobject_class, PROP_SOURCE, pspec); + obj_props[PROP_SOURCE] = + g_param_spec_object ("source", + P_("Source"), + P_("The source of the binding"), + CLUTTER_TYPE_ACTOR, + CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT); /** * ClutterBindConstraint:coordinate: @@ -296,15 +293,13 @@ clutter_bind_constraint_class_init (ClutterBindConstraintClass *klass) * * Since: 1.4 */ - pspec = g_param_spec_enum ("coordinate", - P_("Coordinate"), - P_("The coordinate to bind"), - CLUTTER_TYPE_BIND_COORDINATE, - CLUTTER_BIND_X, - CLUTTER_PARAM_READWRITE | - G_PARAM_CONSTRUCT); - obj_props[PROP_COORDINATE] = pspec; - g_object_class_install_property (gobject_class, PROP_COORDINATE, pspec); + obj_props[PROP_COORDINATE] = + g_param_spec_enum ("coordinate", + P_("Coordinate"), + P_("The coordinate to bind"), + CLUTTER_TYPE_BIND_COORDINATE, + CLUTTER_BIND_X, + CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT); /** * ClutterBindConstraint:offset: @@ -313,15 +308,17 @@ clutter_bind_constraint_class_init (ClutterBindConstraintClass *klass) * * Since: 1.4 */ - pspec = g_param_spec_float ("offset", - P_("Offset"), - P_("The offset in pixels to apply to the binding"), - -G_MAXFLOAT, G_MAXFLOAT, - 0.0f, - CLUTTER_PARAM_READWRITE | - G_PARAM_CONSTRUCT); - obj_props[PROP_OFFSET] = pspec; - g_object_class_install_property (gobject_class, PROP_OFFSET, pspec); + obj_props[PROP_OFFSET] = + g_param_spec_float ("offset", + P_("Offset"), + P_("The offset in pixels to apply to the binding"), + -G_MAXFLOAT, G_MAXFLOAT, + 0.0f, + CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT); + + _clutter_object_class_install_properties (gobject_class, + PROP_LAST, + obj_props); } static void diff --git a/clutter/clutter-binding-pool.c b/clutter/clutter-binding-pool.c index b68e7568a..3abb00624 100644 --- a/clutter/clutter-binding-pool.c +++ b/clutter/clutter-binding-pool.c @@ -302,7 +302,6 @@ static void clutter_binding_pool_class_init (ClutterBindingPoolClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - GParamSpec *pspec = NULL; gobject_class->constructed = clutter_binding_pool_constructed; gobject_class->set_property = clutter_binding_pool_set_property; @@ -316,14 +315,17 @@ clutter_binding_pool_class_init (ClutterBindingPoolClass *klass) * * Since: 1.0 */ - pspec = g_param_spec_string ("name", - P_("Name"), - P_("The unique name of the binding pool"), - NULL, - CLUTTER_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY); - obj_props[PROP_NAME] = pspec; - g_object_class_install_property (gobject_class, PROP_NAME, pspec); + obj_props[PROP_NAME] = + g_param_spec_string ("name", + P_("Name"), + P_("The unique name of the binding pool"), + NULL, + CLUTTER_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY); + + _clutter_object_class_install_properties (gobject_class, + PROP_LAST, + obj_props); } static void diff --git a/clutter/clutter-cairo-texture.c b/clutter/clutter-cairo-texture.c index 7c941ab0c..2e191c4a1 100644 --- a/clutter/clutter-cairo-texture.c +++ b/clutter/clutter-cairo-texture.c @@ -380,7 +380,6 @@ clutter_cairo_texture_class_init (ClutterCairoTextureClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass); - GParamSpec *pspec; gobject_class->finalize = clutter_cairo_texture_finalize; gobject_class->set_property = clutter_cairo_texture_set_property; @@ -405,16 +404,13 @@ clutter_cairo_texture_class_init (ClutterCairoTextureClass *klass) * * Since: 1.0 */ - pspec = g_param_spec_uint ("surface-width", - P_("Surface Width"), - P_("The width of the Cairo surface"), - 0, G_MAXUINT, - 0, - CLUTTER_PARAM_READWRITE); - obj_props[PROP_SURFACE_WIDTH] = pspec; - g_object_class_install_property (gobject_class, - PROP_SURFACE_WIDTH, - pspec); + obj_props[PROP_SURFACE_WIDTH] = + g_param_spec_uint ("surface-width", + P_("Surface Width"), + P_("The width of the Cairo surface"), + 0, G_MAXUINT, + 0, + CLUTTER_PARAM_READWRITE); /** * ClutterCairoTexture:surface-height: * @@ -423,16 +419,17 @@ clutter_cairo_texture_class_init (ClutterCairoTextureClass *klass) * * Since: 1.0 */ - pspec = g_param_spec_uint ("surface-height", - P_("Surface Height"), - P_("The height of the Cairo surface"), - 0, G_MAXUINT, - 0, - CLUTTER_PARAM_READWRITE); - obj_props[PROP_SURFACE_HEIGHT] = pspec; - g_object_class_install_property (gobject_class, - PROP_SURFACE_HEIGHT, - pspec); + obj_props[PROP_SURFACE_HEIGHT] = + g_param_spec_uint ("surface-height", + P_("Surface Height"), + P_("The height of the Cairo surface"), + 0, G_MAXUINT, + 0, + CLUTTER_PARAM_READWRITE); + + _clutter_object_class_install_properties (gobject_class, + PROP_LAST, + obj_props); } static void diff --git a/clutter/clutter-child-meta.c b/clutter/clutter-child-meta.c index 93e50df25..c272f5b3f 100644 --- a/clutter/clutter-child-meta.c +++ b/clutter/clutter-child-meta.c @@ -111,7 +111,6 @@ static void clutter_child_meta_class_init (ClutterChildMetaClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - GParamSpec *pspec; gobject_class->set_property = clutter_child_meta_set_property; gobject_class->get_property = clutter_child_meta_get_property; @@ -123,14 +122,13 @@ clutter_child_meta_class_init (ClutterChildMetaClass *klass) * * Since: 0.8 */ - pspec = g_param_spec_object ("container", - P_("Container"), - P_("The container that created this data"), - 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); + obj_props[PROP_CONTAINER] = + g_param_spec_object ("container", + P_("Container"), + P_("The container that created this data"), + CLUTTER_TYPE_CONTAINER, + G_PARAM_CONSTRUCT_ONLY | + CLUTTER_PARAM_READWRITE); /** * ClutterChildMeta:actor: @@ -139,14 +137,17 @@ clutter_child_meta_class_init (ClutterChildMetaClass *klass) * * Since: 0.8 */ - pspec = g_param_spec_object ("actor", - P_("Actor"), - P_("The actor wrapped by this data"), - 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); + obj_props[PROP_ACTOR] = + g_param_spec_object ("actor", + P_("Actor"), + P_("The actor wrapped by this data"), + CLUTTER_TYPE_ACTOR, + G_PARAM_CONSTRUCT_ONLY | + CLUTTER_PARAM_READWRITE); + + _clutter_object_class_install_properties (gobject_class, + PROP_LAST, + obj_props); } static void diff --git a/clutter/clutter-click-action.c b/clutter/clutter-click-action.c index 116e75e5f..b92527ecc 100644 --- a/clutter/clutter-click-action.c +++ b/clutter/clutter-click-action.c @@ -221,7 +221,6 @@ clutter_click_action_class_init (ClutterClickActionClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); ClutterActorMetaClass *meta_class = CLUTTER_ACTOR_META_CLASS (klass); - GParamSpec *pspec; g_type_class_add_private (klass, sizeof (ClutterClickActionPrivate)); @@ -236,13 +235,12 @@ clutter_click_action_class_init (ClutterClickActionClass *klass) * * Since: 1.4 */ - pspec = g_param_spec_boolean ("pressed", - P_("Pressed"), - 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); + obj_props[PROP_PRESSED] = + g_param_spec_boolean ("pressed", + P_("Pressed"), + P_("Whether the clickable should be in pressed state"), + FALSE, + CLUTTER_PARAM_READABLE); /** * ClutterClickAction:held: @@ -251,13 +249,16 @@ clutter_click_action_class_init (ClutterClickActionClass *klass) * * Since: 1.4 */ - pspec = g_param_spec_boolean ("held", - P_("Held"), - 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); + obj_props[PROP_HELD] = + g_param_spec_boolean ("held", + P_("Held"), + P_("Whether the clickable has a grab"), + FALSE, + CLUTTER_PARAM_READABLE); + + _clutter_object_class_install_properties (gobject_class, + PROP_LAST, + obj_props); /** * ClutterClickAction::clicked: diff --git a/clutter/clutter-clone.c b/clutter/clutter-clone.c index 6db6c0c5b..bb63905b3 100644 --- a/clutter/clutter-clone.c +++ b/clutter/clutter-clone.c @@ -289,7 +289,6 @@ clutter_clone_class_init (ClutterCloneClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass); - GParamSpec *pspec = NULL; g_type_class_add_private (gobject_class, sizeof (ClutterClonePrivate)); @@ -311,14 +310,17 @@ clutter_clone_class_init (ClutterCloneClass *klass) * * Since: 1.0 */ - pspec = g_param_spec_object ("source", - P_("Source"), - P_("Specifies the actor to be cloned"), - CLUTTER_TYPE_ACTOR, - G_PARAM_CONSTRUCT | - CLUTTER_PARAM_READWRITE); - obj_props[PROP_SOURCE] = pspec; - g_object_class_install_property (gobject_class, PROP_SOURCE, pspec); + obj_props[PROP_SOURCE] = + g_param_spec_object ("source", + P_("Source"), + P_("Specifies the actor to be cloned"), + CLUTTER_TYPE_ACTOR, + G_PARAM_CONSTRUCT | + CLUTTER_PARAM_READWRITE); + + _clutter_object_class_install_properties (gobject_class, + PROP_LAST, + obj_props); } static void diff --git a/clutter/clutter-colorize-effect.c b/clutter/clutter-colorize-effect.c index 2da277d97..a72458102 100644 --- a/clutter/clutter-colorize-effect.c +++ b/clutter/clutter-colorize-effect.c @@ -288,7 +288,6 @@ clutter_colorize_effect_class_init (ClutterColorizeEffectClass *klass) ClutterEffectClass *effect_class = CLUTTER_EFFECT_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass); ClutterOffscreenEffectClass *offscreen_class; - GParamSpec *pspec; offscreen_class = CLUTTER_OFFSCREEN_EFFECT_CLASS (klass); offscreen_class->paint_target = clutter_colorize_effect_paint_target; @@ -306,13 +305,16 @@ clutter_colorize_effect_class_init (ClutterColorizeEffectClass *klass) * * Since: 1.4 */ - pspec = clutter_param_spec_color ("tint", - P_("Tint"), - 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); + obj_props[PROP_TINT] = + clutter_param_spec_color ("tint", + P_("Tint"), + P_("The tint to apply"), + &default_tint, + CLUTTER_PARAM_READWRITE); + + _clutter_object_class_install_properties (gobject_class, + PROP_LAST, + obj_props); } static void diff --git a/clutter/clutter-deform-effect.c b/clutter/clutter-deform-effect.c index 052ed0bc9..5720db7aa 100644 --- a/clutter/clutter-deform-effect.c +++ b/clutter/clutter-deform-effect.c @@ -503,16 +503,11 @@ clutter_deform_effect_class_init (ClutterDeformEffectClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); ClutterActorMetaClass *meta_class = CLUTTER_ACTOR_META_CLASS (klass); ClutterOffscreenEffectClass *offscreen_class = CLUTTER_OFFSCREEN_EFFECT_CLASS (klass); - GParamSpec *pspec; g_type_class_add_private (klass, sizeof (ClutterDeformEffectPrivate)); klass->deform_vertex = clutter_deform_effect_real_deform_vertex; - gobject_class->set_property = clutter_deform_effect_set_property; - gobject_class->get_property = clutter_deform_effect_get_property; - gobject_class->finalize = clutter_deform_effect_finalize; - /** * ClutterDeformEffect:x-tiles: * @@ -521,14 +516,13 @@ clutter_deform_effect_class_init (ClutterDeformEffectClass *klass) * * Since: 1.4 */ - pspec = g_param_spec_uint ("x-tiles", - P_("Horizontal Tiles"), - P_("The number of horizontal tiles"), - 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); + obj_props[PROP_X_TILES] = + g_param_spec_uint ("x-tiles", + P_("Horizontal Tiles"), + P_("The number of horizontal tiles"), + 1, G_MAXUINT, + DEFAULT_N_TILES, + CLUTTER_PARAM_READWRITE); /** * ClutterDeformEffect:y-tiles: @@ -538,14 +532,13 @@ clutter_deform_effect_class_init (ClutterDeformEffectClass *klass) * * Since: 1.4 */ - pspec = g_param_spec_uint ("y-tiles", - P_("Vertical Tiles"), - P_("The number of vertical tiles"), - 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); + obj_props[PROP_Y_TILES] = + g_param_spec_uint ("y-tiles", + P_("Vertical Tiles"), + P_("The number of vertical tiles"), + 1, G_MAXUINT, + DEFAULT_N_TILES, + CLUTTER_PARAM_READWRITE); /** * ClutterDeformEffect:back-material: @@ -557,13 +550,19 @@ clutter_deform_effect_class_init (ClutterDeformEffectClass *klass) * * Since: 1.4 */ - pspec = g_param_spec_boxed ("back-material", - P_("Back Material"), - 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); + obj_props[PROP_BACK_MATERIAL] = + g_param_spec_boxed ("back-material", + P_("Back Material"), + P_("The material to be used when painting the back of the actor"), + COGL_TYPE_HANDLE, + CLUTTER_PARAM_READWRITE); + + gobject_class->finalize = clutter_deform_effect_finalize; + gobject_class->set_property = clutter_deform_effect_set_property; + gobject_class->get_property = clutter_deform_effect_get_property; + _clutter_object_class_install_properties (gobject_class, + PROP_LAST, + obj_props); meta_class->set_actor = clutter_deform_effect_set_actor; diff --git a/clutter/clutter-desaturate-effect.c b/clutter/clutter-desaturate-effect.c index b501d6605..0d67eaaef 100644 --- a/clutter/clutter-desaturate-effect.c +++ b/clutter/clutter-desaturate-effect.c @@ -289,17 +289,12 @@ clutter_desaturate_effect_class_init (ClutterDesaturateEffectClass *klass) ClutterEffectClass *effect_class = CLUTTER_EFFECT_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass); ClutterOffscreenEffectClass *offscreen_class; - GParamSpec *pspec; offscreen_class = CLUTTER_OFFSCREEN_EFFECT_CLASS (klass); offscreen_class->paint_target = clutter_desaturate_effect_paint_target; effect_class->pre_paint = clutter_desaturate_effect_pre_paint; - gobject_class->set_property = clutter_desaturate_effect_set_property; - gobject_class->get_property = clutter_desaturate_effect_get_property; - gobject_class->dispose = clutter_desaturate_effect_dispose; - /** * ClutterDesaturateEffect:factor: * @@ -308,14 +303,21 @@ clutter_desaturate_effect_class_init (ClutterDesaturateEffectClass *klass) * * Since: 1.4 */ - pspec = g_param_spec_double ("factor", - P_("Factor"), - P_("The desaturation factor"), - 0.0, 1.0, - 1.0, - CLUTTER_PARAM_READWRITE); - obj_props[PROP_FACTOR] = pspec; - g_object_class_install_property (gobject_class, PROP_FACTOR, pspec); + obj_props[PROP_FACTOR] = + g_param_spec_double ("factor", + P_("Factor"), + P_("The desaturation factor"), + 0.0, 1.0, + 1.0, + CLUTTER_PARAM_READWRITE); + + gobject_class->dispose = clutter_desaturate_effect_dispose; + gobject_class->set_property = clutter_desaturate_effect_set_property; + gobject_class->get_property = clutter_desaturate_effect_get_property; + + _clutter_object_class_install_properties (gobject_class, + PROP_LAST, + obj_props); } static void diff --git a/clutter/clutter-device-manager.c b/clutter/clutter-device-manager.c index 2c48afe1b..238e7d74d 100644 --- a/clutter/clutter-device-manager.c +++ b/clutter/clutter-device-manager.c @@ -121,21 +121,21 @@ static void clutter_device_manager_class_init (ClutterDeviceManagerClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - GParamSpec *pspec; g_type_class_add_private (klass, sizeof (ClutterDeviceManagerPrivate)); + obj_props[PROP_BACKEND] = + g_param_spec_object ("backend", + P_("Backend"), + P_("The ClutterBackend of the device manager"), + CLUTTER_TYPE_BACKEND, + CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); + gobject_class->set_property = clutter_device_manager_set_property; gobject_class->get_property = clutter_device_manager_get_property; - - pspec = g_param_spec_object ("backend", - P_("Backend"), - P_("The ClutterBackend of the device manager"), - 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); + _clutter_object_class_install_properties (gobject_class, + PROP_LAST, + obj_props); /** * ClutterDeviceManager::device-added: diff --git a/clutter/clutter-flow-layout.c b/clutter/clutter-flow-layout.c index 27a56b16c..6cfb769ae 100644 --- a/clutter/clutter-flow-layout.c +++ b/clutter/clutter-flow-layout.c @@ -126,9 +126,13 @@ enum PROP_MIN_COLUMN_WIDTH, PROP_MAX_COLUMN_WIDTH, PROP_MIN_ROW_HEGHT, - PROP_MAX_ROW_HEIGHT + PROP_MAX_ROW_HEIGHT, + + N_PROPERTIES }; +static GParamSpec *flow_properties[N_PROPERTIES] = { NULL, }; + G_DEFINE_TYPE (ClutterFlowLayout, clutter_flow_layout, CLUTTER_TYPE_LAYOUT_MANAGER); @@ -850,17 +854,12 @@ clutter_flow_layout_class_init (ClutterFlowLayoutClass *klass) { GObjectClass *gobject_class; ClutterLayoutManagerClass *layout_class; - GParamSpec *pspec; g_type_class_add_private (klass, sizeof (ClutterFlowLayoutPrivate)); gobject_class = G_OBJECT_CLASS (klass); layout_class = CLUTTER_LAYOUT_MANAGER_CLASS (klass); - gobject_class->set_property = clutter_flow_layout_set_property; - gobject_class->get_property = clutter_flow_layout_get_property; - gobject_class->finalize = clutter_flow_layout_finalize; - layout_class->get_preferred_width = clutter_flow_layout_get_preferred_width; layout_class->get_preferred_height = @@ -878,14 +877,13 @@ clutter_flow_layout_class_init (ClutterFlowLayoutClass *klass) * * Since: 1.2 */ - pspec = g_param_spec_enum ("orientation", - P_("Orientation"), - P_("The orientation of the layout"), - CLUTTER_TYPE_FLOW_ORIENTATION, - CLUTTER_FLOW_HORIZONTAL, - CLUTTER_PARAM_READWRITE | - G_PARAM_CONSTRUCT); - g_object_class_install_property (gobject_class, PROP_ORIENTATION, pspec); + flow_properties[PROP_ORIENTATION] = + g_param_spec_enum ("orientation", + P_("Orientation"), + P_("The orientation of the layout"), + CLUTTER_TYPE_FLOW_ORIENTATION, + CLUTTER_FLOW_HORIZONTAL, + CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT); /** * ClutterFlowLayout:homogeneous: @@ -895,12 +893,12 @@ clutter_flow_layout_class_init (ClutterFlowLayoutClass *klass) * * Since: 1.2 */ - pspec = g_param_spec_boolean ("homogeneous", - P_("Homogeneous"), - P_("Whether each item should receive the same allocation"), - FALSE, - CLUTTER_PARAM_READWRITE); - g_object_class_install_property (gobject_class, PROP_HOMOGENEOUS, pspec); + flow_properties[PROP_HOMOGENEOUS] = + g_param_spec_boolean ("homogeneous", + P_("Homogeneous"), + P_("Whether each item should receive the same allocation"), + FALSE, + CLUTTER_PARAM_READWRITE); /** * ClutterFlowLayout:column-spacing: @@ -911,15 +909,13 @@ clutter_flow_layout_class_init (ClutterFlowLayoutClass *klass) * * Since: 1.2 */ - pspec = g_param_spec_float ("column-spacing", - P_("Column Spacing"), - P_("The spacing between columns"), - 0.0, G_MAXFLOAT, - 0.0, - CLUTTER_PARAM_READWRITE); - g_object_class_install_property (gobject_class, - PROP_COLUMN_SPACING, - pspec); + flow_properties[PROP_COLUMN_SPACING] = + g_param_spec_float ("column-spacing", + P_("Column Spacing"), + P_("The spacing between columns"), + 0.0, G_MAXFLOAT, + 0.0, + CLUTTER_PARAM_READWRITE); /** * ClutterFlowLayout:row-spacing: @@ -930,15 +926,13 @@ clutter_flow_layout_class_init (ClutterFlowLayoutClass *klass) * * Since: 1.2 */ - pspec = g_param_spec_float ("row-spacing", - P_("Row Spacing"), - P_("The spacing between rows"), - 0.0, G_MAXFLOAT, - 0.0, - CLUTTER_PARAM_READWRITE); - g_object_class_install_property (gobject_class, - PROP_ROW_SPACING, - pspec); + flow_properties[PROP_ROW_SPACING] = + g_param_spec_float ("row-spacing", + P_("Row Spacing"), + P_("The spacing between rows"), + 0.0, G_MAXFLOAT, + 0.0, + CLUTTER_PARAM_READWRITE); /** * ClutterFlowLayout:min-column-width: @@ -947,15 +941,13 @@ clutter_flow_layout_class_init (ClutterFlowLayoutClass *klass) * * Since: 1.2 */ - pspec = g_param_spec_float ("min-column-width", - P_("Minimum Column Width"), - P_("Minimum width for each column"), - 0.0, G_MAXFLOAT, - 0.0, - CLUTTER_PARAM_READWRITE); - g_object_class_install_property (gobject_class, - PROP_MIN_COLUMN_WIDTH, - pspec); + flow_properties[PROP_MIN_COLUMN_WIDTH] = + g_param_spec_float ("min-column-width", + P_("Minimum Column Width"), + P_("Minimum width for each column"), + 0.0, G_MAXFLOAT, + 0.0, + CLUTTER_PARAM_READWRITE); /** * ClutterFlowLayout:max-column-width: @@ -965,15 +957,13 @@ clutter_flow_layout_class_init (ClutterFlowLayoutClass *klass) * * Since: 1.2 */ - pspec = g_param_spec_float ("max-column-width", - P_("Maximum Column Width"), - P_("Maximum width for each column"), - -1.0, G_MAXFLOAT, - -1.0, - CLUTTER_PARAM_READWRITE); - g_object_class_install_property (gobject_class, - PROP_MAX_COLUMN_WIDTH, - pspec); + flow_properties[PROP_MAX_COLUMN_WIDTH] = + g_param_spec_float ("max-column-width", + P_("Maximum Column Width"), + P_("Maximum width for each column"), + -1.0, G_MAXFLOAT, + -1.0, + CLUTTER_PARAM_READWRITE); /** * ClutterFlowLayout:min-row-height: @@ -982,15 +972,13 @@ clutter_flow_layout_class_init (ClutterFlowLayoutClass *klass) * * Since: 1.2 */ - pspec = g_param_spec_float ("min-row-height", - P_("Minimum Row Height"), - P_("Minimum height for each row"), - 0.0, G_MAXFLOAT, - 0.0, - CLUTTER_PARAM_READWRITE); - g_object_class_install_property (gobject_class, - PROP_MIN_ROW_HEGHT, - pspec); + flow_properties[PROP_MIN_ROW_HEGHT] = + g_param_spec_float ("min-row-height", + P_("Minimum Row Height"), + P_("Minimum height for each row"), + 0.0, G_MAXFLOAT, + 0.0, + CLUTTER_PARAM_READWRITE); /** * ClutterFlowLayout:max-row-height: @@ -1000,15 +988,20 @@ clutter_flow_layout_class_init (ClutterFlowLayoutClass *klass) * * Since: 1.2 */ - pspec = g_param_spec_float ("max-row-height", - P_("Maximum Row Height"), - P_("Maximum height for each row"), - -1.0, G_MAXFLOAT, - -1.0, - CLUTTER_PARAM_READWRITE); - g_object_class_install_property (gobject_class, - PROP_MAX_ROW_HEIGHT, - pspec); + flow_properties[PROP_MAX_ROW_HEIGHT] = + g_param_spec_float ("max-row-height", + P_("Maximum Row Height"), + P_("Maximum height for each row"), + -1.0, G_MAXFLOAT, + -1.0, + CLUTTER_PARAM_READWRITE); + + gobject_class->finalize = clutter_flow_layout_finalize; + gobject_class->set_property = clutter_flow_layout_set_property; + gobject_class->get_property = clutter_flow_layout_get_property; + _clutter_object_class_install_properties (gobject_class, + N_PROPERTIES, + flow_properties); } static void @@ -1094,7 +1087,8 @@ clutter_flow_layout_set_orientation (ClutterFlowLayout *layout, manager = CLUTTER_LAYOUT_MANAGER (layout); clutter_layout_manager_layout_changed (manager); - g_object_notify (G_OBJECT (layout), "orientation"); + _clutter_notify_by_pspec (G_OBJECT (layout), + flow_properties[PROP_ORIENTATION]); } } @@ -1146,7 +1140,8 @@ clutter_flow_layout_set_homogeneous (ClutterFlowLayout *layout, manager = CLUTTER_LAYOUT_MANAGER (layout); clutter_layout_manager_layout_changed (manager); - g_object_notify (G_OBJECT (layout), "homogeneous"); + _clutter_notify_by_pspec (G_OBJECT (layout), + flow_properties[PROP_HOMOGENEOUS]); } } @@ -1196,7 +1191,8 @@ clutter_flow_layout_set_column_spacing (ClutterFlowLayout *layout, manager = CLUTTER_LAYOUT_MANAGER (layout); clutter_layout_manager_layout_changed (manager); - g_object_notify (G_OBJECT (layout), "column-spacing"); + _clutter_notify_by_pspec (G_OBJECT (layout), + flow_properties[PROP_COLUMN_SPACING]); } } @@ -1247,7 +1243,8 @@ clutter_flow_layout_set_row_spacing (ClutterFlowLayout *layout, manager = CLUTTER_LAYOUT_MANAGER (layout); clutter_layout_manager_layout_changed (manager); - g_object_notify (G_OBJECT (layout), "row-spacing"); + _clutter_notify_by_pspec (G_OBJECT (layout), + flow_properties[PROP_ROW_SPACING]); } } @@ -1316,10 +1313,12 @@ clutter_flow_layout_set_column_width (ClutterFlowLayout *layout, } if (notify_min) - g_object_notify (G_OBJECT (layout), "min-column-width"); + _clutter_notify_by_pspec (G_OBJECT (layout), + flow_properties[PROP_MIN_COLUMN_WIDTH]); if (notify_max) - g_object_notify (G_OBJECT (layout), "max-column-width"); + _clutter_notify_by_pspec (G_OBJECT (layout), + flow_properties[PROP_MAX_COLUMN_WIDTH]); g_object_thaw_notify (G_OBJECT (layout)); } @@ -1394,10 +1393,12 @@ clutter_flow_layout_set_row_height (ClutterFlowLayout *layout, } if (notify_min) - g_object_notify (G_OBJECT (layout), "min-row-height"); + _clutter_notify_by_pspec (G_OBJECT (layout), + flow_properties[PROP_MIN_ROW_HEGHT]); if (notify_max) - g_object_notify (G_OBJECT (layout), "max-row-height"); + _clutter_notify_by_pspec (G_OBJECT (layout), + flow_properties[PROP_MAX_ROW_HEIGHT]); g_object_thaw_notify (G_OBJECT (layout)); } diff --git a/clutter/clutter-script.c b/clutter/clutter-script.c index 61b96250f..9f4000a0f 100644 --- a/clutter/clutter-script.c +++ b/clutter/clutter-script.c @@ -386,9 +386,6 @@ clutter_script_class_init (ClutterScriptClass *klass) klass->get_type_from_name = clutter_script_real_get_type_from_name; - gobject_class->get_property = clutter_script_get_property; - gobject_class->finalize = clutter_script_finalize; - /** * ClutterScript:filename-set: * @@ -398,13 +395,12 @@ clutter_script_class_init (ClutterScriptClass *klass) * * Since: 0.6 */ - pspec = g_param_spec_boolean ("filename-set", - P_("Filename Set"), - 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); + obj_props[PROP_FILENAME_SET] = + g_param_spec_boolean ("filename-set", + P_("Filename Set"), + P_("Whether the :filename property is set"), + FALSE, + CLUTTER_PARAM_READABLE); /** * ClutterScript:filename: @@ -414,13 +410,19 @@ clutter_script_class_init (ClutterScriptClass *klass) * * Since: 0.6 */ - pspec = g_param_spec_string ("filename", - P_("Filename"), - 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); + obj_props[PROP_FILENAME] = + g_param_spec_string ("filename", + P_("Filename"), + P_("The path of the currently parsed file"), + NULL, + CLUTTER_PARAM_READABLE); + + gobject_class->get_property = clutter_script_get_property; + gobject_class->finalize = clutter_script_finalize; + + _clutter_object_class_install_properties (gobject_class, + PROP_LAST, + obj_props); } static void diff --git a/clutter/clutter-shader-effect.c b/clutter/clutter-shader-effect.c index 8b0de595c..9891499fc 100644 --- a/clutter/clutter-shader-effect.c +++ b/clutter/clutter-shader-effect.c @@ -436,9 +436,6 @@ clutter_shader_effect_class_init (ClutterShaderEffectClass *klass) g_type_class_add_private (klass, sizeof (ClutterShaderEffectPrivate)); - gobject_class->set_property = clutter_shader_effect_set_property; - gobject_class->finalize = clutter_shader_effect_finalize; - /** * ClutterShaderEffect:shader-type: * @@ -448,15 +445,19 @@ clutter_shader_effect_class_init (ClutterShaderEffectClass *klass) * * Since: 1.4 */ - pspec = g_param_spec_enum ("shader-type", - P_("Shader Type"), - P_("The type of shader used"), - CLUTTER_TYPE_SHADER_TYPE, - 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); + obj_props[PROP_SHADER_TYPE] = + g_param_spec_enum ("shader-type", + P_("Shader Type"), + P_("The type of shader used"), + CLUTTER_TYPE_SHADER_TYPE, + CLUTTER_FRAGMENT_SHADER, + CLUTTER_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY); + + gobject_class->set_property = clutter_shader_effect_set_property; + gobject_class->finalize = clutter_shader_effect_finalize; + _clutter_object_class_install_properties (gobject_class, + PROP_LAST, + obj_props); meta_class->set_actor = clutter_shader_effect_set_actor; diff --git a/clutter/clutter-timeline.c b/clutter/clutter-timeline.c index 1f7c7f1fc..47dd5c98a 100644 --- a/clutter/clutter-timeline.c +++ b/clutter/clutter-timeline.c @@ -244,12 +244,6 @@ static void clutter_timeline_class_init (ClutterTimelineClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - GParamSpec *pspec; - - object_class->set_property = clutter_timeline_set_property; - object_class->get_property = clutter_timeline_get_property; - object_class->finalize = clutter_timeline_finalize; - object_class->dispose = clutter_timeline_dispose; g_type_class_add_private (klass, sizeof (ClutterTimelinePrivate)); @@ -258,13 +252,12 @@ clutter_timeline_class_init (ClutterTimelineClass *klass) * * Whether the timeline should automatically rewind and restart. */ - pspec = g_param_spec_boolean ("loop", - "Loop", - "Should the timeline automatically restart", - FALSE, - CLUTTER_PARAM_READWRITE); - obj_props[PROP_LOOP] = pspec; - g_object_class_install_property (object_class, PROP_LOOP, pspec); + obj_props[PROP_LOOP] = + g_param_spec_boolean ("loop", + P_("Loop"), + P_("Should the timeline automatically restart"), + FALSE, + CLUTTER_PARAM_READWRITE); /** * ClutterTimeline:delay: @@ -274,14 +267,13 @@ clutter_timeline_class_init (ClutterTimelineClass *klass) * * Since: 0.4 */ - pspec = g_param_spec_uint ("delay", - "Delay", - "Delay before start", - 0, G_MAXUINT, - 0, - CLUTTER_PARAM_READWRITE); - obj_props[PROP_DELAY] = pspec; - g_object_class_install_property (object_class, PROP_DELAY, pspec); + obj_props[PROP_DELAY] = + g_param_spec_uint ("delay", + P_("Delay"), + P_("Delay before start"), + 0, G_MAXUINT, + 0, + CLUTTER_PARAM_READWRITE); /** * ClutterTimeline:duration: @@ -291,14 +283,13 @@ clutter_timeline_class_init (ClutterTimelineClass *klass) * * Since: 0.6 */ - pspec = g_param_spec_uint ("duration", - "Duration", - "Duration of the timeline in milliseconds", - 0, G_MAXUINT, - 1000, - CLUTTER_PARAM_READWRITE); - obj_props[PROP_DURATION] = pspec; - g_object_class_install_property (object_class, PROP_DURATION, pspec); + obj_props[PROP_DURATION] = + g_param_spec_uint ("duration", + P_("Duration"), + P_("Duration of the timeline in milliseconds"), + 0, G_MAXUINT, + 1000, + CLUTTER_PARAM_READWRITE); /** * ClutterTimeline:direction: @@ -308,14 +299,21 @@ clutter_timeline_class_init (ClutterTimelineClass *klass) * * Since: 0.6 */ - pspec = g_param_spec_enum ("direction", - "Direction", - "Direction of the timeline", - 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); + obj_props[PROP_DIRECTION] = + g_param_spec_enum ("direction", + P_("Direction"), + P_("Direction of the timeline"), + CLUTTER_TYPE_TIMELINE_DIRECTION, + CLUTTER_TIMELINE_FORWARD, + CLUTTER_PARAM_READWRITE); + + object_class->dispose = clutter_timeline_dispose; + object_class->finalize = clutter_timeline_finalize; + object_class->set_property = clutter_timeline_set_property; + object_class->get_property = clutter_timeline_get_property; + _clutter_object_class_install_properties (object_class, + PROP_LAST, + obj_props); /** * ClutterTimeline::new-frame: