[gnome-shell] NetworkMenu: show devices that are unmanaged



commit dbd629d5d2175714d801d4bc29f4296554f08875
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Mon May 9 16:15:03 2011 +0200

    NetworkMenu: show devices that are unmanaged
    
    Some users are confused when their devices are not shown in the
    network menu, even if they configured them manually. Mark their presence
    by showing them in the menu, even if they cannot be otherwise
    interacted with.
    Also add a status string for deactivating devices (none currently,
    soon will appear in NetworkManager).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=646946

 js/ui/status/network.js |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index 3617c2b..c8c2efc 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -526,11 +526,15 @@ NMDevice.prototype = {
 
     getStatusLabel: function() {
         switch(this.device.state) {
-        case NetworkManager.DeviceState.UNMANAGED:
         case NetworkManager.DeviceState.DISCONNECTED:
-        case NetworkManager.DeviceState.DEACTIVATING:
         case NetworkManager.DeviceState.ACTIVATED:
             return null;
+        case NetworkManager.DeviceState.UNMANAGED:
+            /* Translators: this is for network devices that are physically present but are not
+               under NetworkManager's control (and thus cannot be used in the menu) */
+            return _("unmanaged");
+        case NetworkManager.DeviceState.DEACTIVATING:
+            return _("disconnecting...");
         case NetworkManager.DeviceState.PREPARE:
         case NetworkManager.DeviceState.CONFIG:
         case NetworkManager.DeviceState.IP_CONFIG:
@@ -1691,21 +1695,18 @@ NMApplet.prototype = {
 
     _syncSectionTitle: function(category) {
         let devices = this._devices[category].devices;
-        let managedDevices = devices.filter(function(dev) {
-            return dev.device.state != NetworkManager.DeviceState.UNMANAGED;
-        });
         let item = this._devices[category].item;
         let section = this._devices[category].section;
-        if (managedDevices.length == 0)
+        if (devices.length == 0)
             section.actor.hide();
         else {
             section.actor.show();
-            if (managedDevices.length == 1) {
-                let dev = managedDevices[0];
+            if (devices.length == 1) {
+                let dev = devices[0];
                 dev.statusItem.actor.hide();
                 item.updateForDevice(dev);
             } else {
-                managedDevices.forEach(function(dev) {
+                devices.forEach(function(dev) {
                     dev.statusItem.actor.show();
                 });
                 // remove status text from the section title item



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