[gnome-control-center] network: Fix mobile broadband switch state



commit bb8ca23701833524ec45b0c4cc6e897e917bc8e0
Author: Jonathan Kang <jonathan121537 gmail com>
Date:   Thu Oct 13 10:05:03 2016 +0800

    network: Fix mobile broadband switch state
    
    The switch was only reflecting the value of the WWAN killswitch instead
    of both the WWAN killswitch and the state of the connection itself.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=690361

 panels/network/net-device-mobile.c |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/panels/network/net-device-mobile.c b/panels/network/net-device-mobile.c
index 408b2dc..fe83bff 100644
--- a/panels/network/net-device-mobile.c
+++ b/panels/network/net-device-mobile.c
@@ -171,7 +171,22 @@ mobilebb_enabled_toggled (NMClient       *client,
         if (nm_device_get_device_type (device) != NM_DEVICE_TYPE_MODEM)
                 return;
 
-        enabled = nm_client_wwan_get_enabled (client);
+        if (nm_client_wwan_get_enabled (client)) {
+                NMDeviceState state;
+
+                state = nm_device_get_state (device);
+                if (state == NM_DEVICE_STATE_UNKNOWN ||
+                    state == NM_DEVICE_STATE_UNMANAGED ||
+                    state == NM_DEVICE_STATE_UNAVAILABLE ||
+                    state == NM_DEVICE_STATE_DISCONNECTED ||
+                    state == NM_DEVICE_STATE_DEACTIVATING ||
+                    state == NM_DEVICE_STATE_FAILED) {
+                        enabled = FALSE;
+                } else {
+                        enabled = TRUE;
+                }
+        }
+
         sw = GTK_SWITCH (gtk_builder_get_object (device_mobile->priv->builder,
                                                  "device_off_switch"));
 


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