From 737e08aa766744772b07bf1f35f3aa50d9bf63f0 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Thu, 2 Oct 2008 17:51:28 -0300 Subject: Add code to emit PropertyChanged on network interface. --- network/connection.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'network') diff --git a/network/connection.c b/network/connection.c index 0f6f6c2d..b2f81991 100644 --- a/network/connection.c +++ b/network/connection.c @@ -137,10 +137,27 @@ static gboolean bnep_watchdog_cb(GIOChannel *chan, GIOCondition cond, if (connection != NULL) { const char *device = nc->dev; + gboolean connected = FALSE; + const char *property = ""; g_dbus_emit_signal(connection, nc->peer->path, NETWORK_PEER_INTERFACE, "Disconnected", DBUS_TYPE_STRING, &device, DBUS_TYPE_INVALID); + dbus_connection_emit_property_changed(connection, + nc->peer->path, + NETWORK_PEER_INTERFACE, + "Connected", + DBUS_TYPE_BOOLEAN, &connected); + dbus_connection_emit_property_changed(connection, + nc->peer->path, + NETWORK_PEER_INTERFACE, + "Device", + DBUS_TYPE_STRING, &property); + dbus_connection_emit_property_changed(connection, + nc->peer->path, + NETWORK_PEER_INTERFACE, + "UUID", + DBUS_TYPE_STRING, &property); } info("%s disconnected", nc->dev); @@ -165,6 +182,7 @@ static gboolean bnep_connect_cb(GIOChannel *chan, GIOCondition cond, int sk; DBusMessage *reply; const char *pdev, *uuid; + gboolean connected; if (cond & G_IO_NVAL) return FALSE; @@ -229,11 +247,21 @@ static gboolean bnep_connect_cb(GIOChannel *chan, GIOCondition cond, DBUS_TYPE_STRING, &pdev, DBUS_TYPE_INVALID); + connected = TRUE; g_dbus_emit_signal(connection, nc->peer->path, NETWORK_PEER_INTERFACE, "Connected", DBUS_TYPE_STRING, &pdev, DBUS_TYPE_STRING, &uuid, DBUS_TYPE_INVALID); + dbus_connection_emit_property_changed(connection, nc->peer->path, + NETWORK_PEER_INTERFACE, "Connected", + DBUS_TYPE_BOOLEAN, &connected); + dbus_connection_emit_property_changed(connection, nc->peer->path, + NETWORK_PEER_INTERFACE, "Device", + DBUS_TYPE_BOOLEAN, &pdev); + dbus_connection_emit_property_changed(connection, nc->peer->path, + NETWORK_PEER_INTERFACE, "UUID", + DBUS_TYPE_BOOLEAN, &uuid); nc->state = CONNECTED; -- cgit