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
This commit is contained in:
Bastien Nocera 2014-09-02 19:08:46 +02:00
parent b108dedde6
commit 15a98c3fd8

View file

@ -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);
}