[gnome-shell/wip/aggregate-menu: 11/51] system: Don't use this.menu.close() to close the menu
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/aggregate-menu: 11/51] system: Don't use this.menu.close() to close the menu
- Date: Sun, 16 Jun 2013 05:00:12 +0000 (UTC)
commit 49ab7cd1e4f8bbed33eea85a6ecc620330f6d417
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Fri Jun 14 15:23:48 2013 -0400
system: Don't use this.menu.close() to close the menu
This will not work with the aggregate menu.
js/ui/popupMenu.js | 20 +++++++++++++++-----
js/ui/status/system.js | 6 +++---
2 files changed, 18 insertions(+), 8 deletions(-)
---
diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js
index 2de6a04..c748d6e 100644
--- a/js/ui/popupMenu.js
+++ b/js/ui/popupMenu.js
@@ -688,6 +688,10 @@ const PopupMenuBase = new Lang.Class({
this._settingsActions = { };
this._sessionUpdatedId = Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated));
+
+ this.connect('activate', Lang.bind(this, function(self, animate) {
+ this.close(animate);
+ }));
},
_sessionUpdated: function() {
@@ -742,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
@@ -751,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)
@@ -787,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
diff --git a/js/ui/status/system.js b/js/ui/status/system.js
index 25c74ad..611b3a4 100644
--- a/js/ui/status/system.js
+++ b/js/ui/status/system.js
@@ -226,20 +226,20 @@ const Indicator = new Lang.Class({
},
_onSettingsClicked: function() {
- this.menu.close(BoxPointer.PopupAnimation.FULL);
+ this.menu.itemActivated();
let app = Shell.AppSystem.get_default().lookup_app('gnome-control-center.desktop');
Main.overview.hide();
app.activate();
},
_onLockScreenClicked: 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]