diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js index a75d75075..5b48d5e6e 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) {