From bbb1288a3ff9cd6a4c6f3090b5022dda5c8a022e Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Wed, 17 Jan 2007 23:42:18 +0000 Subject: Use dbus_connection_setup_with_g_main() function when available --- common/dbus.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'common/dbus.c') diff --git a/common/dbus.c b/common/dbus.c index 070535d7..f8a2f0ac 100644 --- a/common/dbus.c +++ b/common/dbus.c @@ -34,6 +34,10 @@ #include +#ifdef HAVE_DBUS_GLIB +#include +#endif + #include "glib-ectomy.h" #include "dbus.h" #include "logging.h" @@ -375,6 +379,7 @@ static DBusHandlerResult disconnect_filter(DBusConnection *conn, return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } +#ifndef HAVE_DBUS_GLIB static gboolean message_dispatch_cb(void *data) { DBusConnection *connection = data; @@ -527,6 +532,7 @@ static void dispatch_status_cb(DBusConnection *conn, if (new_status == DBUS_DISPATCH_DATA_REMAINS) g_timeout_add(DISPATCH_TIMEOUT, message_dispatch_cb, data); } +#endif DBusConnection *init_dbus(const char *name, void (*disconnect_cb)(void *), void *user_data) { @@ -544,6 +550,9 @@ DBusConnection *init_dbus(const char *name, void (*disconnect_cb)(void *), void return NULL; } +#ifdef HAVE_DBUS_GLIB + dbus_connection_setup_with_g_main(conn, NULL); +#else dbus_connection_set_watch_functions(conn, add_watch, remove_watch, watch_toggled, conn, NULL); @@ -552,6 +561,7 @@ DBusConnection *init_dbus(const char *name, void (*disconnect_cb)(void *), void dbus_connection_set_dispatch_status_function(conn, dispatch_status_cb, conn, NULL); +#endif if (name) { dbus_error_init(&err); -- cgit