[gnome-shell-extensions] app-menu: Update icons on icon theme changes
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell-extensions] app-menu: Update icons on icon theme changes
- Date: Sun, 7 Apr 2013 19:12:10 +0000 (UTC)
commit 25be4d60b4f0fe0088cbbccf0c0bb9b6dc032c3e
Author: Florian Müllner <fmuellner gnome org>
Date: Sat Apr 6 01:55:11 2013 +0200
app-menu: Update icons on icon theme changes
https://bugzilla.gnome.org/show_bug.cgi?id=697400
extensions/apps-menu/extension.js | 17 +++++++++++++++--
1 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/extensions/apps-menu/extension.js b/extensions/apps-menu/extension.js
index 3c1bc22..05c930f 100644
--- a/extensions/apps-menu/extension.js
+++ b/extensions/apps-menu/extension.js
@@ -55,12 +55,21 @@ const ApplicationMenuItem = new Lang.Class({
this._app = app;
this._button = button;
- let icon = this._app.create_icon_texture(APPLICATION_ICON_SIZE);
- this.addActor(icon);
+ this._iconBin = new St.Bin();
+ this.addActor(this._iconBin);
let appLabel = new St.Label({ text: app.get_name() });
this.addActor(appLabel, { span: -1, expand: true });
this.actor.label_actor = appLabel;
+
+ let textureCache = St.TextureCache.get_default();
+ let iconThemeChangedId = textureCache.connect('icon-theme-changed',
+ Lang.bind(this, this._updateIcon));
+ this.actor.connect('destroy', Lang.bind(this,
+ function() {
+ textureCache.disconnect(iconThemeChangedId);
+ }));
+ this._updateIcon();
},
activate: function(event) {
@@ -78,6 +87,10 @@ const ApplicationMenuItem = new Lang.Class({
_getPreferredWidth: function(actor, forHeight, alloc) {
alloc.min_size = alloc.natural_size = -1;
+ },
+
+ _updateIcon: function() {
+ this._iconBin.set_child(this._app.create_icon_texture(APPLICATION_ICON_SIZE));
}
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]