[PATCH v0.7 1/6] wifi: add 'scanning' property which is TRUE while device is scanning
- From: Daniel Drake <dsd laptop org>
- To: dcbw redhat com
- Cc: networkmanager-list gnome org
- Subject: [PATCH v0.7 1/6] wifi: add 'scanning' property which is TRUE while device is scanning
- Date: Fri, 18 Sep 2009 19:12:52 +0100 (BST)
---
src/nm-device-wifi.c | 34 ++++++++++++++++++++++++++++++++++
src/nm-device-wifi.h | 1 +
2 files changed, 35 insertions(+), 0 deletions(-)
diff --git a/src/nm-device-wifi.c b/src/nm-device-wifi.c
index 2b62b8b..bf03bb7 100644
--- a/src/nm-device-wifi.c
+++ b/src/nm-device-wifi.c
@@ -81,6 +81,7 @@ enum {
PROP_BITRATE,
PROP_ACTIVE_ACCESS_POINT,
PROP_CAPABILITIES,
+ PROP_SCANNING,
LAST_PROP
};
@@ -125,6 +126,7 @@ typedef struct Supplicant {
guint iface_scan_request_result_id;
guint iface_scan_results_id;
guint iface_con_state_id;
+ guint iface_notify_scanning_id;
/* Timeouts and idles */
guint iface_con_error_cb_id;
@@ -215,6 +217,10 @@ static void supplicant_mgr_state_cb (NMSupplicantInterface * iface,
guint32 old_state,
NMDeviceWifi *self);
+static void supplicant_iface_notify_scanning_cb (NMSupplicantInterface * iface,
+ GParamSpec * pspec,
+ NMDeviceWifi * self);
+
static guint32 nm_device_wifi_get_bitrate (NMDeviceWifi *self);
static void cull_scan_list (NMDeviceWifi *self);
@@ -625,6 +631,12 @@ supplicant_interface_acquire (NMDeviceWifi *self)
self);
priv->supplicant.iface_con_state_id = id;
+ id = g_signal_connect (priv->supplicant.iface,
+ "notify::scanning",
+ G_CALLBACK (supplicant_iface_notify_scanning_cb),
+ self);
+ priv->supplicant.iface_notify_scanning_id = id;
+
return TRUE;
}
@@ -716,6 +728,11 @@ supplicant_interface_release (NMDeviceWifi *self)
priv->supplicant.iface_con_state_id = 0;
}
+ if (priv->supplicant.iface_notify_scanning_id > 0) {
+ g_signal_handler_disconnect (priv->supplicant.iface, priv->supplicant.iface_notify_scanning_id);
+ priv->supplicant.iface_notify_scanning_id = 0;
+ }
+
if (priv->supplicant.iface) {
/* Tell the supplicant to disconnect from the current AP */
nm_supplicant_interface_disconnect (priv->supplicant.iface);
@@ -2447,6 +2464,14 @@ supplicant_iface_connection_error_cb (NMSupplicantInterface * iface,
}
static void
+supplicant_iface_notify_scanning_cb (NMSupplicantInterface * iface,
+ GParamSpec * pspec,
+ NMDeviceWifi * self)
+{
+ g_object_notify (G_OBJECT (self), "scanning");
+}
+
+static void
remove_supplicant_connection_timeout (NMDeviceWifi *self)
{
NMDeviceWifiPrivate *priv;
@@ -3237,6 +3262,9 @@ get_property (GObject *object, guint prop_id,
else
g_value_set_boxed (value, "/");
break;
+ case PROP_SCANNING:
+ g_value_set_boolean (value, nm_supplicant_interface_get_scanning (priv->supplicant.iface));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -3315,6 +3343,12 @@ nm_device_wifi_class_init (NMDeviceWifiClass *klass)
0, G_MAXUINT32, NM_WIFI_DEVICE_CAP_NONE,
G_PARAM_READABLE));
+ g_object_class_install_property (object_class, PROP_SCANNING,
+ g_param_spec_boolean (NM_DEVICE_WIFI_SCANNING,
+ "Scanning",
+ "Scanning",
+ 0, G_PARAM_READABLE));
+
/* Signals */
signals[ACCESS_POINT_ADDED] =
g_signal_new ("access-point-added",
diff --git a/src/nm-device-wifi.h b/src/nm-device-wifi.h
index 1e885cb..c53a50c 100644
--- a/src/nm-device-wifi.h
+++ b/src/nm-device-wifi.h
@@ -47,6 +47,7 @@ G_BEGIN_DECLS
#define NM_DEVICE_WIFI_BITRATE "bitrate"
#define NM_DEVICE_WIFI_ACTIVE_ACCESS_POINT "active-access-point"
#define NM_DEVICE_WIFI_CAPABILITIES "wireless-capabilities"
+#define NM_DEVICE_WIFI_SCANNING "scanning"
#ifndef NM_DEVICE_WIFI_DEFINED
#define NM_DEVICE_WIFI_DEFINED
--
1.6.4
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]