[gnome-boxes/gnome-3-8] util: Use explicit transition for fading actors



commit c5bd0fe92e3a26d1d74309c1fc9fe6152a85f48e
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Tue May 14 18:02:46 2013 +0300

    util: Use explicit transition for fading actors
    
    As strongly suggested by ebassi on IRC:
    
    <ebassi> [19:34:50] zeenix: and I would *strongly* suggest you use a
    proper ClutterTransition in this case, instead of relying on implicit
    animations, since you're controlling the start and end states, and you
    want to get notifications
    
    Besides being the right thing to do here, this also works around the issue of
    Boxes unable to change the actor visibility at the end of transition and
    avoid the warning on console about transition being null against clutter
    1.16 in certain cases.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=700306
    
    Conflicts:
        src/util-app.vala

 src/util-app.vala |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/src/util-app.vala b/src/util-app.vala
index ae184be..0370b0c 100644
--- a/src/util-app.vala
+++ b/src/util-app.vala
@@ -109,6 +109,8 @@ 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 ();
@@ -116,21 +118,18 @@ namespace Boxes {
         // Don't react to use input while fading out
         actor.set_reactive (opacity == 255);
 
-        var transition = actor.get_transition ("animate-opacity");
-        if (transition != null)
-            actor.remove_transition ("animate-opacity");
-
-        transition = new Clutter.PropertyTransition ("opacity");
+        var 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 ("animate-opacity");
+            actor.remove_transition (name);
             actor.visible = actor.opacity != 0;
         });
-        actor.add_transition ("animate-opacity", transition);
+        actor.add_transition (name, transition);
     }
 
     public delegate void ActorFunc (Clutter.Actor actor);


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