Blob Blame History Raw
From 026fbd024fcb5c91f8b7bd75343d1eb62cd63387 Mon Sep 17 00:00:00 2001
From: Martin Dengler <martin@martindengler.com>
Date: Wed, 12 Oct 2011 11:22:41 -0400
Subject: [PATCH] network: backport 6709e5e45 (don't show hidden access
 points)

This commit backports 6709e5e45 to prevent several minute delays.

https://bugzilla.gnome.org/show_bug.cgi?id=651378
---
 js/ui/status/network.js |   33 +++++++++++++++++++++++++++++++++
 1 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index 79e384a..74a395a 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -1013,6 +1013,16 @@ NMDeviceWireless.prototype = {
         for (let i = 0; i < accessPoints.length; i++) {
             // Access points are grouped by network
             let ap = accessPoints[i];
+
+            if (ap.get_ssid() == null) {
+                // hidden access point cannot be added, we need to know
+                // the SSID and security details to connect
+                // nevertheless, the access point can acquire a SSID when
+                // NetworkManager connects to it (via nmcli or the control-center)
+                ap._notifySsidId = ap.connect('notify::ssid', Lang.bind(this, this._notifySsidCb));
+                continue;
+            }
+
             let pos = this._findNetwork(ap);
             let obj;
             if (pos != -1) {
@@ -1112,6 +1122,14 @@ NMDeviceWireless.prototype = {
         }
     },
 
+    _notifySsidCb: function(accessPoint) {
+        if (accessPoint.get_ssid() != null) {
+            accessPoint.disconnect(accessPoint._notifySsidId);
+            accessPoint._notifySsidId = 0;
+            this._accessPointAdded(this.device, accessPoint);
+        }
+    },
+
     _getApSecurityType: function(accessPoint) {
         if (accessPoint._secType)
             return accessPoint._secType;
@@ -1155,6 +1173,10 @@ NMDeviceWireless.prototype = {
     },
 
     _findNetwork: function(accessPoint) {
+        if (accessPoint == null)
+            return -1;
+        if (accessPoint.get_ssid() == null)
+            return -1;
         for (let i = 0; i < this._networks.length; i++) {
             if (this._networkCompare(this._networks[i], accessPoint))
                 return i;
@@ -1163,6 +1185,13 @@ NMDeviceWireless.prototype = {
     },
 
     _accessPointAdded: function(device, accessPoint) {
+        if (accessPoint.get_ssid() == null) {
+            // This access point is not visible yet
+            // Wait for it to get a ssid
+            accessPoint._notifySsidId = accessPoint.connect('notify::ssid', Lang.bind(this, this._notifySsidCb));
+            return;
+        }
+
         let pos = this._findNetwork(accessPoint);
         let apObj;
         if (pos != -1) {
@@ -1356,6 +1385,10 @@ NMDeviceWireless.prototype = {
 
     _createActiveConnectionItem: function() {
         let activeAp = this.device.active_access_point;
+        let networkPos = this._findNetwork(this.device.active_access_point);
+        if (networkPos == -1) // the connected access point is invisible
+            activeAp = null;
+
         let icon, title;
         if (this._activeConnection._connection) {
             let connection = this._activeConnection._connection;
-- 
1.7.6.2