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
This commit is contained in:
parent
e661d904de
commit
09e6bb5d56
@ -210,6 +210,14 @@ const BaseAppView = new Lang.Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
animate: function(animationDirection, onComplete) {
|
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) {
|
if (animationDirection == IconGrid.AnimationDirection.IN) {
|
||||||
let toAnimate = this._grid.actor.connect('notify::allocation', Lang.bind(this,
|
let toAnimate = this._grid.actor.connect('notify::allocation', Lang.bind(this,
|
||||||
function() {
|
function() {
|
||||||
@ -225,14 +233,6 @@ const BaseAppView = new Lang.Class({
|
|||||||
} else {
|
} else {
|
||||||
this._doSpringAnimation(animationDirection);
|
this._doSpringAnimation(animationDirection);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (onComplete) {
|
|
||||||
let animationDoneId = this._grid.connect('animation-done', Lang.bind(this,
|
|
||||||
function () {
|
|
||||||
this._grid.disconnect(animationDoneId);
|
|
||||||
onComplete();
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
animateSwitch: function(animationDirection) {
|
animateSwitch: function(animationDirection) {
|
||||||
|
Loading…
Reference in New Issue
Block a user