Revert "panel: programmatic anim. control of AnimatedIcon"

This reverts commit e04a4c3923.

This commit exposed an already-existing race condition in the panel
animation code that caused the shell to crash for some people.

https://bugzilla.gnome.org/show_bug.cgi?id=687112
This commit is contained in:
Jasper St. Pierre 2012-11-05 14:31:04 -05:00
parent 025c63c045
commit d88002c4ed

View File

@ -82,27 +82,28 @@ const AnimatedIcon = new Lang.Class({
_init: function(name, size) { _init: function(name, size) {
this.actor = new St.Bin({ visible: false }); this.actor = new St.Bin({ visible: false });
this.actor.connect('destroy', Lang.bind(this, this._onDestroy)); this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
this.actor.connect('notify::visible', Lang.bind(this, this._onVisibleNotify));
this._timeoutId = 0; this._timeoutId = 0;
this._frame = 0; this._frame = 0;
this._animations = St.TextureCache.get_default().load_sliced_image (global.datadir + '/theme/' + name, size, size); this._animations = St.TextureCache.get_default().load_sliced_image (global.datadir + '/theme/' + name, size, size);
this.actor.set_child(this._animations); this.actor.set_child(this._animations);
this._update();
}, },
start: function() { _disconnectTimeout: function() {
if (this._timeoutId == 0)
this._timeoutId = Mainloop.timeout_add(ANIMATED_ICON_UPDATE_TIMEOUT, Lang.bind(this, this._update));
},
stop: function() {
if (this._timeoutId > 0) { if (this._timeoutId > 0) {
Mainloop.source_remove(this._timeoutId); Mainloop.source_remove(this._timeoutId);
this._timeoutId = 0; this._timeoutId = 0;
} }
}, },
_onVisibleNotify: function() {
if (this.actor.visible)
this._timeoutId = Mainloop.timeout_add(ANIMATED_ICON_UPDATE_TIMEOUT, Lang.bind(this, this._update));
else
this._disconnectTimeout();
},
_showFrame: function(frame) { _showFrame: function(frame) {
let oldFrameActor = this._animations.get_child_at_index(this._frame); let oldFrameActor = this._animations.get_child_at_index(this._frame);
if (oldFrameActor) if (oldFrameActor)
@ -121,7 +122,7 @@ const AnimatedIcon = new Lang.Class({
}, },
_onDestroy: function() { _onDestroy: function() {
this.stop(); this._disconnectTimeout();
} }
}); });
@ -366,7 +367,6 @@ const AppMenuButton = new Lang.Class({
transition: "easeOutQuad", transition: "easeOutQuad",
onCompleteScope: this, onCompleteScope: this,
onComplete: function() { onComplete: function() {
this._spinner.stop();
this._spinner.actor.opacity = 255; this._spinner.actor.opacity = 255;
this._spinner.actor.hide(); this._spinner.actor.hide();
} }
@ -376,7 +376,6 @@ const AppMenuButton = new Lang.Class({
startAnimation: function() { startAnimation: function() {
this._stop = false; this._stop = false;
this.actor.reactive = false; this.actor.reactive = false;
this._spinner.start();
this._spinner.actor.show(); this._spinner.actor.show();
}, },