[gnome-shell] network: Fix a recursion issue when updating VPN



commit ccba18aa8fb102644eb7d756ff3aaccd6f597cef
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Jul 3 13:47:21 2013 -0400

    network: Fix a recursion issue when updating VPN
    
    _updateIcon should not attempt to sync any active connections, as the
    icon-changed signal can be emitted in response to something done during
    _syncActiveConnection. In the case of VPN, removeActiveConnection would
    cause an icon-changed signal to be emitted immediately, but the state
    would not be updated, causing us to call removeActiveConnection over and
    over.
    
    Explicitly sync all active connections when we know it needs to be done,
    and simply make _updateIcon synchronize with the current device's icon.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=703565

 js/ui/status/network.js |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index 923aaea..6cc9055 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -1528,7 +1528,7 @@ const NMApplet = new Lang.Class({
         this._client.connect('notify::manager-running', Lang.bind(this, this._syncNMState));
         this._client.connect('notify::networking-enabled', Lang.bind(this, this._syncNMState));
         this._client.connect('notify::state', Lang.bind(this, this._syncNMState));
-        this._client.connect('notify::active-connections', Lang.bind(this, this._updateIcon));
+        this._client.connect('notify::active-connections', Lang.bind(this, this._syncActiveConnections));
         this._client.connect('device-added', Lang.bind(this, this._deviceAdded));
         this._client.connect('device-removed', Lang.bind(this, this._deviceRemoved));
         this._settings.connect('new-connection', Lang.bind(this, this._newConnection));
@@ -1761,8 +1761,8 @@ const NMApplet = new Lang.Class({
             let a = this._activeConnections[i];
 
             if (!a._inited) {
-                a._notifyDefaultId = a.connect('notify::default', Lang.bind(this, this._updateIcon));
-                a._notifyDefault6Id = a.connect('notify::default6', Lang.bind(this, this._updateIcon));
+                a._notifyDefaultId = a.connect('notify::default', Lang.bind(this, 
this._syncActiveConnections));
+                a._notifyDefault6Id = a.connect('notify::default6', Lang.bind(this, 
this._syncActiveConnections));
                 a._notifyStateId = a.connect('notify::state', Lang.bind(this, this._notifyActivated));
 
                 a._inited = true;
@@ -1814,6 +1814,7 @@ const NMApplet = new Lang.Class({
         if (this._mainConnection) {
             let dev = this._mainConnection._primaryDevice;
             this._mainConnectionIconChangedId = dev.connect('icon-changed', Lang.bind(this, 
this._updateIcon));
+            this._updateIcon();
         }
     },
 
@@ -1824,7 +1825,7 @@ const NMApplet = new Lang.Class({
             activeConnection._primaryDevice._notification = null;
         }
 
-        this._updateIcon();
+        this._syncActiveConnections();
     },
 
     _ignoreConnection: function(connection) {
@@ -1861,7 +1862,7 @@ const NMApplet = new Lang.Class({
 
     _newConnection: function(settings, connection) {
         this._addConnection(connection);
-        this._updateIcon();
+        this._syncActiveConnections();
     },
 
     _connectionRemoved: function(connection) {
@@ -1940,11 +1941,10 @@ const NMApplet = new Lang.Class({
         }
 
         this._showNormal();
-        this._updateIcon();
+        this._syncActiveConnections();
     },
 
     _updateIcon: function() {
-        this._syncActiveConnections();
         let hasApIcon = false;
         let hasMobileIcon = false;
 


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