[gnome-shell] appDisplay: Fix completion handler for empty animations



commit 09e6bb5d5660956049d63ba67b4320374a0b20f4
Author: Xiaoguang Wang <xwang suse com>
Date:   Fri Nov 18 16:00:01 2016 +0800

    appDisplay: Fix completion handler for empty animations
    
    If an onComplete handler is passed to animate(), it is set to run at
    the end of the animation via the icon grid's ::animation-done signal.
    Currently the signal is connected after starting the animation, with
    the result that the handler doesn't run when the animation completes
    immediately (because there are no icons to animate). Fix this by only
    starting the animation after connecting the signal.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=774381

 js/ui/appDisplay.js |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index a75d750..5b48d5e 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -210,6 +210,14 @@ const BaseAppView = new Lang.Class({
     },
 
     animate: function(animationDirection, onComplete) {
+        if (onComplete) {
+            let animationDoneId = this._grid.connect('animation-done', Lang.bind(this,
+                function () {
+                    this._grid.disconnect(animationDoneId);
+                    onComplete();
+            }));
+        }
+
         if (animationDirection == IconGrid.AnimationDirection.IN) {
             let toAnimate = this._grid.actor.connect('notify::allocation', Lang.bind(this,
                 function() {
@@ -225,14 +233,6 @@ const BaseAppView = new Lang.Class({
         } else {
             this._doSpringAnimation(animationDirection);
         }
-
-        if (onComplete) {
-            let animationDoneId = this._grid.connect('animation-done', Lang.bind(this,
-                function () {
-                    this._grid.disconnect(animationDoneId);
-                    onComplete();
-            }));
-        }
     },
 
     animateSwitch: function(animationDirection) {


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