From 5c036eadf944cb06d792c0b5210e0928342a548a Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Tue, 11 Jun 2013 19:12:46 -0400 Subject: [PATCH] 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 file changed, 10 insertions(+) diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js index ce7f3cce3..c2bc99623 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() {