[gnome-shell] popup-menu: Add minimal handling of open/close to Sections
- From: Florian MÃllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] popup-menu: Add minimal handling of open/close to Sections
- Date: Thu, 3 Nov 2011 14:38:48 +0000 (UTC)
commit 398489f66156aee753c3658b918533d06b517da3
Author: Florian MÃllner <fmuellner gnome org>
Date: Fri Oct 7 20:17:44 2011 +0200
popup-menu: Add minimal handling of open/close to Sections
SubMenuMenuItems close automatically with their parent, however
closing fails when the parent item is a MenuSection, as those
currently ignore any open()/close() requests.
At some minimal handling by emitting the 'open-state-changed' signal,
so children like SubMenuMenuItems work as expected.
https://bugzilla.gnome.org/show_bug.cgi?id=661029
js/ui/popupMenu.js | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js
index 2b5a3d9..e5e9921 100644
--- a/js/ui/popupMenu.js
+++ b/js/ui/popupMenu.js
@@ -1019,6 +1019,11 @@ PopupMenuBase.prototype = {
}
if (menuItem instanceof PopupMenuSection) {
this._connectSubMenuSignals(menuItem, menuItem);
+ menuItem._closingId = this.connect('open-state-changed',
+ function(self, open) {
+ if (!open)
+ menuItem.close(false);
+ });
menuItem.connect('destroy', Lang.bind(this, function() {
menuItem.disconnect(menuItem._subMenuActivateId);
menuItem.disconnect(menuItem._subMenuActiveChangeId);
@@ -1418,9 +1423,10 @@ PopupMenuSection.prototype = {
this.isOpen = true;
},
- // deliberately ignore any attempt to open() or close()
- open: function(animate) { },
- close: function() { },
+ // deliberately ignore any attempt to open() or close(), but emit the
+ // corresponding signal so children can still pick it up
+ open: function(animate) { this.emit('open-state-changed', true); },
+ close: function() { this.emit('open-state-changed', false); },
}
function PopupSubMenuMenuItem() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]