summaryrefslogtreecommitdiff
path: root/libnm
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2016-07-07 11:35:19 +0200
committerLubomir Rintel <lkundrak@v3.sk>2016-07-07 11:56:05 +0200
commit12290252c7948886caac1014a04b57daf87b215c (patch)
treebb1888c6655ad003c56c50aa8996eb96abbfc877 /libnm
parentf24d44ee875e065957a0f12dd74657f503ca5b5d (diff)
downloadNetworkManager-12290252c7948886caac1014a04b57daf87b215c.tar.gz
libnm/client: emit signals when active connection disappears
It allows us to reliably track failures to activate a connection.
Diffstat (limited to 'libnm')
-rw-r--r--libnm/nm-client.c52
-rw-r--r--libnm/nm-client.h2
2 files changed, 54 insertions, 0 deletions
diff --git a/libnm/nm-client.c b/libnm/nm-client.c
index a7ecdb5572..4b375581c1 100644
--- a/libnm/nm-client.c
+++ b/libnm/nm-client.c
@@ -89,6 +89,8 @@ enum {
PERMISSION_CHANGED,
CONNECTION_ADDED,
CONNECTION_REMOVED,
+ ACTIVE_CONNECTION_ADDED,
+ ACTIVE_CONNECTION_REMOVED,
LAST_SIGNAL
};
@@ -1752,6 +1754,22 @@ settings_connection_removed (NMRemoteSettings *manager,
}
static void
+manager_active_connection_added (NMManager *manager,
+ NMActiveConnection *active_connection,
+ gpointer client)
+{
+ g_signal_emit (client, signals[ACTIVE_CONNECTION_ADDED], 0, active_connection);
+}
+
+static void
+manager_active_connection_removed (NMManager *manager,
+ NMActiveConnection *active_connection,
+ gpointer client)
+{
+ g_signal_emit (client, signals[ACTIVE_CONNECTION_REMOVED], 0, active_connection);
+}
+
+static void
constructed (GObject *object)
{
NMClient *client = NM_CLIENT (object);
@@ -1772,6 +1790,10 @@ constructed (GObject *object)
G_CALLBACK (manager_any_device_removed), client);
g_signal_connect (priv->manager, "permission-changed",
G_CALLBACK (manager_permission_changed), client);
+ g_signal_connect (priv->manager, "active-connection-added",
+ G_CALLBACK (manager_active_connection_added), client);
+ g_signal_connect (priv->manager, "active-connection-removed",
+ G_CALLBACK (manager_active_connection_removed), client);
priv->settings = g_object_new (NM_TYPE_REMOTE_SETTINGS,
NM_OBJECT_PATH, NM_DBUS_PATH_SETTINGS,
@@ -2353,6 +2375,36 @@ nm_client_class_init (NMClientClass *client_class)
NULL, NULL, NULL,
G_TYPE_NONE, 1,
NM_TYPE_REMOTE_CONNECTION);
+
+ /**
+ * NMClient::active-connection-added:
+ * @client: the settings object that received the signal
+ * @active_connection: the new active connection
+ *
+ * Notifies that a #NMActiveConnection has been added.
+ **/
+ signals[ACTIVE_CONNECTION_ADDED] =
+ g_signal_new (NM_CLIENT_ACTIVE_CONNECTION_ADDED,
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST,
+ 0, NULL, NULL, NULL,
+ G_TYPE_NONE, 1,
+ NM_TYPE_ACTIVE_CONNECTION);
+
+ /**
+ * NMClient::active-connection-removed:
+ * @client: the settings object that received the signal
+ * @active_connection: the removed active connection
+ *
+ * Notifies that a #NMActiveConnection has been removed.
+ **/
+ signals[ACTIVE_CONNECTION_REMOVED] =
+ g_signal_new (NM_CLIENT_ACTIVE_CONNECTION_REMOVED,
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST,
+ 0, NULL, NULL, NULL,
+ G_TYPE_NONE, 1,
+ NM_TYPE_ACTIVE_CONNECTION);
}
static void
diff --git a/libnm/nm-client.h b/libnm/nm-client.h
index 6bae78fa47..a496d9ad2e 100644
--- a/libnm/nm-client.h
+++ b/libnm/nm-client.h
@@ -66,6 +66,8 @@ G_BEGIN_DECLS
#define NM_CLIENT_PERMISSION_CHANGED "permission-changed"
#define NM_CLIENT_CONNECTION_ADDED "connection-added"
#define NM_CLIENT_CONNECTION_REMOVED "connection-removed"
+#define NM_CLIENT_ACTIVE_CONNECTION_ADDED "active-connection-added"
+#define NM_CLIENT_ACTIVE_CONNECTION_REMOVED "active-connection-removed"
/**
* NMClientPermission: