wanda: fix a refactor fallout

load_sliced_image() would need an additional parameter, but fold the
notify::mapped callback into the load callback while we're at it.
This commit is contained in:
Cosimo Cecchi 2012-11-27 12:12:44 -05:00
parent b7b60d103e
commit 056cfc9dc6

View File

@ -53,18 +53,19 @@ const WandaIcon = new Lang.Class({
icon_size: iconSize });
}
this._animations = St.TextureCache.get_default().load_sliced_image(this._imageFile, this._imgWidth, this._imgHeight);
this._animations.connect('notify::mapped', Lang.bind(this, function() {
if (this._animations.mapped && !this._timeoutId) {
this._timeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, FISH_SPEED, Lang.bind(this, this._update));
this._animations = St.TextureCache.get_default().load_sliced_image(this._imageFile,
this._imgWidth, this._imgHeight, Lang.bind(this,
function() {
if (this._animations.mapped && !this._timeoutId) {
this._timeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, FISH_SPEED, Lang.bind(this, this._update));
this._i = 0;
this._update();
} else if (!this._animations.mapped && this._timeoutId) {
GLib.source_remove(this._timeoutId);
this._timeoutId = 0;
}
}));
this._i = 0;
this._update();
} else if (!this._animations.mapped && this._timeoutId) {
GLib.source_remove(this._timeoutId);
this._timeoutId = 0;
}
}));
return this._animations;
},