st: Make st_scroll_view_update_fade_effect() public

Using fixed fade offsets is not always appropriate, this will allow
to set them from code instead.

https://bugzilla.gnome.org/show_bug.cgi?id=707409
This commit is contained in:
Florian Müllner 2013-09-04 13:28:31 +02:00
parent b403845d03
commit 6fb044f351
2 changed files with 10 additions and 7 deletions

View File

@ -160,19 +160,19 @@ st_scroll_view_get_property (GObject *object,
/** /**
* st_scroll_view_update_fade_effect: * st_scroll_view_update_fade_effect:
* @self: a #StScrollView * @scroll: a #StScrollView
* @vfade_offset: The length of the veritcal fade effect, in pixels. * @vfade_offset: The length of the veritcal fade effect, in pixels.
* @hfade_offset: The length of the horizontal fade effect, in pixels. * @hfade_offset: The length of the horizontal fade effect, in pixels.
* *
* Sets the height of the fade area area in pixels. A value of 0 * Sets the height of the fade area area in pixels. A value of 0
* disables the effect. * disables the effect.
*/ */
static void void
st_scroll_view_update_fade_effect (StScrollView *self, st_scroll_view_update_fade_effect (StScrollView *scroll,
float vfade_offset, float vfade_offset,
float hfade_offset) float hfade_offset)
{ {
StScrollViewPrivate *priv = ST_SCROLL_VIEW (self)->priv; StScrollViewPrivate *priv = ST_SCROLL_VIEW (scroll)->priv;
/* A fade amount of more than 0 enables the effect. */ /* A fade amount of more than 0 enables the effect. */
if (vfade_offset > 0. || hfade_offset > 0.) if (vfade_offset > 0. || hfade_offset > 0.)
@ -180,7 +180,7 @@ st_scroll_view_update_fade_effect (StScrollView *self,
if (priv->fade_effect == NULL) { if (priv->fade_effect == NULL) {
priv->fade_effect = g_object_new (ST_TYPE_SCROLL_VIEW_FADE, NULL); priv->fade_effect = g_object_new (ST_TYPE_SCROLL_VIEW_FADE, NULL);
clutter_actor_add_effect_with_name (CLUTTER_ACTOR (self), "fade", clutter_actor_add_effect_with_name (CLUTTER_ACTOR (scroll), "fade",
CLUTTER_EFFECT (priv->fade_effect)); CLUTTER_EFFECT (priv->fade_effect));
} }
@ -194,12 +194,12 @@ st_scroll_view_update_fade_effect (StScrollView *self,
else else
{ {
if (priv->fade_effect != NULL) { if (priv->fade_effect != NULL) {
clutter_actor_remove_effect (CLUTTER_ACTOR (self), CLUTTER_EFFECT (priv->fade_effect)); clutter_actor_remove_effect (CLUTTER_ACTOR (scroll), CLUTTER_EFFECT (priv->fade_effect));
priv->fade_effect = NULL; priv->fade_effect = NULL;
} }
} }
clutter_actor_queue_redraw (CLUTTER_ACTOR (self)); clutter_actor_queue_redraw (CLUTTER_ACTOR (scroll));
} }
static void static void

View File

@ -87,6 +87,9 @@ gboolean st_scroll_view_get_overlay_scrollbars (StScrollView *scroll);
void st_scroll_view_set_policy (StScrollView *scroll, void st_scroll_view_set_policy (StScrollView *scroll,
GtkPolicyType hscroll, GtkPolicyType hscroll,
GtkPolicyType vscroll); GtkPolicyType vscroll);
void st_scroll_view_update_fade_effect (StScrollView *scroll,
float vfade_offset,
float hfade_offset);
G_END_DECLS G_END_DECLS