From 0e40782723d10009c8c86849b160879d497ba4c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Tue, 8 Jun 2010 20:14:53 +0200 Subject: [PATCH] [StWidget] Cancel transitions if duration is zero The current code only sets up / updates transitions when the new node's transition-duration is non-zero. It should cancel an existing transition if the duration is 0. --- src/st/st-widget.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/st/st-widget.c b/src/st/st-widget.c index d90586826..2a0676687 100644 --- a/src/st/st-widget.c +++ b/src/st/st-widget.c @@ -220,6 +220,17 @@ st_widget_get_property (GObject *gobject, } } +static void +st_widget_remove_transition (StWidget *widget) +{ + if (widget->priv->transition_animation) + { + g_object_run_dispose (G_OBJECT (widget->priv->transition_animation)); + g_object_unref (widget->priv->transition_animation); + widget->priv->transition_animation = NULL; + } +} + static void st_widget_dispose (GObject *gobject) { @@ -239,12 +250,7 @@ st_widget_dispose (GObject *gobject) priv->theme_node = NULL; } - if (priv->transition_animation) - { - g_object_run_dispose (G_OBJECT (priv->transition_animation)); - g_object_unref (priv->transition_animation); - priv->transition_animation = NULL; - } + st_widget_remove_transition (actor); if (priv->tooltip) { @@ -1213,9 +1219,7 @@ static void on_transition_completed (StThemeNodeTransition *transition, StWidget *widget) { - g_object_run_dispose (G_OBJECT (widget->priv->transition_animation)); - g_object_unref (widget->priv->transition_animation); - widget->priv->transition_animation = NULL; + st_widget_remove_transition (widget); } static void @@ -1253,6 +1257,10 @@ st_widget_recompute_style (StWidget *widget, widget); } } + else if (widget->priv->transition_animation) + { + st_widget_remove_transition (widget); + } g_signal_emit (widget, signals[STYLE_CHANGED], 0); widget->priv->is_style_dirty = FALSE;