[gnome-shell/wip/aggregate-menu: 25/75] 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: 25/75] popupMenu: Introduce a way of closing toplevels from sections
- Date: Mon, 1 Jul 2013 18:10:11 +0000 (UTC)
commit dc2c12238d31035e2bb6cc94e03917cb274799a6
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 28d1d26..7f41bac 100644
--- a/js/ui/popupMenu.js
+++ b/js/ui/popupMenu.js
@@ -746,6 +746,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
@@ -755,9 +762,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)
@@ -791,8 +798,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
@@ -1024,6 +1030,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]