[gnome-shell/gnome-3-8] network: don't use active connections that	are in invalid states
- From: Giovanni Campagna <gcampagna src gnome org>
 
- To: commits-list gnome org
 
- Cc: 
 
- Subject: [gnome-shell/gnome-3-8] network: don't use active connections that	are in invalid states
 
- Date: Wed,  8 May 2013 22:05:42 +0000 (UTC)
 
commit eb2e66c539ef80b4119fd991cf555502974ee86c
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Wed May 8 23:54:32 2013 +0200
    network: don't use active connections that are in invalid states
    
    Only ACTIVE or ACTIVATING connections are important when deciding
    what icon to show, don't fallback on any, possibly invalid or deactivating,
    active connection object.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=676285
 js/ui/status/network.js |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index fe60a7c..33eb4d4 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -2047,6 +2047,7 @@ const NMApplet = new Lang.Class({
         let default_ip4 = null;
         let default_ip6 = null;
         let active_vpn = null;
+        let active_any = null;
         for (let i = 0; i < this._activeConnections.length; i++) {
             let a = this._activeConnections[i];
 
@@ -2077,10 +2078,15 @@ const NMApplet = new Lang.Class({
             if (a.default6)
                 default_ip6 = a;
 
-            if (a._type == 'vpn')
-                active_vpn = a;
-            else if (a.state == NetworkManager.ActiveConnectionState.ACTIVATING)
+            if (a.state == NetworkManager.ActiveConnectionState.ACTIVATING)
                 activating = a;
+            else if (a.state == NetworkManager.ActiveConnectionState.ACTIVE)
+                active_any = a;
+
+            if (a._type == 'vpn' &&
+                (a.state == NetworkManager.ActiveConnectionState.ACTIVATING ||
+                 a.state == NetworkManager.ActiveConnectionState.ACTIVE))
+                active_vpn = a;
 
             if (!a._primaryDevice) {
                 if (a._type != NetworkManager.SETTING_VPN_SETTING_NAME) {
@@ -2108,7 +2114,7 @@ const NMApplet = new Lang.Class({
             }
         }
 
-        this._mainConnection = activating || default_ip4 || default_ip6 || this._activeConnections[0] || 
null;
+        this._mainConnection = activating || default_ip4 || default_ip6 || active_any || null;
         this._vpnConnection = active_vpn;
     },
 
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]