[appWellIcon] Set correct style in constructor

Currently, only the base style class is set in the constructor, the
style update according to the state of the represented app is deferred
until the actor is shown.

As existing icons are destroyed and recreated when the number of icons
changes, this behavior causes the icons of running apps to flicker if
CSS transitions are used.

Set the style directly in the constructor and update the code to not
delay style updates until the actor is shown - StWidget does defer
expensive calculations until the actor is mapped anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=620782
This commit is contained in:
Florian Müllner 2010-06-06 00:35:26 +02:00
parent d96d07af10
commit dad80b3d20

View File

@ -470,24 +470,19 @@ AppWellIcon.prototype = {
})); }));
this.actor.connect('button-press-event', Lang.bind(this, this._onButtonPress)); this.actor.connect('button-press-event', Lang.bind(this, this._onButtonPress));
this.actor.connect('show', Lang.bind(this, this._onShow)); this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
this.actor.connect('hide', Lang.bind(this, this._onHideDestroy));
this.actor.connect('destroy', Lang.bind(this, this._onHideDestroy));
this._stateChangedId = 0;
this._menuTimeoutId = 0; this._menuTimeoutId = 0;
},
_onShow: function() {
this._stateChangedId = this.app.connect('notify::state', this._stateChangedId = this.app.connect('notify::state',
Lang.bind(this, Lang.bind(this,
this._onStateChanged)); this._onStateChanged));
this._onStateChanged(); this._onStateChanged();
}, },
_onHideDestroy: function() { _onDestroy: function() {
if (this._stateChangedId > 0) if (this._stateChangedId > 0)
this.app.disconnect(this._stateChangedId); this.app.disconnect(this._stateChangedId);
this._stateChangedId = 0;
this._removeMenuTimeout(); this._removeMenuTimeout();
}, },