RemoteMenu: Avoid useless signal connections
If we are missing more than one action, every time action-added is called, it calls modelChanged() again and re-connect signal for all action still missing. This patch prevent from connecting signals again when doing a refresh because a missing action is now available. All necessary signals have already been connected. https://bugzilla.gnome.org/show_bug.cgi?id=694612
This commit is contained in:
parent
1420f62dfa
commit
c1eaf97bc6
@ -1826,6 +1826,8 @@ const RemoteMenu = new Lang.Class({
|
|||||||
|
|
||||||
this._actionStateChangeId = this.actionGroup.connect('action-state-changed', Lang.bind(this, this._actionStateChanged));
|
this._actionStateChangeId = this.actionGroup.connect('action-state-changed', Lang.bind(this, this._actionStateChanged));
|
||||||
this._actionEnableChangeId = this.actionGroup.connect('action-enabled-changed', Lang.bind(this, this._actionEnabledChanged));
|
this._actionEnableChangeId = this.actionGroup.connect('action-enabled-changed', Lang.bind(this, this._actionEnabledChanged));
|
||||||
|
|
||||||
|
this._skipSignalConnection = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function() {
|
destroy: function() {
|
||||||
@ -1986,13 +1988,16 @@ const RemoteMenu = new Lang.Class({
|
|||||||
target.addMenuItem(separator, k+1);
|
target.addMenuItem(separator, k+1);
|
||||||
k++;
|
k++;
|
||||||
}
|
}
|
||||||
} else if (changeSignal) {
|
} else if (changeSignal && !this._skipSignalConnection) {
|
||||||
let signalId = this.actionGroup.connect(changeSignal, Lang.bind(this, function(actionGroup, actionName) {
|
let signalId = this.actionGroup.connect(changeSignal, Lang.bind(this, function(actionGroup, actionName) {
|
||||||
actionGroup.disconnect(signalId);
|
actionGroup.disconnect(signalId);
|
||||||
if (this._actions[actionName]) return;
|
if (this._actions[actionName]) return;
|
||||||
|
|
||||||
// force a full update
|
/* force a full update but do not reconnect signals if other
|
||||||
|
* actions are missing */
|
||||||
|
this._skipSignalConnection = true;
|
||||||
this._modelChanged(model, 0, -1, model.get_n_items(), target);
|
this._modelChanged(model, 0, -1, model.get_n_items(), target);
|
||||||
|
this._skipSignalConnection = false;
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user