From 5a5b3bf2916f7a5a9d38546a656b0a900a7b2fdd Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Mon, 15 Jul 2013 18:54:15 -0400 Subject: [PATCH] popupMenu: Use the parent field for sensitivity chaining Instead of a signal mess. https://bugzilla.gnome.org/show_bug.cgi?id=704336 --- js/ui/popupMenu.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js index 824fe1dcc..b8503bf76 100644 --- a/js/ui/popupMenu.js +++ b/js/ui/popupMenu.js @@ -66,7 +66,6 @@ const PopupBaseMenuItem = new Lang.Class({ this.active = false; this._activatable = params.reactive && params.activate; this._sensitive = true; - this.parentSensitive = true; if (!this._activatable) this.actor.add_style_class_name('popup-inactive-menu-item'); @@ -156,7 +155,8 @@ const PopupBaseMenuItem = new Lang.Class({ }, getSensitive: function() { - return this._activatable && this._sensitive && this.parentSensitive; + let parentSensitive = this._parent ? this._parent.getSensitive() : true; + return this._activatable && this._sensitive && parentSensitive; }, setSensitive: function(sensitive) { @@ -671,7 +671,6 @@ const PopupMenuBase = new Lang.Class({ this._settingsActions = { }; this._sensitive = true; - this.parentSensitive = true; this._sessionUpdatedId = Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated)); }, @@ -688,7 +687,8 @@ const PopupMenuBase = new Lang.Class({ }, getSensitive: function() { - return this._sensitive && this.parentSensitive; + let parentSensitive = this._parent ? this._parent.getSensitive() : true; + return this._sensitive && parentSensitive; }, setSensitive: function(sensitive) { @@ -794,7 +794,6 @@ const PopupMenuBase = new Lang.Class({ })); menuItem._parentSensitiveChangeId = this.connect('sensitive-changed', Lang.bind(this, function() { - menuItem.parentSensitive = this.getSensitive(); menuItem.syncSensitive(); })); @@ -879,7 +878,6 @@ const PopupMenuBase = new Lang.Class({ menuItem.emit('menu-closed'); }); let subMenuSensitiveChangedId = this.connect('sensitive-changed', Lang.bind(this, function() { - menuItem.parentSensitive = this.getSensitive(); menuItem.emit('sensitive-changed'); }));