edbus: Add Disconnected event in connection

Patch by: José Roberto de Souza  <zehortigoza@profusion.mobi>



SVN revision: 80693
This commit is contained in:
José Roberto de Souza 2012-12-11 19:50:29 +00:00 committed by Lucas De Marchi
parent 1956b12fa0
commit 80adffbdb0
2 changed files with 12 additions and 0 deletions

View File

@ -101,6 +101,7 @@ EAPI void *edbus_connection_data_del(EDBus_Connection *conn, const c
typedef enum
{
EDBUS_CONNECTION_EVENT_DEL,
EDBUS_CONNECTION_DISCONNECTED,
EDBUS_CONNECTION_EVENT_LAST /**< sentinel, not a real event type */
} EDBus_Connection_Event_Type;

View File

@ -908,6 +908,14 @@ edbus_connection_setup(EDBus_Connection *conn)
conn);
}
static void
_disconnected(void *data, const EDBus_Message *msg)
{
EDBus_Connection *conn = data;
_edbus_connection_event_callback_call(conn, EDBUS_CONNECTION_DISCONNECTED,
NULL);
}
static EDBus_Connection *
_connection_get(EDBus_Connection_Type type)
{
@ -935,6 +943,9 @@ _connection_get(EDBus_Connection_Type type)
EINA_MAGIC_SET(conn, EDBUS_CONNECTION_MAGIC);
conn->names = eina_hash_string_superfast_new(NULL);
edbus_signal_handler_add(conn, NULL, DBUS_PATH_LOCAL, DBUS_INTERFACE_LOCAL,
"Disconnected", _disconnected, conn);
DBG("Returned new connection at %p", conn);
return conn;
}