[gnome-shell/wip/aggregate-menu: 2/57] popupMenu: Fix parenting implementation
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/aggregate-menu: 2/57] popupMenu: Fix parenting implementation
- Date: Wed, 17 Jul 2013 06:35:13 +0000 (UTC)
commit 56ed48fb206b50e5db383893525f44d7923e80a2
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Mon Jul 15 18:47:16 2013 -0400
popupMenu: Fix parenting implementation
I got confused between menus and menu items.
https://bugzilla.gnome.org/show_bug.cgi?id=704336
js/ui/popupMenu.js | 23 ++++++++++++++++++++++-
1 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js
index 42dd6f7..bca2e9f 100644
--- a/js/ui/popupMenu.js
+++ b/js/ui/popupMenu.js
@@ -56,6 +56,7 @@ const PopupBaseMenuItem = new Lang.Class({
this.actor.connect('style-changed', Lang.bind(this, this._onStyleChanged));
this.actor._delegate = this;
+ this._parent = null;
this._children = [];
this._ornament = Ornament.NONE;
this._ornamentLabel = new St.Label({ style_class: 'popup-menu-ornament' });
@@ -84,6 +85,17 @@ const PopupBaseMenuItem = new Lang.Class({
this.actor.connect('key-focus-out', Lang.bind(this, this._onKeyFocusOut));
},
+ _getTopMenu: function() {
+ if (this._parent)
+ return this._parent._getTopMenu();
+ else
+ return this;
+ },
+
+ _setParent: function(parent) {
+ this._parent = parent;
+ },
+
_onStyleChanged: function (actor) {
this._spacing = Math.round(actor.get_theme_node().get_length('spacing'));
},
@@ -671,6 +683,10 @@ const PopupMenuBase = new Lang.Class({
return this;
},
+ _setParent: function(parent) {
+ this._parent = parent;
+ },
+
getSensitive: function() {
return this._sensitive && this.parentSensitive;
},
@@ -906,7 +922,7 @@ const PopupMenuBase = new Lang.Class({
else
throw TypeError("Invalid argument to PopupMenuBase.addMenuItem()");
- menuItem._parent = this;
+ menuItem._setParent(this);
this.length++;
},
@@ -1340,6 +1356,11 @@ const PopupSubMenuMenuItem = new Lang.Class({
this.menu.connect('open-state-changed', Lang.bind(this, this._subMenuOpenStateChanged));
},
+ _setParent: function(parent) {
+ this.parent(parent);
+ this.menu._setParent(parent);
+ },
+
syncSensitive: function() {
let sensitive = this.parent();
this._triangle.visible = sensitive;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]