summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Müllner <fmuellner@gnome.org>2016-01-22 15:11:05 +0100
committerFlorian Müllner <fmuellner@gnome.org>2018-02-23 10:47:20 +0100
commitfe0ecbcb83c4680ae3a244e27e75f539c8b8abf6 (patch)
tree5922ea3d01af3142290c825289ff6fd174a44c38
parent822875d5c30632efd90cb97ec2be6ec83da22385 (diff)
downloadgnome-shell-wip/fmuellner/remote-menu-icons.tar.gz
remoteMenu: Support icons in app-menuwip/fmuellner/remote-menu-icons
The HIG discourages the use of icons in menus except for "noun" items (files, bookmarks, ...). While those should be rarely used in the application menu, it still makes sense to support them in the few cases where they are used. https://bugzilla.gnome.org/show_bug.cgi?id=760985
-rw-r--r--js/ui/remoteMenu.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/js/ui/remoteMenu.js b/js/ui/remoteMenu.js
index 848ab7537..78a2e2934 100644
--- a/js/ui/remoteMenu.js
+++ b/js/ui/remoteMenu.js
@@ -119,6 +119,9 @@ var RemoteMenuItemMapper = new Lang.Class({
this._trackerItem = trackerItem;
this.menuItem = new PopupMenu.PopupBaseMenuItem();
+ this._icon = new St.Icon({ style_class: 'popup-menu-icon' });
+ this.menuItem.actor.add_child(this._icon);
+
this._label = new St.Label();
this.menuItem.actor.add_child(this._label);
this.menuItem.actor.label_actor = this._label;
@@ -129,11 +132,13 @@ var RemoteMenuItemMapper = new Lang.Class({
this._trackerItem.bind_property('visible', this.menuItem.actor, 'visible', GObject.BindingFlags.SYNC_CREATE);
+ this._trackerItem.connect('notify::icon', this._updateIcon.bind(this));
this._trackerItem.connect('notify::label', this._updateLabel.bind(this));
this._trackerItem.connect('notify::sensitive', this._updateSensitivity.bind(this));
this._trackerItem.connect('notify::role', this._updateRole.bind(this));
this._trackerItem.connect('notify::toggled', this._updateDecoration.bind(this));
+ this._updateIcon();
this._updateLabel();
this._updateSensitivity();
this._updateRole();
@@ -143,6 +148,11 @@ var RemoteMenuItemMapper = new Lang.Class({
});
},
+ _updateIcon() {
+ this._icon.gicon = this._trackerItem.icon;
+ this._icon.visible = (this._icon.gicon != null);
+ },
+
_updateLabel() {
this._label.text = stripMnemonics(this._trackerItem.label);
},