[gnome-shell] [StWidget] Cancel transitions if duration is zero



commit 0e40782723d10009c8c86849b160879d497ba4c0
Author: Florian Müllner <fmuellner gnome org>
Date:   Tue Jun 8 20:14:53 2010 +0200

    [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 files changed, 17 insertions(+), 9 deletions(-)
---
diff --git a/src/st/st-widget.c b/src/st/st-widget.c
index d905868..2a06766 100644
--- a/src/st/st-widget.c
+++ b/src/st/st-widget.c
@@ -221,6 +221,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)
 {
   StWidget *actor = ST_WIDGET (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;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]