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:
parent
263474705b
commit
5c036eadf9
@ -1005,6 +1005,14 @@ const PopupMenu = new Lang.Class({
|
|||||||
this.actor.reactive = true;
|
this.actor.reactive = true;
|
||||||
|
|
||||||
this._childMenus = [];
|
this._childMenus = [];
|
||||||
|
this._openedSubMenu = null;
|
||||||
|
},
|
||||||
|
|
||||||
|
_setOpenedSubMenu: function(submenu) {
|
||||||
|
if (this._openedSubMenu)
|
||||||
|
this._openedSubMenu.close(true);
|
||||||
|
|
||||||
|
this._openedSubMenu = submenu;
|
||||||
},
|
},
|
||||||
|
|
||||||
_boxGetPreferredWidth: function (actor, forHeight, alloc) {
|
_boxGetPreferredWidth: function (actor, forHeight, alloc) {
|
||||||
@ -1299,6 +1307,8 @@ const PopupSubMenuMenuItem = new Lang.Class({
|
|||||||
this.actor.add_style_pseudo_class('open');
|
this.actor.add_style_pseudo_class('open');
|
||||||
else
|
else
|
||||||
this.actor.remove_style_pseudo_class('open');
|
this.actor.remove_style_pseudo_class('open');
|
||||||
|
|
||||||
|
this._getTopMenu()._setOpenedSubMenu(this.menu);
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function() {
|
destroy: function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user