summaryrefslogtreecommitdiff
path: root/libnm
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2014-10-10 14:06:44 -0400
committerDan Winship <danw@gnome.org>2014-10-19 09:26:49 -0400
commita9e906fcbd0fb06a9d435e7a1db21a0f91521669 (patch)
treeb075d971e2c12825ca41b1c80ddb8bd2dbc7867b /libnm
parent2ac83c0e8b06de9ebfce3038c1afb01061f6e680 (diff)
downloadNetworkManager-a9e906fcbd0fb06a9d435e7a1db21a0f91521669.tar.gz
libnm: add -added and -removed signals for ACs to NMManager
Diffstat (limited to 'libnm')
-rw-r--r--libnm/nm-manager.c21
-rw-r--r--libnm/nm-manager.h2
2 files changed, 22 insertions, 1 deletions
diff --git a/libnm/nm-manager.c b/libnm/nm-manager.c
index 24d7080b65..f2e6fd0ed1 100644
--- a/libnm/nm-manager.c
+++ b/libnm/nm-manager.c
@@ -105,6 +105,8 @@ enum {
enum {
DEVICE_ADDED,
DEVICE_REMOVED,
+ ACTIVE_CONNECTION_ADDED,
+ ACTIVE_CONNECTION_REMOVED,
PERMISSION_CHANGED,
LAST_SIGNAL
@@ -170,7 +172,7 @@ init_dbus (NMObject *object)
{ NM_MANAGER_WWAN_HARDWARE_ENABLED, &priv->wwan_hw_enabled },
{ NM_MANAGER_WIMAX_ENABLED, &priv->wimax_enabled },
{ NM_MANAGER_WIMAX_HARDWARE_ENABLED, &priv->wimax_hw_enabled },
- { NM_MANAGER_ACTIVE_CONNECTIONS, &priv->active_connections, NULL, NM_TYPE_ACTIVE_CONNECTION },
+ { NM_MANAGER_ACTIVE_CONNECTIONS, &priv->active_connections, NULL, NM_TYPE_ACTIVE_CONNECTION, "active-connection" },
{ NM_MANAGER_CONNECTIVITY, &priv->connectivity },
{ NM_MANAGER_PRIMARY_CONNECTION, &priv->primary_connection, NULL, NM_TYPE_ACTIVE_CONNECTION },
{ NM_MANAGER_ACTIVATING_CONNECTION, &priv->activating_connection, NULL, NM_TYPE_ACTIVE_CONNECTION },
@@ -1100,6 +1102,7 @@ free_active_connections (NMManager *manager, gboolean in_dispose)
for (i = 0; i < active_connections->len; i++) {
active_connection = active_connections->pdata[i];
+ g_signal_emit (manager, signals[ACTIVE_CONNECTION_REMOVED], 0, active_connection);
/* Break circular refs */
g_object_run_dispose (G_OBJECT (active_connection));
}
@@ -1571,6 +1574,22 @@ nm_manager_class_init (NMManagerClass *manager_class)
NULL, NULL, NULL,
G_TYPE_NONE, 1,
G_TYPE_OBJECT);
+ signals[ACTIVE_CONNECTION_ADDED] =
+ g_signal_new ("active-connection-added",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (NMManagerClass, active_connection_added),
+ NULL, NULL, NULL,
+ G_TYPE_NONE, 1,
+ G_TYPE_OBJECT);
+ signals[ACTIVE_CONNECTION_REMOVED] =
+ g_signal_new ("active-connection-removed",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (NMManagerClass, active_connection_removed),
+ NULL, NULL, NULL,
+ G_TYPE_NONE, 1,
+ G_TYPE_OBJECT);
signals[PERMISSION_CHANGED] =
g_signal_new ("permission-changed",
G_OBJECT_CLASS_TYPE (object_class),
diff --git a/libnm/nm-manager.h b/libnm/nm-manager.h
index 430b038e03..ca9f7dd60b 100644
--- a/libnm/nm-manager.h
+++ b/libnm/nm-manager.h
@@ -61,6 +61,8 @@ typedef struct {
/* Signals */
void (*device_added) (NMManager *manager, NMDevice *device);
void (*device_removed) (NMManager *manager, NMDevice *device);
+ void (*active_connection_added) (NMManager *manager, NMActiveConnection *ac);
+ void (*active_connection_removed) (NMManager *manager, NMActiveConnection *ac);
void (*permission_changed) (NMManager *manager,
NMClientPermission permission,
NMClientPermissionResult result);