[gnome-shell] popupMenu: Allow specifying an icon on PopupMenuBase.addAction()
- From: Mario Sanchez Prada <msanchez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] popupMenu: Allow specifying an icon on PopupMenuBase.addAction()
- Date: Tue, 9 May 2017 17:34:31 +0000 (UTC)
commit e38c26894be3719fd502199b770985d6182e28a0
Author: Mario Sanchez Prada <mario endlessm com>
Date: Mon May 8 11:38:16 2017 +0100
popupMenu: Allow specifying an icon on PopupMenuBase.addAction()
This allows passing an optional icon parameter to addAction()
so that a PopupImageMenuItem instance is created instead of a
PopupMenuItem if an icon is specified.
https://bugzilla.gnome.org/show_bug.cgi?id=782166
js/ui/popupMenu.js | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js
index 53ab7c1..17a5a91 100644
--- a/js/ui/popupMenu.js
+++ b/js/ui/popupMenu.js
@@ -467,8 +467,13 @@ const PopupMenuBase = new Lang.Class({
this._setSettingsVisibility(Main.sessionMode.allowSettings);
},
- addAction: function(title, callback) {
- let menuItem = new PopupMenuItem(title);
+ addAction: function(title, callback, icon) {
+ let menuItem;
+ if (icon != undefined)
+ menuItem = new PopupImageMenuItem(title, icon);
+ else
+ menuItem = new PopupMenuItem(title);
+
this.addMenuItem(menuItem);
menuItem.connect('activate', Lang.bind(this, function (menuItem, event) {
callback(event);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]