[gnome-control-center] network: don't call inactive devices "Disconnected"



commit 534ad3636486a87556ee5fa197644917e6db2cc3
Author: Dan Winship <danw gnome org>
Date:   Thu Jan 31 12:43:18 2013 -0500

    network: don't call inactive devices "Disconnected"
    
    It's confusing to call an ethernet device "disconnected" when it is
    plugged in but not in use. Just don't say anything instead.
    
    Also, update the icon logic to show the "disconnected" icon in this
    state, rather than the "connected" one, since it's confusing for the
    icon to change even though the network connection hasn't been
    activated.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=646029

 panels/network/net-device-ethernet.c |    7 +++++--
 panels/network/net-device-mobile.c   |    3 ++-
 panels/network/net-device-simple.c   |    4 +++-
 panels/network/net-virtual-device.c  |    2 +-
 panels/network/panel-common.c        |    5 ++---
 5 files changed, 13 insertions(+), 8 deletions(-)
---
diff --git a/panels/network/net-device-ethernet.c b/panels/network/net-device-ethernet.c
index 762448a..5b77882 100644
--- a/panels/network/net-device-ethernet.c
+++ b/panels/network/net-device-ethernet.c
@@ -234,8 +234,11 @@ device_ethernet_refresh_ui (NetDeviceEthernet *device)
         status = g_string_new (panel_device_state_to_localized_string (nm_device));
         if (state != NM_DEVICE_STATE_UNAVAILABLE)
                 speed = net_device_simple_get_speed (NET_DEVICE_SIMPLE (device));
-        if (speed)
-                g_string_append_printf (status, " - %s", speed);
+        if (speed) {
+                if (status->len)
+                        g_string_append (status, " - ");
+                g_string_append (status, speed);
+        }
         gtk_label_set_label (GTK_LABEL (widget), status->str);
         g_string_free (status, TRUE);
 
diff --git a/panels/network/net-device-mobile.c b/panels/network/net-device-mobile.c
index 1ca2532..4b68783 100644
--- a/panels/network/net-device-mobile.c
+++ b/panels/network/net-device-mobile.c
@@ -272,7 +272,8 @@ nm_device_mobile_refresh_ui (NetDeviceMobile *device_mobile)
         widget = GTK_WIDGET (gtk_builder_get_object (device_mobile->priv->builder, "label_status"));
         status = g_string_new (panel_device_state_to_localized_string (nm_device));
         if (speed  > 0) {
-                g_string_append (status, " - ");
+                if (status->len)
+                        g_string_append (status, " - ");
                 /* Translators: network device speed */
                 g_string_append_printf (status, _("%d Mb/s"), speed);
         }
diff --git a/panels/network/net-device-simple.c b/panels/network/net-device-simple.c
index b42730e..2fb4c9a 100644
--- a/panels/network/net-device-simple.c
+++ b/panels/network/net-device-simple.c
@@ -129,7 +129,9 @@ nm_device_simple_refresh_ui (NetDeviceSimple *device_simple)
         if (state != NM_DEVICE_STATE_UNAVAILABLE)
                 speed = net_device_simple_get_speed (device_simple);
         if (speed) {
-                g_string_append_printf (status, " - %s", speed);
+                if (status->len)
+                        g_string_append (status, " - ");
+                g_string_append (status, speed);
                 g_free (speed);
         }
         gtk_label_set_label (GTK_LABEL (widget), status->str);
diff --git a/panels/network/net-virtual-device.c b/panels/network/net-virtual-device.c
index bb32c3e..f8567f9 100644
--- a/panels/network/net-virtual-device.c
+++ b/panels/network/net-virtual-device.c
@@ -179,7 +179,7 @@ net_virtual_device_refresh (NetObject *object)
                 status = panel_device_state_to_localized_string (nm_device);
                 tooltip = panel_device_state_reason_to_localized_string (nm_device);
         } else {
-                status = _("Disconnected");
+                status = "";
                 tooltip = NULL;
         }
         gtk_label_set_label (GTK_LABEL (widget), status);
diff --git a/panels/network/panel-common.c b/panels/network/panel-common.c
index 1b53212..589b6d2 100644
--- a/panels/network/panel-common.c
+++ b/panels/network/panel-common.c
@@ -44,7 +44,7 @@ panel_device_to_icon_name (NMDevice *device)
         switch (nm_device_get_device_type (device)) {
         case NM_DEVICE_TYPE_ETHERNET:
                 state = nm_device_get_state (device);
-                if (state == NM_DEVICE_STATE_UNAVAILABLE) {
+                if (state <= NM_DEVICE_STATE_DISCONNECTED) {
                         value = "network-wired-disconnected-symbolic";
                 } else {
                         value = "network-wired-symbolic";
@@ -169,8 +169,7 @@ panel_device_state_to_localized_string (NMDevice *device)
                 }
                 break;
         case NM_DEVICE_STATE_DISCONNECTED:
-                /* TRANSLATORS: device status */
-                value = _("Disconnected");
+                value = "";
                 break;
         case NM_DEVICE_STATE_PREPARE:
         case NM_DEVICE_STATE_CONFIG:



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