[panel] Handle async load of icons correctly
Fading the application icon required the texture to have already been loaded, which was normally the case since we create icons for apps in the well and browser; but when finding an app not from there, the cogl-texture for the icon might not be available. Fix this by watching for the texture and fading when it appears. https://bugzilla.gnome.org/show_bug.cgi?id=611288
This commit is contained in:
parent
d56fbf6d6a
commit
ae3d1423e5
@ -152,12 +152,13 @@ AppPanelMenu.prototype = {
|
||||
this._activeSequence = null;
|
||||
this._startupSequences = {};
|
||||
|
||||
this.actor = new St.Bin({ name: 'appMenu', });
|
||||
this.actor = new St.Bin({ name: 'appMenu' });
|
||||
this._container = new Shell.GenericContainer();
|
||||
this.actor.set_child(this._container);
|
||||
this._container.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth));
|
||||
this._container.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight));
|
||||
this._container.connect('allocate', Lang.bind(this, this._allocate));
|
||||
this._sourceIcon = null;
|
||||
this._iconBox = new Shell.Slicer({ name: 'appMenuIcon' });
|
||||
this._container.add_actor(this._iconBox);
|
||||
this._label = new TextShadower();
|
||||
@ -263,9 +264,21 @@ AppPanelMenu.prototype = {
|
||||
} else {
|
||||
icon = null;
|
||||
}
|
||||
|
||||
|
||||
if (icon != null) {
|
||||
let faded = Shell.fade_app_icon(icon); /* TODO consider caching */
|
||||
if (this._sourceIcon != null)
|
||||
this._sourceIcon.destroy();
|
||||
this._sourceIcon = icon;
|
||||
let faded = Shell.fade_app_icon(icon);
|
||||
// Because loading the texture is async, we may not have it yet.
|
||||
// If we don't, just create an empty one for now.
|
||||
if (faded == null)
|
||||
faded = new Clutter.Texture({ width: AppDisplay.APPICON_SIZE,
|
||||
height: AppDisplay.APPICON_SIZE });
|
||||
this._sourceIcon.connect('notify::cogl-texture', Lang.bind(this, function () {
|
||||
faded = Shell.fade_app_icon(icon);
|
||||
this._iconBox.set_child(faded);
|
||||
}));
|
||||
this._iconBox.set_child(faded);
|
||||
this._iconBox.show();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user