mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-10-14 12:05:03 +00:00
vpn: emit both new and old states in state-changed signal
Various listeners (well, really only the policy) will want the old state too.
This commit is contained in:
parent
cb0c2b4e82
commit
330247399c
|
@ -926,7 +926,8 @@ vpn_connection_activated (NMVPNManager *manager,
|
|||
static void
|
||||
vpn_connection_deactivated (NMVPNManager *manager,
|
||||
NMVPNConnection *vpn,
|
||||
NMVPNConnectionState state,
|
||||
NMVPNConnectionState new_state,
|
||||
NMVPNConnectionState old_state,
|
||||
NMVPNConnectionStateReason reason,
|
||||
gpointer user_data)
|
||||
{
|
||||
|
|
|
@ -266,7 +266,7 @@ nm_vpn_connection_set_vpn_state (NMVPNConnection *connection,
|
|||
*/
|
||||
g_object_ref (connection);
|
||||
|
||||
g_signal_emit (connection, signals[VPN_STATE_CHANGED], 0, vpn_state, reason);
|
||||
g_signal_emit (connection, signals[VPN_STATE_CHANGED], 0, vpn_state, old_vpn_state, reason);
|
||||
g_object_notify (G_OBJECT (connection), NM_VPN_CONNECTION_VPN_STATE);
|
||||
|
||||
switch (vpn_state) {
|
||||
|
@ -1649,8 +1649,8 @@ nm_vpn_connection_class_init (NMVPNConnectionClass *connection_class)
|
|||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
0, NULL, NULL,
|
||||
_nm_marshal_VOID__UINT_UINT,
|
||||
G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_UINT);
|
||||
_nm_marshal_VOID__UINT_UINT_UINT,
|
||||
G_TYPE_NONE, 3, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT);
|
||||
|
||||
dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (object_class),
|
||||
&dbus_glib_nm_vpn_connection_object_info);
|
||||
|
|
|
@ -51,7 +51,8 @@ typedef struct {
|
|||
|
||||
/* Signals */
|
||||
void (*vpn_state_changed) (NMVPNConnection *connection,
|
||||
NMVPNConnectionState state,
|
||||
NMVPNConnectionState new_state,
|
||||
NMVPNConnectionState old_state,
|
||||
NMVPNConnectionStateReason reason);
|
||||
} NMVPNConnectionClass;
|
||||
|
||||
|
|
|
@ -115,19 +115,20 @@ find_active_vpn_connection_by_connection (NMVPNManager *self, NMConnection *conn
|
|||
|
||||
static void
|
||||
connection_vpn_state_changed (NMVPNConnection *connection,
|
||||
NMVPNConnectionState state,
|
||||
NMVPNConnectionState new_state,
|
||||
NMVPNConnectionState old_state,
|
||||
NMVPNConnectionStateReason reason,
|
||||
gpointer user_data)
|
||||
{
|
||||
NMVPNManager *manager = NM_VPN_MANAGER (user_data);
|
||||
|
||||
switch (state) {
|
||||
switch (new_state) {
|
||||
case NM_VPN_CONNECTION_STATE_ACTIVATED:
|
||||
g_signal_emit (manager, signals[CONNECTION_ACTIVATED], 0, connection);
|
||||
break;
|
||||
case NM_VPN_CONNECTION_STATE_FAILED:
|
||||
case NM_VPN_CONNECTION_STATE_DISCONNECTED:
|
||||
g_signal_emit (manager, signals[CONNECTION_DEACTIVATED], 0, connection, state, reason);
|
||||
g_signal_emit (manager, signals[CONNECTION_DEACTIVATED], 0, connection, new_state, old_state, reason);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -520,9 +521,8 @@ nm_vpn_manager_class_init (NMVPNManagerClass *manager_class)
|
|||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (NMVPNManagerClass, connection_deactivated),
|
||||
NULL, NULL,
|
||||
_nm_marshal_VOID__OBJECT_UINT_UINT,
|
||||
G_TYPE_NONE, 3,
|
||||
G_TYPE_OBJECT, G_TYPE_UINT, G_TYPE_UINT);
|
||||
_nm_marshal_VOID__OBJECT_UINT_UINT_UINT,
|
||||
G_TYPE_NONE, 3, G_TYPE_OBJECT, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT);
|
||||
|
||||
dbus_g_error_domain_register (NM_VPN_MANAGER_ERROR, NULL, NM_TYPE_VPN_MANAGER_ERROR);
|
||||
}
|
||||
|
|
|
@ -57,7 +57,8 @@ typedef struct {
|
|||
/* Signals */
|
||||
void (*connection_deactivated) (NMVPNManager *manager,
|
||||
NMVPNConnection *connection,
|
||||
NMVPNConnectionState state,
|
||||
NMVPNConnectionState new_state,
|
||||
NMVPNConnectionState old_state,
|
||||
NMVPNConnectionStateReason reason);
|
||||
} NMVPNManagerClass;
|
||||
|
||||
|
|
Loading…
Reference in a new issue