[gnome-shell-extensions/gnome-3-14] window-list: Fix for "app-less" windows
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell-extensions/gnome-3-14] window-list: Fix for "app-less" windows
- Date: Mon, 23 Mar 2015 19:40:59 +0000 (UTC)
commit af14da57703204aed13e32545e5c007386a34483
Author: Florian Müllner <fmuellner gnome org>
Date: Fri Jan 23 15:41:33 2015 +0100
window-list: Fix for "app-less" windows
While rare, it is possible to have a window not associated with any app
(not even a fake window-based one). We currently throw an error when
trying to set the icon for such a window, so handle this case and
use a fallback icon instead of the app icon.
https://bugzilla.gnome.org/show_bug.cgi?id=743401
extensions/window-list/extension.js | 21 ++++++++++++++-------
1 files changed, 14 insertions(+), 7 deletions(-)
---
diff --git a/extensions/window-list/extension.js b/extensions/window-list/extension.js
index 424b14a..b22f8bf 100644
--- a/extensions/window-list/extension.js
+++ b/extensions/window-list/extension.js
@@ -142,19 +142,17 @@ const WindowTitle = new Lang.Class({
this._metaWindow = metaWindow;
this.actor = new St.BoxLayout({ style_class: 'window-button-box' });
- let app = Shell.WindowTracker.get_default().get_window_app(metaWindow);
- this._icon = new St.Bin({ style_class: 'window-button-icon',
- child: app.create_icon_texture(ICON_TEXTURE_SIZE) });
+ this._icon = new St.Bin({ style_class: 'window-button-icon' });
this.actor.add(this._icon);
this._label = new St.Label();
this.actor.add(this._label);
this._textureCache = St.TextureCache.get_default();
this._iconThemeChangedId =
- this._textureCache.connect('icon-theme-changed', Lang.bind(this,
- function() {
- this._icon.child = app.create_icon_texture(ICON_TEXTURE_SIZE);
- }));
+ this._textureCache.connect('icon-theme-changed',
+ Lang.bind(this, this._updateIcon));
+ this._updateIcon();
+
this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
this._notifyTitleId =
@@ -178,6 +176,15 @@ const WindowTitle = new Lang.Class({
this._label.text = this._metaWindow.title;
},
+ _updateIcon: function() {
+ let app = Shell.WindowTracker.get_default().get_window_app(this._metaWindow);
+ if (app)
+ this._icon.child = app.create_icon_texture(ICON_TEXTURE_SIZE);
+ else
+ this._icon.child = new St.Icon({ icon_name: 'icon-missing',
+ icon_size: ICON_TEXTURE_SIZE });
+ },
+
_onDestroy: function() {
this._textureCache.disconnect(this._iconThemeChangedId);
this._metaWindow.disconnect(this._notifyTitleId);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]