st: Add static setters

Even where properties can only be set via g_object_set(), separate
setters help with code organization and consistency with other
properties.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2168>
This commit is contained in:
Florian Müllner
2022-02-09 15:17:46 +01:00
committed by Marge Bot
parent 6a6b7eb341
commit 76e5e22dac
4 changed files with 77 additions and 28 deletions

View File

@ -210,6 +210,23 @@ st_scroll_view_update_fade_effect (StScrollView *scroll,
clutter_actor_queue_redraw (CLUTTER_ACTOR (scroll));
}
static void
st_scroll_view_set_content_padding (StScrollView *scroll,
ClutterMargin *content_padding)
{
StScrollViewPrivate *priv = ST_SCROLL_VIEW (scroll)->priv;
if (priv->content_padding.left == content_padding->left &&
priv->content_padding.right == content_padding->right &&
priv->content_padding.top == content_padding->top &&
priv->content_padding.bottom == content_padding->bottom)
return;
priv->content_padding = *content_padding;
g_object_notify_by_pspec (G_OBJECT (scroll), props[PROP_CONTENT_PADDING]);
}
static void
st_scroll_view_set_property (GObject *object,
guint property_id,
@ -240,7 +257,8 @@ st_scroll_view_set_property (GObject *object,
g_value_get_enum (value));
break;
case PROP_CONTENT_PADDING:
priv->content_padding = * (ClutterMargin *) g_value_get_boxed (value);
st_scroll_view_set_content_padding (self,
(ClutterMargin *)g_value_get_boxed (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);