[gnome-shell] network: always coerce the SSID to _something_



commit 60b54c0052228162e76b8a8d3d3455eee366d7c9
Author: Rui Matos <tiagomatos gmail com>
Date:   Wed Aug 3 19:05:53 2011 +0100

    network: always coerce the SSID to _something_
    
    https://bugzilla.gnome.org/show_bug.cgi?id=654898

 js/ui/status/network.js |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index 341f9b0..3f38062 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -102,6 +102,13 @@ function sortAccessPoints(accessPoints) {
     });
 }
 
+function ssidToLabel(ssid) {
+    let label = NetworkManager.utils_ssid_to_utf8(ssid);
+    if (!label)
+        label = _("<unknown>");
+    return label;
+}
+
 function NMNetworkMenuItem() {
     this._init.apply(this, arguments);
 }
@@ -117,10 +124,7 @@ NMNetworkMenuItem.prototype = {
 
         if (!title) {
             let ssid = this.bestAP.get_ssid();
-            if (ssid)
-                title = NetworkManager.utils_ssid_to_utf8(ssid);
-            if (!title)
-                title = _("<unknown>");
+            title = ssidToLabel(ssid);
         }
 
         this._label = new St.Label({ text: title });
@@ -1002,7 +1006,7 @@ NMDeviceWireless.prototype = {
                         item: null,
                         accessPoints: [ ap ]
                       };
-                obj.ssidText = NetworkManager.utils_ssid_to_utf8(obj.ssid);
+                obj.ssidText = ssidToLabel(obj.ssid);
                 this._networks.push(obj);
             }
 
@@ -1219,7 +1223,7 @@ NMDeviceWireless.prototype = {
                       item: null,
                       accessPoints: [ accessPoint ]
                     };
-            apObj.ssidText = NetworkManager.utils_ssid_to_utf8(apObj.ssid);
+            apObj.ssidText = ssidToLabel(apObj.ssid);
             needsupdate = true;
         }
 



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