aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog12
-rw-r--r--configure.ac23
-rw-r--r--lib/ephy-dbus.c18
3 files changed, 50 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 00a2152fa..84f58589c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2005-05-28 Christian Persch <chpe@cvs.gnome.org>
+
+ * configure.ac:
+
+ Check for new DBUS API.
+
+ * lib/ephy-dbus.c: (session_filter_func), (system_filter_func),
+ (ephy_dbus_connect_to_system_bus),
+ (ephy_dbus_connect_to_session_bus):
+
+ Adapt to new DBUS API. Patch by Thom May, fixes bug #301153.
+
2005-05-26 Christian Persch <chpe@cvs.gnome.org>
* configure.ac:
diff --git a/configure.ac b/configure.ac
index 0880c125f..d17dc2b70 100644
--- a/configure.ac
+++ b/configure.ac
@@ -450,10 +450,27 @@ AC_ARG_ENABLE([dbus],
AC_MSG_RESULT([$enable_dbus])
-DBUS_REQUIRED=0.22
-DBUS_GLIB_REQUIRED=0.22
-
if test "x$enable_dbus" = "xyes" ; then
+
+ AC_MSG_CHECKING([for new DBUS API])
+
+ _SAVE_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs dbus-1`"
+ AC_TRY_LINK_FUNC([dbus_message_iter_get_boolean],[have_new_dbus=no],[have_new_dbus=yes])
+ LDFLAGS="$_SAVE_LDFLAGS"
+
+ AC_MSG_RESULT([$have_new_dbus])
+
+ if test "x$have_new_dbus" = "xyes"; then
+ AC_DEFINE([HAVE_NEW_DBUS],[1],[Define if compiling with DBUS 0.3])
+
+ DBUS_REQUIRED=0.32
+ DBUS_GLIB_REQUIRED=0.32
+ else
+ DBUS_REQUIRED=0.22
+ DBUS_GLIB_REQUIRED=0.22
+ fi
+
AC_DEFINE([ENABLE_DBUS],[1],[Define if DBUS support is enabled])
EPIPHANY_FEATURES="$EPIPHANY_FEATURES dbus"
diff --git a/lib/ephy-dbus.c b/lib/ephy-dbus.c
index 349202ea8..b1f15a7ec 100644
--- a/lib/ephy-dbus.c
+++ b/lib/ephy-dbus.c
@@ -113,7 +113,11 @@ session_filter_func (DBusConnection *connection,
EphyDbus *dbus = EPHY_DBUS (user_data);
if (dbus_message_is_signal (message,
+#ifdef HAVE_NEW_DBUS
+ DBUS_INTERFACE_LOCAL,
+#else
DBUS_INTERFACE_ORG_FREEDESKTOP_LOCAL,
+#endif
"Disconnected"))
{
LOG ("EphyDbus disconnected from session bus");
@@ -143,7 +147,11 @@ system_filter_func (DBusConnection *connection,
LOG ("EphyDbus filtering message from system bus");
if (dbus_message_is_signal (message,
+#ifdef HAVE_NEW_DBUS
+ DBUS_INTERFACE_LOCAL,
+#else
DBUS_INTERFACE_ORG_FREEDESKTOP_LOCAL,
+#endif
"Disconnected"))
{
LOG ("EphyDbus disconnected from system bus");
@@ -180,7 +188,12 @@ ephy_dbus_connect_to_system_bus (EphyDbus *dbus)
dbus_connection_set_exit_on_disconnect (bus, FALSE);
dbus_connection_setup_with_g_main (bus, NULL);
+#ifdef HAVE_NEW_DBUS
+ dbus_bus_request_name (bus, epiphany_dbus_service, 0, &error);
+#else
dbus_connection_add_filter (bus, system_filter_func, dbus, NULL);
+#endif
+
dbus_bus_add_match (bus,
"type='signal',interface='org.freedesktop.NetworkManager'",
&error);
@@ -214,7 +227,12 @@ ephy_dbus_connect_to_session_bus (EphyDbus *dbus)
dbus_connection_add_filter (bus, session_filter_func, dbus, NULL);
+#ifdef HAVE_NEW_DBUS
+ dbus_bus_request_name (bus, epiphany_dbus_service, 0, NULL);
+#else
dbus_bus_acquire_service (bus, epiphany_dbus_service, 0, &error);
+#endif
+
if (dbus_error_is_set (&error)) {
g_warning ("EphyDbus failed to acquire epiphany service");
dbus_error_free (&error);