libnm/client: emit signals when active connection disappears
It allows us to reliably track failures to activate a connection.
This commit is contained in:
@@ -89,6 +89,8 @@ enum {
|
|||||||
PERMISSION_CHANGED,
|
PERMISSION_CHANGED,
|
||||||
CONNECTION_ADDED,
|
CONNECTION_ADDED,
|
||||||
CONNECTION_REMOVED,
|
CONNECTION_REMOVED,
|
||||||
|
ACTIVE_CONNECTION_ADDED,
|
||||||
|
ACTIVE_CONNECTION_REMOVED,
|
||||||
|
|
||||||
LAST_SIGNAL
|
LAST_SIGNAL
|
||||||
};
|
};
|
||||||
@@ -1751,6 +1753,22 @@ settings_connection_removed (NMRemoteSettings *manager,
|
|||||||
g_signal_emit (client, signals[CONNECTION_REMOVED], 0, connection);
|
g_signal_emit (client, signals[CONNECTION_REMOVED], 0, connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
static void
|
||||||
constructed (GObject *object)
|
constructed (GObject *object)
|
||||||
{
|
{
|
||||||
@@ -1772,6 +1790,10 @@ constructed (GObject *object)
|
|||||||
G_CALLBACK (manager_any_device_removed), client);
|
G_CALLBACK (manager_any_device_removed), client);
|
||||||
g_signal_connect (priv->manager, "permission-changed",
|
g_signal_connect (priv->manager, "permission-changed",
|
||||||
G_CALLBACK (manager_permission_changed), client);
|
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,
|
priv->settings = g_object_new (NM_TYPE_REMOTE_SETTINGS,
|
||||||
NM_OBJECT_PATH, NM_DBUS_PATH_SETTINGS,
|
NM_OBJECT_PATH, NM_DBUS_PATH_SETTINGS,
|
||||||
@@ -2353,6 +2375,36 @@ nm_client_class_init (NMClientClass *client_class)
|
|||||||
NULL, NULL, NULL,
|
NULL, NULL, NULL,
|
||||||
G_TYPE_NONE, 1,
|
G_TYPE_NONE, 1,
|
||||||
NM_TYPE_REMOTE_CONNECTION);
|
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
|
static void
|
||||||
|
@@ -66,6 +66,8 @@ G_BEGIN_DECLS
|
|||||||
#define NM_CLIENT_PERMISSION_CHANGED "permission-changed"
|
#define NM_CLIENT_PERMISSION_CHANGED "permission-changed"
|
||||||
#define NM_CLIENT_CONNECTION_ADDED "connection-added"
|
#define NM_CLIENT_CONNECTION_ADDED "connection-added"
|
||||||
#define NM_CLIENT_CONNECTION_REMOVED "connection-removed"
|
#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:
|
* NMClientPermission:
|
||||||
|
Reference in New Issue
Block a user