popupMenu: Use the parent field for sensitivity chaining
Instead of a signal mess. https://bugzilla.gnome.org/show_bug.cgi?id=704336
This commit is contained in:
parent
a4a6e7cf53
commit
5a5b3bf291
@ -66,7 +66,6 @@ const PopupBaseMenuItem = new Lang.Class({
|
|||||||
this.active = false;
|
this.active = false;
|
||||||
this._activatable = params.reactive && params.activate;
|
this._activatable = params.reactive && params.activate;
|
||||||
this._sensitive = true;
|
this._sensitive = true;
|
||||||
this.parentSensitive = true;
|
|
||||||
|
|
||||||
if (!this._activatable)
|
if (!this._activatable)
|
||||||
this.actor.add_style_class_name('popup-inactive-menu-item');
|
this.actor.add_style_class_name('popup-inactive-menu-item');
|
||||||
@ -156,7 +155,8 @@ const PopupBaseMenuItem = new Lang.Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
getSensitive: function() {
|
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) {
|
setSensitive: function(sensitive) {
|
||||||
@ -671,7 +671,6 @@ const PopupMenuBase = new Lang.Class({
|
|||||||
this._settingsActions = { };
|
this._settingsActions = { };
|
||||||
|
|
||||||
this._sensitive = true;
|
this._sensitive = true;
|
||||||
this.parentSensitive = true;
|
|
||||||
|
|
||||||
this._sessionUpdatedId = Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated));
|
this._sessionUpdatedId = Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated));
|
||||||
},
|
},
|
||||||
@ -688,7 +687,8 @@ const PopupMenuBase = new Lang.Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
getSensitive: function() {
|
getSensitive: function() {
|
||||||
return this._sensitive && this.parentSensitive;
|
let parentSensitive = this._parent ? this._parent.getSensitive() : true;
|
||||||
|
return this._sensitive && parentSensitive;
|
||||||
},
|
},
|
||||||
|
|
||||||
setSensitive: function(sensitive) {
|
setSensitive: function(sensitive) {
|
||||||
@ -794,7 +794,6 @@ const PopupMenuBase = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
menuItem._parentSensitiveChangeId = this.connect('sensitive-changed', Lang.bind(this, function() {
|
menuItem._parentSensitiveChangeId = this.connect('sensitive-changed', Lang.bind(this, function() {
|
||||||
menuItem.parentSensitive = this.getSensitive();
|
|
||||||
menuItem.syncSensitive();
|
menuItem.syncSensitive();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@ -879,7 +878,6 @@ const PopupMenuBase = new Lang.Class({
|
|||||||
menuItem.emit('menu-closed');
|
menuItem.emit('menu-closed');
|
||||||
});
|
});
|
||||||
let subMenuSensitiveChangedId = this.connect('sensitive-changed', Lang.bind(this, function() {
|
let subMenuSensitiveChangedId = this.connect('sensitive-changed', Lang.bind(this, function() {
|
||||||
menuItem.parentSensitive = this.getSensitive();
|
|
||||||
menuItem.emit('sensitive-changed');
|
menuItem.emit('sensitive-changed');
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user