popupMenu: Introduce a way of closing toplevels from sections
As the aggregate menu will be built out of sections from each of the menus, we need to ensure that activating an item in one of these sections can close the main menu, even when it is not a menu item. The new API also needs to be flexible enough to ensure that animations can be controlled, like the buttons that lock the screen or launch a new session. Port the user menu to use this new API as well. https://bugzilla.gnome.org/show_bug.cgi?id=702539
This commit is contained in:
@ -754,6 +754,13 @@ const PopupMenuBase = new Lang.Class({
|
||||
return false;
|
||||
},
|
||||
|
||||
itemActivated: function(animate) {
|
||||
if (animate == undefined)
|
||||
animate = BoxPointer.PopupAnimation.FULL;
|
||||
|
||||
this._getTopMenu().close(animate);
|
||||
},
|
||||
|
||||
/**
|
||||
* _connectSubMenuSignals:
|
||||
* @object: a menu item, or a menu section
|
||||
@ -800,7 +807,7 @@ const PopupMenuBase = new Lang.Class({
|
||||
}));
|
||||
menuItem._activateId = menuItem.connect('activate', Lang.bind(this, function (menuItem, event) {
|
||||
this.emit('activate', menuItem);
|
||||
this.close(BoxPointer.PopupAnimation.FULL);
|
||||
this.itemActivated(BoxPointer.PopupAnimation.FULL);
|
||||
}));
|
||||
// the weird name is to avoid a conflict with some random property
|
||||
// the menuItem may have, called destroyId
|
||||
|
Reference in New Issue
Block a user