[gnome-shell/wip/aggregate-menu: 7/56] popupMenu: Use the parent field for sensitivity chaining



commit 7c5a9050214031b3b1e521341712ce6dbb9c7115
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Mon Jul 15 18:54:15 2013 -0400

    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 |   13 ++++---------
 1 files changed, 4 insertions(+), 9 deletions(-)
---
diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js
index bca2e9f..634bf47 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) {
@@ -792,7 +792,6 @@ const PopupMenuBase = new Lang.Class({
         }));
 
         menuItem._parentSensitiveChangeId = this.connect('sensitive-changed', Lang.bind(this, function() {
-            menuItem.parentSensitive = this.getSensitive();
             menuItem.syncSensitive();
         }));
 
@@ -876,10 +875,6 @@ const PopupMenuBase = new Lang.Class({
             let parentClosingId = this.connect('menu-closed', function() {
                 menuItem.emit('menu-closed');
             });
-            let subMenuSensitiveChangedId = this.connect('sensitive-changed', Lang.bind(this, function() {
-                menuItem.parentSensitive = this.getSensitive();
-                menuItem.emit('sensitive-changed');
-            }));
 
             menuItem.connect('destroy', Lang.bind(this, function() {
                 menuItem.disconnect(activateId);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]