[gnome-shell] popupMenu: Only allow one submenu to be open at a time



commit 5c036eadf944cb06d792c0b5210e0928342a548a
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Tue Jun 11 19:12:46 2013 -0400

    popupMenu: Only allow one submenu to be open at a time
    
    When the user opens another submenu, close the first one.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=702539

 js/ui/popupMenu.js |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js
index ce7f3cc..c2bc996 100644
--- a/js/ui/popupMenu.js
+++ b/js/ui/popupMenu.js
@@ -1005,6 +1005,14 @@ const PopupMenu = new Lang.Class({
         this.actor.reactive = true;
 
         this._childMenus = [];
+        this._openedSubMenu = null;
+    },
+
+    _setOpenedSubMenu: function(submenu) {
+        if (this._openedSubMenu)
+            this._openedSubMenu.close(true);
+
+        this._openedSubMenu = submenu;
     },
 
     _boxGetPreferredWidth: function (actor, forHeight, alloc) {
@@ -1299,6 +1307,8 @@ const PopupSubMenuMenuItem = new Lang.Class({
             this.actor.add_style_pseudo_class('open');
         else
             this.actor.remove_style_pseudo_class('open');
+
+        this._getTopMenu()._setOpenedSubMenu(this.menu);
     },
 
     destroy: function() {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]