[gnome-shell/gnome-3-8] RemoteMenu: Avoid useless signal connections
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/gnome-3-8] RemoteMenu: Avoid useless signal connections
- Date: Fri, 7 Jun 2013 18:10:53 +0000 (UTC)
commit c1eaf97bc609469024671b86d93df62ab5625087
Author: Xavier Claessens <xavier claessens collabora co uk>
Date: Wed Jun 5 14:49:14 2013 +0200
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
js/ui/popupMenu.js | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js
index 1c63997..9456b79 100644
--- a/js/ui/popupMenu.js
+++ b/js/ui/popupMenu.js
@@ -1826,6 +1826,8 @@ const RemoteMenu = new Lang.Class({
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._skipSignalConnection = false;
},
destroy: function() {
@@ -1986,13 +1988,16 @@ const RemoteMenu = new Lang.Class({
target.addMenuItem(separator, k+1);
k++;
}
- } else if (changeSignal) {
+ } else if (changeSignal && !this._skipSignalConnection) {
let signalId = this.actionGroup.connect(changeSignal, Lang.bind(this, function(actionGroup,
actionName) {
actionGroup.disconnect(signalId);
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._skipSignalConnection = false;
}));
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]