[gnome-boxes/gnome-3-8] util: Remove existing transition before adding new one



commit 2de72b3bd653b03a09f4b3c2e1f863278e70fafc
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Mon Jun 10 22:57:41 2013 +0300

    util: Remove existing transition before adding new one
    
    Before starting an opacity animation, ensure that there isn't one
    already scheduled.
    
    This patch fixes at least two cases of actors not showing-up:
    
    1. When right-clicking on an item in collection view: overlay bar
    doesn't become visible.
    2. When launching Boxes with installer media argument: you end up in the
    wizard but with main wizard area invisible.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=701635

 src/util-app.vala |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/src/util-app.vala b/src/util-app.vala
index 0370b0c..ae184be 100644
--- a/src/util-app.vala
+++ b/src/util-app.vala
@@ -109,8 +109,6 @@ namespace Boxes {
         actor.set_easing_duration (old_duration);
     }
 
-    private uint transition_index = 0;
-
     public void fade_actor (Clutter.Actor actor, uint opacity) {
         if (opacity != 0)
             actor.show ();
@@ -118,18 +116,21 @@ namespace Boxes {
         // Don't react to use input while fading out
         actor.set_reactive (opacity == 255);
 
-        var transition = new Clutter.PropertyTransition ("opacity");
+        var transition = actor.get_transition ("animate-opacity");
+        if (transition != null)
+            actor.remove_transition ("animate-opacity");
+
+        transition = new Clutter.PropertyTransition ("opacity");
         var value = GLib.Value (typeof (uint));
         value.set_uint (opacity);
         transition.set_to_value (value);
         transition.set_duration (App.app.duration);
         transition.set_progress_mode (Clutter.AnimationMode.EASE_OUT_QUAD);
-        var name = "opacity%u".printf (transition_index++);
         transition.completed.connect (() => {
-            actor.remove_transition (name);
+            actor.remove_transition ("animate-opacity");
             actor.visible = actor.opacity != 0;
         });
-        actor.add_transition (name, transition);
+        actor.add_transition ("animate-opacity", transition);
     }
 
     public delegate void ActorFunc (Clutter.Actor actor);


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