[RFC PATCH 3/8] iwd: Emit known-networks-changed signals from NMIwdManager
- From: Andrew Zaborowski <andrew zaborowski intel com>
- To: networkmanager-list gnome org
- Subject: [RFC PATCH 3/8] iwd: Emit known-networks-changed signals from NMIwdManager
- Date: Tue, 12 Jun 2018 10:21:37 +0200
Emit a signal when NMIwdManager learns that a KnownNetwork has been
added or removed and when the list has been initially loaded.
---
src/devices/wifi/nm-iwd-manager.c | 26 ++++++++++++++++++++++++++
src/devices/wifi/nm-iwd-manager.h | 3 +++
2 files changed, 29 insertions(+)
diff --git a/src/devices/wifi/nm-iwd-manager.c b/src/devices/wifi/nm-iwd-manager.c
index 2da6db0e4..8897f43a4 100644
--- a/src/devices/wifi/nm-iwd-manager.c
+++ b/src/devices/wifi/nm-iwd-manager.c
@@ -33,6 +33,14 @@
/*****************************************************************************/
+enum {
+ KNOWN_NETWORKS_CHANGED,
+
+ LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
typedef struct {
NMManager *manager;
GCancellable *cancellable;
@@ -412,6 +420,8 @@ next:
g_variant_iter_free (networks);
+ g_signal_emit (self, signals[KNOWN_NETWORKS_CHANGED], 0, priv->known_networks);
+
/* For completness we may want to call nm_device_emit_recheck_auto_activate
* and nm_device_recheck_available_connections for all affected devices
* now but the ListKnownNetworks call should have been really fast,
@@ -468,6 +478,12 @@ name_owner_changed (GObject *object, GParamSpec *pspec, gpointer user_data)
NULL);
}
}
+
+ if (priv->known_networks) {
+ g_slist_free_full (priv->known_networks, (GDestroyNotify) known_network_free);
+ priv->known_networks = NULL;
+ g_signal_emit (self, signals[KNOWN_NETWORKS_CHANGED], 0, NULL);
+ }
}
}
@@ -619,6 +635,8 @@ nm_iwd_manager_network_connected (NMIwdManager *self, const gchar *name,
network_data->name = g_strdup (name);
network_data->security = security;
priv->known_networks = g_slist_append (priv->known_networks, network_data);
+
+ g_signal_emit (self, signals[KNOWN_NETWORKS_CHANGED], 0, priv->known_networks);
}
/*****************************************************************************/
@@ -685,4 +703,12 @@ nm_iwd_manager_class_init (NMIwdManagerClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->dispose = dispose;
+
+ signals[KNOWN_NETWORKS_CHANGED] =
+ g_signal_new (NM_IWD_MANAGER_KNOWN_NETWORKS_CHANGED,
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST,
+ 0, NULL, NULL, NULL,
+ G_TYPE_NONE, 1,
+ G_TYPE_POINTER);
}
diff --git a/src/devices/wifi/nm-iwd-manager.h b/src/devices/wifi/nm-iwd-manager.h
index 80b430f0f..96b5e2c26 100644
--- a/src/devices/wifi/nm-iwd-manager.h
+++ b/src/devices/wifi/nm-iwd-manager.h
@@ -55,6 +55,9 @@ typedef struct {
#define NM_IS_IWD_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_IWD_MANAGER))
#define NM_IWD_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_IWD_MANAGER,
NMIwdManagerClass))
+/* signals */
+#define NM_IWD_MANAGER_KNOWN_NETWORKS_CHANGED "known-networks-changed"
+
typedef struct _NMIwdManager NMIwdManager;
typedef struct _NMIwdManagerClass NMIwdManagerClass;
--
2.14.1
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]