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
This commit is contained in:
Jasper St. Pierre 2013-06-11 19:12:46 -04:00
parent 263474705b
commit 5c036eadf9

View File

@ -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() {