diff options
author | Thomas Haller <thaller@redhat.com> | 2017-02-02 12:38:35 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2017-02-10 14:40:24 +0100 |
commit | 1b7f03d1a554c91ac7df2412b8e0f3449512cb74 (patch) | |
tree | 46d5309eb3f293e5ccedb8478701c7f181e33443 | |
parent | a2798c18b6c4a000ebc5d8b4da3afd0e0245bc65 (diff) | |
download | NetworkManager-1b7f03d1a554c91ac7df2412b8e0f3449512cb74.tar.gz |
device/wifi/trivial: reorder code in "nm-device-wifi.c"
-rw-r--r-- | src/devices/wifi/nm-device-wifi.c | 147 |
1 files changed, 74 insertions, 73 deletions
diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c index b0eb0b95cc..116612d549 100644 --- a/src/devices/wifi/nm-device-wifi.c +++ b/src/devices/wifi/nm-device-wifi.c @@ -209,21 +209,6 @@ _ap_dump (NMDeviceWifi *self, nm_wifi_ap_to_string (ap, buf, sizeof (buf), now_s)); } -static void -constructed (GObject *object) -{ - NMDeviceWifi *self = NM_DEVICE_WIFI (object); - NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self); - - G_OBJECT_CLASS (nm_device_wifi_parent_class)->constructed (object); - - if (priv->capabilities & NM_WIFI_DEVICE_CAP_AP) - _LOGI (LOGD_PLATFORM | LOGD_WIFI, "driver supports Access Point (AP) mode"); - - /* Connect to the supplicant manager */ - priv->sup_mgr = g_object_ref (nm_supplicant_manager_get ()); -} - static gboolean unmanaged_on_quit (NMDevice *self) { @@ -3100,64 +3085,6 @@ set_enabled (NMDevice *device, gboolean enabled) /*****************************************************************************/ -NMDevice * -nm_device_wifi_new (const char *iface, NMDeviceWifiCapabilities capabilities) -{ - return g_object_new (NM_TYPE_DEVICE_WIFI, - NM_DEVICE_IFACE, iface, - NM_DEVICE_TYPE_DESC, "802.11 WiFi", - NM_DEVICE_DEVICE_TYPE, NM_DEVICE_TYPE_WIFI, - NM_DEVICE_LINK_TYPE, NM_LINK_TYPE_WIFI, - NM_DEVICE_RFKILL_TYPE, RFKILL_TYPE_WLAN, - NM_DEVICE_WIFI_CAPABILITIES, (guint) capabilities, - NULL); -} - -static void -nm_device_wifi_init (NMDeviceWifi *self) -{ - NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self); - - priv->mode = NM_802_11_MODE_INFRA; - priv->aps = g_hash_table_new (g_str_hash, g_str_equal); -} - -static void -dispose (GObject *object) -{ - NMDeviceWifi *self = NM_DEVICE_WIFI (object); - NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self); - - nm_clear_g_source (&priv->periodic_source_id); - - wifi_secrets_cancel (self); - - cleanup_association_attempt (self, TRUE); - supplicant_interface_release (self); - cleanup_supplicant_failures (self); - - g_clear_object (&priv->sup_mgr); - - remove_all_aps (self); - - G_OBJECT_CLASS (nm_device_wifi_parent_class)->dispose (object); -} - -static void -finalize (GObject *object) -{ - NMDeviceWifi *self = NM_DEVICE_WIFI (object); - NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self); - - nm_assert (g_hash_table_size (priv->aps) == 0); - - g_hash_table_unref (priv->aps); - - g_free (priv->hw_addr_scan); - - G_OBJECT_CLASS (nm_device_wifi_parent_class)->finalize (object); -} - static void get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) @@ -3213,6 +3140,80 @@ set_property (GObject *object, guint prop_id, } } +/*****************************************************************************/ + +static void +nm_device_wifi_init (NMDeviceWifi *self) +{ + NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self); + + priv->mode = NM_802_11_MODE_INFRA; + priv->aps = g_hash_table_new (g_str_hash, g_str_equal); +} + +static void +constructed (GObject *object) +{ + NMDeviceWifi *self = NM_DEVICE_WIFI (object); + NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self); + + G_OBJECT_CLASS (nm_device_wifi_parent_class)->constructed (object); + + if (priv->capabilities & NM_WIFI_DEVICE_CAP_AP) + _LOGI (LOGD_PLATFORM | LOGD_WIFI, "driver supports Access Point (AP) mode"); + + /* Connect to the supplicant manager */ + priv->sup_mgr = g_object_ref (nm_supplicant_manager_get ()); +} + +NMDevice * +nm_device_wifi_new (const char *iface, NMDeviceWifiCapabilities capabilities) +{ + return g_object_new (NM_TYPE_DEVICE_WIFI, + NM_DEVICE_IFACE, iface, + NM_DEVICE_TYPE_DESC, "802.11 WiFi", + NM_DEVICE_DEVICE_TYPE, NM_DEVICE_TYPE_WIFI, + NM_DEVICE_LINK_TYPE, NM_LINK_TYPE_WIFI, + NM_DEVICE_RFKILL_TYPE, RFKILL_TYPE_WLAN, + NM_DEVICE_WIFI_CAPABILITIES, (guint) capabilities, + NULL); +} + +static void +dispose (GObject *object) +{ + NMDeviceWifi *self = NM_DEVICE_WIFI (object); + NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self); + + nm_clear_g_source (&priv->periodic_source_id); + + wifi_secrets_cancel (self); + + cleanup_association_attempt (self, TRUE); + supplicant_interface_release (self); + cleanup_supplicant_failures (self); + + g_clear_object (&priv->sup_mgr); + + remove_all_aps (self); + + G_OBJECT_CLASS (nm_device_wifi_parent_class)->dispose (object); +} + +static void +finalize (GObject *object) +{ + NMDeviceWifi *self = NM_DEVICE_WIFI (object); + NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self); + + nm_assert (g_hash_table_size (priv->aps) == 0); + + g_hash_table_unref (priv->aps); + + g_free (priv->hw_addr_scan); + + G_OBJECT_CLASS (nm_device_wifi_parent_class)->finalize (object); +} static void nm_device_wifi_class_init (NMDeviceWifiClass *klass) |