diff options
author | Bastien Nocera <hadess@hadess.net> | 2017-03-10 14:24:19 +0100 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2017-03-14 11:10:51 +0100 |
commit | e41134671baf56f747de68884c8f030948e8b07d (patch) | |
tree | 1d05a61e8075e539046df857a46bd0314eb9e550 | |
parent | 58270a2c76328b6a2b96325c3764cfe60241bf10 (diff) | |
download | gnome-control-center-e41134671baf56f747de68884c8f030948e8b07d.tar.gz |
network: Move hotspot connection search into a helper function
https://bugzilla.gnome.org/show_bug.cgi?id=705546
-rw-r--r-- | panels/network/net-device-wifi.c | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/panels/network/net-device-wifi.c b/panels/network/net-device-wifi.c index f6b35ba27..ae99cd84d 100644 --- a/panels/network/net-device-wifi.c +++ b/panels/network/net-device-wifi.c @@ -1021,11 +1021,29 @@ activate_new_cb (GObject *source_object, show_hotspot_ui (user_data); } +static NMConnection * +net_device_wifi_get_hotspot_connection (NetDeviceWifi *device_wifi) +{ + GSList *connections, *l; + NMConnection *c = NULL; + + connections = net_device_get_valid_connections (NET_DEVICE (device_wifi)); + for (l = connections; l; l = l->next) { + NMConnection *tmp = l->data; + if (is_hotspot_connection (tmp)) { + c = tmp; + break; + } + } + g_slist_free (connections); + + return c; +} + static void start_shared_connection (NetDeviceWifi *device_wifi) { NMConnection *c; - NMConnection *tmp; NMSettingConnection *sc; NMSettingWireless *sw; NMSettingIP4Config *sip; @@ -1034,8 +1052,6 @@ start_shared_connection (NetDeviceWifi *device_wifi) GBytes *ssid; const gchar *str_mac; struct ether_addr *bin_mac; - GSList *connections; - GSList *l; NMClient *client; const char *mode; NMDeviceWifiCapabilities caps; @@ -1043,16 +1059,7 @@ start_shared_connection (NetDeviceWifi *device_wifi) device = net_device_get_nm_device (NET_DEVICE (device_wifi)); g_assert (nm_device_get_device_type (device) == NM_DEVICE_TYPE_WIFI); - connections = net_device_get_valid_connections (NET_DEVICE (device_wifi)); - c = NULL; - for (l = connections; l; l = l->next) { - tmp = l->data; - if (is_hotspot_connection (tmp)) { - c = tmp; - break; - } - } - g_slist_free (connections); + c = net_device_wifi_get_hotspot_connection (device_wifi); ssid = generate_ssid_for_hotspot (device_wifi); |