diff --git a/src/st/st-box-layout.c b/src/st/st-box-layout.c index 49eaa1948..269ded412 100644 --- a/src/st/st-box-layout.c +++ b/src/st/st-box-layout.c @@ -60,8 +60,12 @@ enum { PROP_VERTICAL, PROP_PACK_START, + + N_PROPS }; +static GParamSpec *props[N_PROPS] = { NULL, }; + struct _StBoxLayoutPrivate { StAdjustment *hadjustment; @@ -169,7 +173,6 @@ st_box_layout_class_init (StBoxLayoutClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); StWidgetClass *widget_class = ST_WIDGET_CLASS (klass); - GParamSpec *pspec; object_class->get_property = st_box_layout_get_property; object_class->set_property = st_box_layout_set_property; @@ -182,13 +185,13 @@ st_box_layout_class_init (StBoxLayoutClass *klass) * A convenience property for the #ClutterBoxLayout:vertical property of the * internal layout for #StBoxLayout. */ - pspec = g_param_spec_boolean ("vertical", - "Vertical", - "Whether the layout should be vertical, rather" - "than horizontal", - FALSE, - ST_PARAM_READWRITE); - g_object_class_install_property (object_class, PROP_VERTICAL, pspec); + props[PROP_VERTICAL] = + g_param_spec_boolean ("vertical", + "Vertical", + "Whether the layout should be vertical, rather" + "than horizontal", + FALSE, + ST_PARAM_READWRITE); /** * StBoxLayout:pack-start: @@ -196,12 +199,14 @@ st_box_layout_class_init (StBoxLayoutClass *klass) * A convenience property for the #ClutterBoxLayout:pack-start property of the * internal layout for #StBoxLayout. */ - pspec = g_param_spec_boolean ("pack-start", - "Pack Start", - "Whether to pack items at the start of the box", - FALSE, - ST_PARAM_READWRITE | G_PARAM_DEPRECATED); - g_object_class_install_property (object_class, PROP_PACK_START, pspec); + props[PROP_PACK_START] = + g_param_spec_boolean ("pack-start", + "Pack Start", + "Whether to pack items at the start of the box", + FALSE, + ST_PARAM_READWRITE | G_PARAM_DEPRECATED); + + g_object_class_install_properties (object_class, N_PROPS, props); } static void @@ -250,7 +255,7 @@ st_box_layout_set_vertical (StBoxLayout *box, if (clutter_box_layout_get_orientation (CLUTTER_BOX_LAYOUT (layout)) != orientation) { clutter_box_layout_set_orientation (CLUTTER_BOX_LAYOUT (layout), orientation); - g_object_notify (G_OBJECT (box), "vertical"); + g_object_notify_by_pspec (G_OBJECT (box), props[PROP_VERTICAL]); } } diff --git a/src/st/st-theme-context.c b/src/st/st-theme-context.c index 17acd1a10..34cc4fac0 100644 --- a/src/st/st-theme-context.c +++ b/src/st/st-theme-context.c @@ -46,9 +46,13 @@ struct _StThemeContext { enum { PROP_0, - PROP_SCALE_FACTOR + PROP_SCALE_FACTOR, + + N_PROPS }; +static GParamSpec *props[N_PROPS] = { NULL, }; + enum { CHANGED, @@ -85,7 +89,7 @@ st_theme_context_set_scale_factor (StThemeContext *context, return; context->scale_factor = scale_factor; - g_object_notify (G_OBJECT (context), "scale-factor"); + g_object_notify_by_pspec (G_OBJECT (context), props[PROP_SCALE_FACTOR]); st_theme_context_changed (context); } @@ -133,13 +137,14 @@ st_theme_context_class_init (StThemeContextClass *klass) * * The scaling factor used for HiDPI scaling. */ - g_object_class_install_property (object_class, - PROP_SCALE_FACTOR, - g_param_spec_int ("scale-factor", - "Scale factor", - "Integer scale factor used for HiDPI scaling", - 0, G_MAXINT, 1, - ST_PARAM_READWRITE)); + props[PROP_SCALE_FACTOR] = + g_param_spec_int ("scale-factor", + "Scale factor", + "Integer scale factor used for HiDPI scaling", + 0, G_MAXINT, 1, + ST_PARAM_READWRITE); + + g_object_class_install_properties (object_class, N_PROPS, props); /** * StThemeContext::changed: diff --git a/src/st/st-viewport.c b/src/st/st-viewport.c index 96b703b14..3f0cdbb46 100644 --- a/src/st/st-viewport.c +++ b/src/st/st-viewport.c @@ -55,11 +55,18 @@ static void st_viewport_scrollable_interface_init (StScrollableInterface *iface) enum { PROP_0, + PROP_CLIP_TO_VIEW, + + N_PROPS, + + /* StScrollable */ PROP_HADJUST, PROP_VADJUST }; +static GParamSpec *props[N_PROPS] = { NULL, }; + typedef struct { StAdjustment *hadjustment; @@ -177,6 +184,7 @@ st_viewport_set_clip_to_view (StViewport *viewport, { priv->clip_to_view = clip_to_view; clutter_actor_queue_redraw (CLUTTER_ACTOR (viewport)); + g_object_notify_by_pspec (G_OBJECT (viewport), props[PROP_CLIP_TO_VIEW]); } } @@ -588,13 +596,12 @@ st_viewport_class_init (StViewportClass *klass) actor_class->get_paint_volume = st_viewport_get_paint_volume; actor_class->pick = st_viewport_pick; - g_object_class_install_property (object_class, - PROP_CLIP_TO_VIEW, - g_param_spec_boolean ("clip-to-view", - "Clip to view", - "Clip to view", - TRUE, - ST_PARAM_READWRITE)); + props[PROP_CLIP_TO_VIEW] = + g_param_spec_boolean ("clip-to-view", + "Clip to view", + "Clip to view", + TRUE, + ST_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY); /* StScrollable properties */ g_object_class_override_property (object_class, @@ -604,6 +611,8 @@ st_viewport_class_init (StViewportClass *klass) g_object_class_override_property (object_class, PROP_VADJUST, "vadjustment"); + + g_object_class_install_properties (object_class, N_PROPS, props); } static void