[gnome-shell/wip/aggregate-menu: 12/62] popupMenu: Introduce a way of closing toplevels from sections
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/aggregate-menu: 12/62] popupMenu: Introduce a way of closing toplevels from sections
- Date: Sun, 23 Jun 2013 00:14:44 +0000 (UTC)
commit 92364cca1e7f72903e0967790faf6d38cbcecb98
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Tue Jun 18 04:46:44 2013 -0400
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
js/ui/popupMenu.js | 20 +++++++++++++++-----
js/ui/userMenu.js | 6 +++---
2 files changed, 18 insertions(+), 8 deletions(-)
---
diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js
index 3332fe9..d96103f 100644
--- a/js/ui/popupMenu.js
+++ b/js/ui/popupMenu.js
@@ -742,6 +742,13 @@ const PopupMenuBase = new Lang.Class({
return false;
},
+ itemActivated: function(animate) {
+ if (animate == undefined)
+ animate = BoxPointer.PopupAnimation.FULL;
+
+ this.emit('activate', animate);
+ },
+
/**
* _connectSubMenuSignals:
* @object: a menu item, or a menu section
@@ -751,9 +758,9 @@ const PopupMenuBase = new Lang.Class({
* operating the submenu, and stores the ids on @object.
*/
_connectSubMenuSignals: function(object, menu) {
- object._subMenuActivateId = menu.connect('activate', Lang.bind(this, function() {
- this.emit('activate');
- this.close(BoxPointer.PopupAnimation.FULL);
+ object._subMenuActivateId = menu.connect('activate', Lang.bind(this, function(animate) {
+ this.emit('activate', animate);
+ this.close(animate);
}));
object._subMenuActiveChangeId = menu.connect('active-changed', Lang.bind(this, function(submenu,
submenuItem) {
if (this._activeMenuItem && this._activeMenuItem != submenuItem)
@@ -787,8 +794,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.emit('activate', BoxPointer.PopupAnimation.FULL);
}));
// the weird name is to avoid a conflict with some random property
// the menuItem may have, called destroyId
@@ -1020,6 +1026,10 @@ const PopupMenu = new Lang.Class({
this.actor.reactive = true;
this._childMenus = [];
+
+ this.connect('activate', Lang.bind(this, function(self, animate) {
+ this.close(animate);
+ }));
},
_boxGetPreferredWidth: function (actor, forHeight, alloc) {
diff --git a/js/ui/userMenu.js b/js/ui/userMenu.js
index 86980c5..68a300a 100644
--- a/js/ui/userMenu.js
+++ b/js/ui/userMenu.js
@@ -803,13 +803,13 @@ const UserMenuButton = new Lang.Class({
},
_onLockScreenActivate: function() {
- this.menu.close(BoxPointer.PopupAnimation.NONE);
+ this.menu.itemActivated(BoxPointer.PopupAnimation.NONE);
Main.overview.hide();
Main.screenShield.lock(true);
},
_onLoginScreenActivate: function() {
- this.menu.close(BoxPointer.PopupAnimation.NONE);
+ this.menu.itemActivated(BoxPointer.PopupAnimation.NONE);
Main.overview.hide();
if (Main.screenShield)
Main.screenShield.lock(false);
@@ -937,7 +937,7 @@ const UserMenuButton = new Lang.Class({
this._session.ShutdownRemote();
}));
} else {
- this.menu.close(BoxPointer.PopupAnimation.NONE);
+ this.menu.itemActivated(BoxPointer.PopupAnimation.NONE);
this._loginManager.suspend();
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]