Commit 4d635b23 authored by Jiří Klimeš's avatar Jiří Klimeš

libnm-glib: fix vpn-state-changed signal handling

Core D-Bus VpnStateChanged signal changed. In order to receive the signal,
the parameters was fixed. This commit also adjusts libnm-glib's vpn-state-changed
signal to match the D-Bus one.
parent 9d853780
......@@ -127,6 +127,7 @@ nm_vpn_connection_get_vpn_state (NMVPNConnection *vpn)
static void
vpn_state_changed_proxy (DBusGProxy *proxy,
NMVPNConnectionState vpn_state,
NMVPNConnectionState old_vpn_state,
NMVPNConnectionStateReason reason,
gpointer user_data)
{
......@@ -135,7 +136,7 @@ vpn_state_changed_proxy (DBusGProxy *proxy,
if (priv->vpn_state != vpn_state) {
priv->vpn_state = vpn_state;
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);
}
}
......@@ -174,20 +175,20 @@ constructed (GObject *object)
priv = NM_VPN_CONNECTION_GET_PRIVATE (object);
priv->proxy = dbus_g_proxy_new_for_name (nm_object_get_connection (NM_OBJECT (object)),
NM_DBUS_SERVICE,
nm_object_get_path (NM_OBJECT (object)),
NM_DBUS_INTERFACE_VPN_CONNECTION);
NM_DBUS_SERVICE,
nm_object_get_path (NM_OBJECT (object)),
NM_DBUS_INTERFACE_VPN_CONNECTION);
dbus_g_object_register_marshaller (_nm_glib_marshal_VOID__UINT_UINT,
dbus_g_object_register_marshaller (_nm_glib_marshal_VOID__UINT_UINT_UINT,
G_TYPE_NONE,
G_TYPE_UINT, G_TYPE_UINT,
G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT,
G_TYPE_INVALID);
dbus_g_proxy_add_signal (priv->proxy, "VpnStateChanged", G_TYPE_UINT, G_TYPE_UINT, G_TYPE_INVALID);
dbus_g_proxy_add_signal (priv->proxy, "VpnStateChanged", G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_INVALID);
dbus_g_proxy_connect_signal (priv->proxy,
"VpnStateChanged",
G_CALLBACK (vpn_state_changed_proxy),
object,
NULL);
"VpnStateChanged",
G_CALLBACK (vpn_state_changed_proxy),
object,
NULL);
register_properties (NM_VPN_CONNECTION (object));
}
......@@ -267,13 +268,22 @@ nm_vpn_connection_class_init (NMVPNConnectionClass *connection_class)
G_PARAM_READABLE));
/* signals */
/**
* NMVPNConnection::vpn-state-changed:
* @connection: the VPN connection that received the signal
* @new_state: the new state of the VPN connection
* @old_state: the previous state of the VPN connection
* @reason: the reason for changing the state
*
* Notifies the state change of a #NMVPNConnection.
**/
signals[VPN_STATE_CHANGED] =
g_signal_new ("vpn-state-changed",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (NMVPNConnectionClass, vpn_state_changed),
NULL, NULL,
_nm_glib_marshal_VOID__UINT_UINT,
G_TYPE_NONE, 2,
G_TYPE_UINT, G_TYPE_UINT);
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (NMVPNConnectionClass, vpn_state_changed),
NULL, NULL,
_nm_glib_marshal_VOID__UINT_UINT_UINT,
G_TYPE_NONE, 3, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT);
}
......@@ -18,7 +18,7 @@
* Boston, MA 02110-1301 USA.
*
* Copyright (C) 2007 - 2008 Novell, Inc.
* Copyright (C) 2007 - 2010 Red Hat, Inc.
* Copyright (C) 2007 - 2012 Red Hat, Inc.
*/
#ifndef NM_VPN_CONNECTION_H
......@@ -51,7 +51,8 @@ typedef struct {
/* Signals */
void (*vpn_state_changed) (NMVPNConnection *connection,
NMVPNConnectionState state,
NMVPNConnectionState new_state,
NMVPNConnectionState old_state,
NMVPNConnectionStateReason reason);
/* Padding for future expansion */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment