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
This commit is contained in:
parent
28ca96064b
commit
e38c26894b
@ -467,8 +467,13 @@ const PopupMenuBase = new Lang.Class({
|
|||||||
this._setSettingsVisibility(Main.sessionMode.allowSettings);
|
this._setSettingsVisibility(Main.sessionMode.allowSettings);
|
||||||
},
|
},
|
||||||
|
|
||||||
addAction: function(title, callback) {
|
addAction: function(title, callback, icon) {
|
||||||
let menuItem = new PopupMenuItem(title);
|
let menuItem;
|
||||||
|
if (icon != undefined)
|
||||||
|
menuItem = new PopupImageMenuItem(title, icon);
|
||||||
|
else
|
||||||
|
menuItem = new PopupMenuItem(title);
|
||||||
|
|
||||||
this.addMenuItem(menuItem);
|
this.addMenuItem(menuItem);
|
||||||
menuItem.connect('activate', Lang.bind(this, function (menuItem, event) {
|
menuItem.connect('activate', Lang.bind(this, function (menuItem, event) {
|
||||||
callback(event);
|
callback(event);
|
||||||
|
Loading…
Reference in New Issue
Block a user