popupMenu: Move child menus to be a PopupMenu-only thing

It doesn't make sense for combo menus, sections, or submenus
to have child menus.

https://bugzilla.gnome.org/show_bug.cgi?id=693572
This commit is contained in:
Jasper St. Pierre 2013-02-16 13:42:17 -05:00
parent 44e4cbf04a
commit c9783b38c4

View File

@ -867,7 +867,6 @@ const PopupMenuBase = new Lang.Class({
this.blockSourceEvents = false; this.blockSourceEvents = false;
this._activeMenuItem = null; this._activeMenuItem = null;
this._childMenus = [];
this._settingsActions = { }; this._settingsActions = { };
this._sessionUpdatedId = Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated)); this._sessionUpdatedId = Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated));
@ -921,26 +920,8 @@ const PopupMenuBase = new Lang.Class({
return !hasVisibleChildren; return !hasVisibleChildren;
}, },
isChildMenu: function(menu) { isChildMenu: function() {
return this._childMenus.indexOf(menu) != -1; return false;
},
addChildMenu: function(menu) {
if (this.isChildMenu(menu))
return;
this._childMenus.push(menu);
this.emit('child-menu-added', menu);
},
removeChildMenu: function(menu) {
let index = this._childMenus.indexOf(menu);
if (index == -1)
return;
this._childMenus.splice(index, 1);
this.emit('child-menu-removed', menu);
}, },
/** /**
@ -1215,6 +1196,8 @@ const PopupMenu = new Lang.Class({
global.focus_manager.add_group(this.actor); global.focus_manager.add_group(this.actor);
this.actor.reactive = true; this.actor.reactive = true;
this._childMenus = [];
}, },
_boxGetPreferredWidth: function (actor, forHeight, alloc) { _boxGetPreferredWidth: function (actor, forHeight, alloc) {
@ -1241,6 +1224,28 @@ const PopupMenu = new Lang.Class({
this._boxPointer.setSourceAlignment(alignment); this._boxPointer.setSourceAlignment(alignment);
}, },
isChildMenu: function(menu) {
return this._childMenus.indexOf(menu) != -1;
},
addChildMenu: function(menu) {
if (this.isChildMenu(menu))
return;
this._childMenus.push(menu);
this.emit('child-menu-added', menu);
},
removeChildMenu: function(menu) {
let index = this._childMenus.indexOf(menu);
if (index == -1)
return;
this._childMenus.splice(index, 1);
this.emit('child-menu-removed', menu);
},
open: function(animate) { open: function(animate) {
if (this.isOpen) if (this.isOpen)
return; return;