[gnome-control-center] network: Show an error when we fail to turn off hotspot



commit 15a98c3fd899bcf039ad1b716b45610b72018c1e
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Sep 2 19:08:46 2014 +0200

    network: Show an error when we fail to turn off hotspot
    
    And reset the switch as well. I don't know in which circumstance it
    could happen, but it's all we can do for now.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=723643

 panels/network/net-device-wifi.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/panels/network/net-device-wifi.c b/panels/network/net-device-wifi.c
index c11a634..78bac7f 100644
--- a/panels/network/net-device-wifi.c
+++ b/panels/network/net-device-wifi.c
@@ -1180,6 +1180,7 @@ stop_shared_connection (NetDeviceWifi *device_wifi)
         gint i;
         NMActiveConnection *c;
         NMClient *client;
+        gboolean found = FALSE;
 
         device = net_device_get_nm_device (NET_DEVICE (device_wifi));
         client = net_object_get_client (NET_OBJECT (device_wifi));
@@ -1190,10 +1191,19 @@ stop_shared_connection (NetDeviceWifi *device_wifi)
                 devices = nm_active_connection_get_devices (c);
                 if (devices && devices->pdata[0] == device) {
                         nm_client_deactivate_connection (client, c);
+                        found = TRUE;
                         break;
                 }
         }
 
+        if (!found) {
+                g_warning ("Could not stop hotspot connection as no connection attached to the device could 
be found.");
+                device_wifi->priv->updating_device = TRUE;
+                gtk_switch_set_active (device_wifi->priv->hotspot_switch, TRUE);
+                device_wifi->priv->updating_device = FALSE;
+                return;
+        }
+
         nm_device_wifi_refresh_ui (device_wifi);
         show_wifi_list (device_wifi);
 }


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