summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Persch <chpe@gnome.org>2010-05-07 19:48:10 +0200
committerChristian Persch <chpe@gnome.org>2010-08-18 11:49:40 +0200
commit7cbf3d843102d25c766c3ae8e167d91c287fa13b (patch)
treecfc2e8f4199e2060b238faa538315c2458f33e2f
parentdfb5eaffb71a423592df228c09bb4a44bda05d6d (diff)
downloadgconf-7cbf3d843102d25c766c3ae8e167d91c287fa13b.tar.gz
Port libgconf-2 to GDBus
This makes libgconf-2 not link to libdbus anymore, which means libgconf-2 is LGPL2+ again! Bug #618039.
-rw-r--r--configure.in7
-rw-r--r--gconf-2.0.pc.in2
-rw-r--r--gconf/Makefile.am8
-rw-r--r--gconf/gconf-internals.c66
4 files changed, 41 insertions, 42 deletions
diff --git a/configure.in b/configure.in
index 156ed48c..a465c9c6 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 gio-2.0 >= 2.25.9'
+PKGCONFIG_MODULES='glib-2.0 > 2.14.0 gio-2.0 >= 2.25.9 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 8734b135..9e99a369 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 gio-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 b4aca94e..1dcfbe15 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 0a5500f1..8b277616 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,44 @@ 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 ("()"),
+ G_VARIANT_TYPE ("(s)"),
+ start_if_not_found ? G_DBUS_CALL_FLAGS_NONE
+ : 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;
}