[gconf/gdbus: 1/3] Use GDBus for libgconf-2
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gconf/gdbus: 1/3] Use GDBus for libgconf-2
- Date: Wed, 12 May 2010 22:13:52 +0000 (UTC)
commit 71324362b85328dbd2e7e6c4e107edfb17d17d59
Author: Christian Persch <chpe gnome org>
Date: Fri May 7 19:48:10 2010 +0200
Use GDBus for libgconf-2
Port libgconf-2 to GDBus, removing libdbus and libdbus-glib. libgconf-2
is now LGPL-2+ again!
Note that gconfd-2 itself still uses libdbus[-glib].
Bug #618039.
configure.in | 7 ++++-
gconf-2.0.pc.in | 2 +-
gconf/Makefile.am | 8 +++--
gconf/gconf-internals.c | 64 +++++++++++++++++++---------------------------
4 files changed, 39 insertions(+), 42 deletions(-)
---
diff --git a/configure.in b/configure.in
index 6c9ec26..8460bec 100644
--- a/configure.in
+++ b/configure.in
@@ -144,10 +144,11 @@ AC_ARG_ENABLE(gtk,
[Enable GTK+ support (for gconf-sanity-check) @<:@default=auto@:>@]),
, enable_gtk=auto)
-PKGCONFIG_MODULES='glib-2.0 > 2.14.0 gthread-2.0 gmodule-2.0 >= 2.7.0 gobject-2.0 >= 2.7.0 ORBit-2.0 >= 2.4.0 dbus-1 >= 1.0.0 dbus-glib-1 >= 0.74'
+PKGCONFIG_MODULES='glib-2.0 > 2.14.0 gio-2.0 >= 2.25.4 gthread-2.0 gmodule-2.0 >= 2.7.0 gobject-2.0 >= 2.7.0 ORBit-2.0 >= 2.4.0'
PKGCONFIG_MODULES_WITH_XML="$PKGCONFIG_MODULES libxml-2.0"
PKGCONFIG_MODULES_WITH_GTK=" $PKGCONFIG_MODULES gtk+-2.0 >= 2.14.0"
PKGCONFIG_MODULES_WITH_XML_AND_GTK=" $PKGCONFIG_MODULES gtk+-2.0 libxml-2.0"
+PKGCONFIG_MODULES_DBUS=" dbus-1 >= 1.0.0 dbus-glib-1 >= 0.74"
PKG_CHECK_MODULES(DEPENDENT, $PKGCONFIG_MODULES)
PKG_CHECK_MODULES(DEPENDENT_WITH_XML, $PKGCONFIG_MODULES_WITH_XML)
@@ -167,6 +168,8 @@ else
DEPENDENT_WITH_XML_AND_GTK_LIBS=$DEPENDENT_WITH_XML_LIBS
fi
+PKG_CHECK_MODULES([DEPENDENT_DBUS],[$PKGCONFIG_MODULES_DBUS])
+
AM_CONDITIONAL(GTK, [test "x$HAVE_GTK" != "xno"])
AC_SUBST(DEPENDENT_LIBS)
@@ -177,6 +180,8 @@ AC_SUBST(DEPENDENT_WITH_GTK_LIBS)
AC_SUBST(DEPENDENT_WITH_GTK_CFLAGS)
AC_SUBST(DEPENDENT_WITH_XML_AND_GTK_LIBS)
AC_SUBST(DEPENDENT_WITH_XML_AND_GTK_CFLAGS)
+AC_SUBST([DEPENDENT_DBUS_CFLAGS])
+AC_SUBST([DEPENDENT_DBUS_LIBS])
HAVE_POLKIT=no
AC_ARG_ENABLE(defaults_service,
diff --git a/gconf-2.0.pc.in b/gconf-2.0.pc.in
index 8734b13..0e8ddc4 100644
--- a/gconf-2.0.pc.in
+++ b/gconf-2.0.pc.in
@@ -9,6 +9,6 @@ Name: gconf
Description: GNOME Config System.
Version: @VERSION@
Requires: glib-2.0
-Requires.private: ORBit-2.0 dbus-1
+Requires.private: ORBit-2.0
Libs: -L${libdir} -lgconf- MAJOR_VERSION@
Cflags: -I${includedir}/gconf/@MAJOR_VERSION@
diff --git a/gconf/Makefile.am b/gconf/Makefile.am
index b4aca94..1dcfbe1 100644
--- a/gconf/Makefile.am
+++ b/gconf/Makefile.am
@@ -78,17 +78,19 @@ if OS_WIN32
gconfd_2_LDFLAGS = -mwindows
endif
-gconfd_2_LDADD = $(EFENCE) $(INTLLIBS) $(DEPENDENT_LIBS) libgconf-$(MAJOR_VERSION).la
+gconfd_2_CFLAGS = $(INCLUDES) $(DEPENDENT_DBUS_CFLAGS)
+
+gconfd_2_LDADD = libgconf-$(MAJOR_VERSION).la $(EFENCE) $(INTLLIBS) $(DEPENDENT_LIBS) $(DEPENDENT_DBUS_LIBS)
gconftool_2_SOURCES = \
gconftool.c
-gconftool_2_LDADD = $(EFENCE) $(INTLLIBS) $(DEPENDENT_WITH_XML_LIBS) libgconf-$(MAJOR_VERSION).la
+gconftool_2_LDADD = libgconf-$(MAJOR_VERSION).la $(EFENCE) $(INTLLIBS) $(DEPENDENT_WITH_XML_LIBS)
gconf_sanity_check_2_SOURCES = \
gconf-sanity-check.c
-gconf_sanity_check_2_LDADD = $(EFENCE) $(INTLLIBS) $(DEPENDENT_WITH_XML_AND_GTK_LIBS) libgconf-$(MAJOR_VERSION).la
+gconf_sanity_check_2_LDADD = libgconf-$(MAJOR_VERSION).la $(EFENCE) $(INTLLIBS) $(DEPENDENT_WITH_XML_AND_GTK_LIBS)
$(CORBA_SOURCECODE): $(srcdir)/GConfX.idl $(ORBIT_IDL)
$(ORBIT_IDL) $(srcdir)/GConfX.idl
diff --git a/gconf/gconf-internals.c b/gconf/gconf-internals.c
index 0a5500f..7c2eeab 100644
--- a/gconf/gconf-internals.c
+++ b/gconf/gconf-internals.c
@@ -36,7 +36,7 @@
#include <time.h>
#include <math.h>
-#include <dbus/dbus.h>
+#include <gio/gio.h>
#ifdef G_OS_WIN32
#include <windows.h>
@@ -2424,10 +2424,10 @@ static char *
get_ior (gboolean start_if_not_found,
GString *failure_log)
{
- DBusMessage *message, *reply;
- DBusConnection *connection;
- DBusError bus_error;
+ GDBusConnection *connection;
+ GVariant *value;
char *ior;
+ GError *error = NULL;
/* if the bus isn't running and we don't want to start gconfd then
* we don't want to autolaunch the bus either, so bail early.
@@ -2440,52 +2440,42 @@ get_ior (gboolean start_if_not_found,
return NULL;
}
- dbus_error_init (&bus_error);
- connection = dbus_bus_get (DBUS_BUS_SESSION, &bus_error);
+ g_type_init ();
- if (dbus_error_is_set (&bus_error)) {
+ connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
+ if (connection == NULL) {
if (failure_log)
g_string_append_printf (failure_log,
_("Failed to get connection to session: %s"),
- bus_error.message);
- dbus_error_free (&bus_error);
+ error->message);
+ g_error_free (error);
return NULL;
}
- message = dbus_message_new_method_call ("org.gnome.GConf",
- "/org/gnome/GConf",
- "org.gnome.GConf",
- "GetIOR");
- dbus_message_set_auto_start (message, start_if_not_found);
-
- reply = dbus_connection_send_with_reply_and_block (connection, message, -1,
- &bus_error);
- dbus_message_unref (message);
-
- if (dbus_error_is_set (&bus_error)) {
+ value = g_dbus_connection_call_sync (connection,
+ "org.gnome.GConf",
+ "/org/gnome/GConf",
+ "org.gnome.GConf",
+ "GetIOR",
+ g_variant_new ("()"),
+ start_if_not_found ? 0 : G_DBUS_CALL_FLAGS_NO_AUTO_START,
+ -1,
+ NULL,
+ &error);
+ g_object_unref (connection);
+
+ if (value == NULL) {
if (failure_log)
g_string_append_printf (failure_log,
- _("Could not send message to GConf daemon: %s"),
- bus_error.message);
- dbus_error_free (&bus_error);
- return NULL;
- }
+ _("GetIOR failed: %s"),
+ error->message);
- ior = NULL;
- if (!dbus_message_get_args (reply, &bus_error, DBUS_TYPE_STRING,
- &ior, DBUS_TYPE_INVALID)) {
- if (failure_log)
- g_string_append_printf (failure_log,
- _("daemon gave erroneous reply: %s"),
- bus_error.message);
- dbus_error_free (&bus_error);
+ g_error_free (error);
return NULL;
}
- ior = g_strdup (ior);
-
- dbus_message_unref (reply);
- dbus_connection_unref (connection);
+ g_variant_get (value, "(s)", &ior, NULL);
+ g_variant_unref (value);
return ior;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]