From 60b54c0052228162e76b8a8d3d3455eee366d7c9 Mon Sep 17 00:00:00 2001 From: Rui Matos Date: Wed, 3 Aug 2011 19:05:53 +0100 Subject: [PATCH] network: always coerce the SSID to _something_ https://bugzilla.gnome.org/show_bug.cgi?id=654898 --- js/ui/status/network.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/js/ui/status/network.js b/js/ui/status/network.js index 341f9b0e8..3f3806229 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 = _(""); + 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 = _(""); + 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; }