st/scroll-view: Expose adjustments as properties
The adjustments are currently only accessible indirectly via the scroll bars. It is a bit odd to expose internal children, and as nearly all users only access them for the adjustments, it makes sense to expose those instead. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3020>
This commit is contained in:
parent
5b84967deb
commit
d243a9ba93
@ -99,6 +99,8 @@ enum {
|
||||
PROP_CHILD,
|
||||
PROP_HSCROLL,
|
||||
PROP_VSCROLL,
|
||||
PROP_HADJUSTMENT,
|
||||
PROP_VADJUSTMENT,
|
||||
PROP_HSCROLLBAR_POLICY,
|
||||
PROP_VSCROLLBAR_POLICY,
|
||||
PROP_HSCROLLBAR_VISIBLE,
|
||||
@ -131,6 +133,12 @@ st_scroll_view_get_property (GObject *object,
|
||||
case PROP_VSCROLL:
|
||||
g_value_set_object (value, priv->vscroll);
|
||||
break;
|
||||
case PROP_HADJUSTMENT:
|
||||
g_value_set_object (value, priv->hadjustment);
|
||||
break;
|
||||
case PROP_VADJUSTMENT:
|
||||
g_value_set_object (value, priv->vadjustment);
|
||||
break;
|
||||
case PROP_HSCROLLBAR_POLICY:
|
||||
g_value_set_enum (value, priv->hscrollbar_policy);
|
||||
break;
|
||||
@ -888,6 +896,30 @@ st_scroll_view_class_init (StScrollViewClass *klass)
|
||||
ST_TYPE_SCROLL_BAR,
|
||||
ST_PARAM_READABLE);
|
||||
|
||||
/**
|
||||
* StScrollView:hadjustment:
|
||||
*
|
||||
* The horizontal #StAdjustment for the #StScrollView.
|
||||
*/
|
||||
props[PROP_HADJUSTMENT] =
|
||||
g_param_spec_object ("hadjustment",
|
||||
"StAdjustment",
|
||||
"Horizontal scroll adjustment",
|
||||
ST_TYPE_ADJUSTMENT,
|
||||
ST_PARAM_READABLE);
|
||||
|
||||
/**
|
||||
* StScrollView:vadjustment:
|
||||
*
|
||||
* The vertical #StAdjustment for the #StScrollView.
|
||||
*/
|
||||
props[PROP_VADJUSTMENT] =
|
||||
g_param_spec_object ("vadjustment",
|
||||
"StAdjustment",
|
||||
"Vertical scroll adjustment",
|
||||
ST_TYPE_ADJUSTMENT,
|
||||
ST_PARAM_READABLE);
|
||||
|
||||
/**
|
||||
* StScrollView:vscrollbar-policy:
|
||||
*
|
||||
@ -1169,6 +1201,46 @@ st_scroll_view_get_vscroll_bar (StScrollView *scroll)
|
||||
return priv->vscroll;
|
||||
}
|
||||
|
||||
/**
|
||||
* st_scroll_view_get_hadjustment:
|
||||
* @scroll: a #StScrollView
|
||||
*
|
||||
* Gets the horizontal #StAdjustment of the #StScrollView.
|
||||
*
|
||||
* Returns: (transfer none): the horizontal adjustment
|
||||
*/
|
||||
StAdjustment *
|
||||
st_scroll_view_get_hadjustment (StScrollView *scroll)
|
||||
{
|
||||
StScrollViewPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (ST_IS_SCROLL_VIEW (scroll), NULL);
|
||||
|
||||
priv = st_scroll_view_get_instance_private (scroll);
|
||||
|
||||
return priv->hadjustment;
|
||||
}
|
||||
|
||||
/**
|
||||
* st_scroll_view_get_vadjustment:
|
||||
* @scroll: a #StScrollView
|
||||
*
|
||||
* Gets the vertical #StAdjustment of the #StScrollView.
|
||||
*
|
||||
* Returns: (transfer none): the vertical adjustment
|
||||
*/
|
||||
StAdjustment *
|
||||
st_scroll_view_get_vadjustment (StScrollView *scroll)
|
||||
{
|
||||
StScrollViewPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (ST_IS_SCROLL_VIEW (scroll), NULL);
|
||||
|
||||
priv = st_scroll_view_get_instance_private (scroll);
|
||||
|
||||
return priv->vadjustment;
|
||||
}
|
||||
|
||||
/**
|
||||
* st_scroll_view_get_column_size:
|
||||
* @scroll: a #StScrollView
|
||||
|
@ -56,6 +56,9 @@ void st_scroll_view_set_child (StScrollView *scroll,
|
||||
ClutterActor *st_scroll_view_get_hscroll_bar (StScrollView *scroll);
|
||||
ClutterActor *st_scroll_view_get_vscroll_bar (StScrollView *scroll);
|
||||
|
||||
StAdjustment *st_scroll_view_get_hadjustment (StScrollView *scroll);
|
||||
StAdjustment *st_scroll_view_get_vadjustment (StScrollView *scroll);
|
||||
|
||||
gfloat st_scroll_view_get_column_size (StScrollView *scroll);
|
||||
void st_scroll_view_set_column_size (StScrollView *scroll,
|
||||
gfloat column_size);
|
||||
|
Loading…
x
Reference in New Issue
Block a user