summaryrefslogtreecommitdiffstats
path: root/glib
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2004-06-20 15:28:15 +0000
committerHavoc Pennington <hp@redhat.com>2004-06-20 15:28:15 +0000
commit961e6ca41c1e9433055130569ce3492866e2126b (patch)
tree053a3e24565665462a498dee93762a83b5598004 /glib
parenteed3989ea35a62e5f58ee7fc3f50a23ad0821800 (diff)
2004-06-20 Havoc Pennington <hp@redhat.com>
* dbus/dbus-glib-error-enum.h: autogenerate the GError enum codes from the dbus error names * glib/dbus-glib.h: move to subdir dbus/ since it's included as dbus/dbus-glib.h and that breakage is now visible due to including dbus/dbus-glib.h in dbus-glib-lowlevel.h * glib/dbus-glib.h: s/gproxy/g_proxy/ * dbus/dbus-shared.h: new header to hold stuff shared with binding APIs * dbus/dbus-protocol.h (DBUS_ERROR_*): move errors here rather than dbus-errors.h * glib/dbus-glib.h (dbus_set_g_error): move to dbus-glib-lowlevel.h * glib/dbus-glib.h: remove dbus/dbus.h from here; change a bunch of stuff to enable this * dbus/dbus-glib-lowlevel.h: put dbus/dbus.h here * a bunch of other changes with the same basic "separate glib bindings from dbus.h" theme
Diffstat (limited to 'glib')
-rw-r--r--glib/Makefile.am6
-rw-r--r--glib/dbus-gidl.c2
-rw-r--r--glib/dbus-glib-tool.c2
-rw-r--r--glib/dbus-glib.c67
-rw-r--r--glib/dbus-glib.h159
-rw-r--r--glib/dbus-gmain.c121
-rw-r--r--glib/dbus-gobject.c17
-rw-r--r--glib/dbus-gproxy.c237
-rw-r--r--glib/dbus-gtest.c4
-rw-r--r--glib/dbus-gtest.h9
-rw-r--r--glib/dbus-gthread.c3
-rw-r--r--glib/dbus-gtool-test.h4
-rw-r--r--glib/dbus-gutils.c2
-rw-r--r--glib/dbus-gutils.h15
14 files changed, 342 insertions, 306 deletions
diff --git a/glib/Makefile.am b/glib/Makefile.am
index 5d2172e3..d6f00d07 100644
--- a/glib/Makefile.am
+++ b/glib/Makefile.am
@@ -1,13 +1,9 @@
INCLUDES=-I$(top_srcdir) $(DBUS_CLIENT_CFLAGS) $(DBUS_GLIB_CFLAGS) $(DBUS_GLIB_TOOL_CFLAGS) -DDBUS_COMPILATION=1 -DDBUS_LOCALEDIR=\"$(prefix)/@DATADIRNAME@/locale\"
-dbusincludedir=$(includedir)/dbus-1.0/dbus
-
lib_LTLIBRARIES=libdbus-glib-1.la
-dbusinclude_HEADERS= \
- dbus-glib.h
-
libdbus_glib_1_la_SOURCES = \
+ dbus-glib.c \
dbus-gmain.c \
dbus-gobject.c \
dbus-gproxy.c \
diff --git a/glib/dbus-gidl.c b/glib/dbus-gidl.c
index 7db25c86..c8efc46d 100644
--- a/glib/dbus-gidl.c
+++ b/glib/dbus-gidl.c
@@ -549,7 +549,7 @@ arg_info_get_direction (ArgInfo *info)
* Unit test for GLib IDL internals
* @returns #TRUE on success.
*/
-dbus_bool_t
+gboolean
_dbus_gidl_test (void)
{
diff --git a/glib/dbus-glib-tool.c b/glib/dbus-glib-tool.c
index d1195516..bd66e18d 100644
--- a/glib/dbus-glib-tool.c
+++ b/glib/dbus-glib-tool.c
@@ -295,7 +295,7 @@ test_die (const char *failure)
* Unit test for GLib utility tool
* @returns #TRUE on success.
*/
-static dbus_bool_t
+static gboolean
_dbus_gtool_test (const char *test_data_dir)
{
diff --git a/glib/dbus-glib.c b/glib/dbus-glib.c
new file mode 100644
index 00000000..476e5cd2
--- /dev/null
+++ b/glib/dbus-glib.c
@@ -0,0 +1,67 @@
+/* -*- mode: C; c-file-style: "gnu" -*- */
+/* dbus-glib.c General GLib binding stuff
+ *
+ * Copyright (C) 2004 Red Hat, Inc.
+ *
+ * Licensed under the Academic Free License version 2.0
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <config.h>
+#include <dbus/dbus-glib.h>
+#include <dbus/dbus-glib-lowlevel.h>
+#include "dbus-gtest.h"
+#include "dbus-gutils.h"
+
+#include <libintl.h>
+#define _(x) dgettext (GETTEXT_PACKAGE, x)
+#define N_(x) x
+
+/**
+ * @ingroup DBusGLib
+ * @{
+ */
+
+/**
+ * Blocks until outgoing calls and signal emissions have been sent.
+ *
+ * @param connection the connection to flush
+ */
+void
+dbus_g_connection_flush (DBusGConnection *connection)
+{
+ dbus_connection_flush (DBUS_CONNECTION_FROM_G_CONNECTION (connection));
+}
+
+/** @} */ /* end of public API */
+
+
+#ifdef DBUS_BUILD_TESTS
+
+/**
+ * @ingroup DBusGLibInternals
+ * Unit test for general glib stuff
+ * @returns #TRUE on success.
+ */
+gboolean
+_dbus_glib_test (const char *test_data_dir)
+{
+
+ return TRUE;
+}
+
+#endif /* DBUS_BUILD_TESTS */
diff --git a/glib/dbus-glib.h b/glib/dbus-glib.h
deleted file mode 100644
index 483a6e81..00000000
--- a/glib/dbus-glib.h
+++ /dev/null
@@ -1,159 +0,0 @@
-/* -*- mode: C; c-file-style: "gnu" -*- */
-/* dbus-glib.h GLib integration
- *
- * Copyright (C) 2002, 2003 CodeFactory AB
- * Copyright (C) 2003 Red Hat, Inc.
- *
- * Licensed under the Academic Free License version 2.0
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-#ifndef DBUS_GLIB_H
-#define DBUS_GLIB_H
-
-#include <dbus/dbus.h>
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-#define DBUS_INSIDE_DBUS_GLIB_H 1
-
-GQuark dbus_g_error_quark (void);
-#define DBUS_GERROR dbus_g_error_quark ()
-
-#define DBUS_TYPE_CONNECTION (dbus_connection_get_g_type ())
-#define DBUS_TYPE_MESSAGE (dbus_message_get_g_type ())
-GType dbus_connection_get_g_type (void) G_GNUC_CONST;
-GType dbus_message_get_g_type (void) G_GNUC_CONST;
-
-typedef enum
-{
- /* FIXME map all the DBUS_ERROR to DBUS_GERROR, should
- * probably be automated in some way, perhaps
- * via lame perl script
- */
- DBUS_GERROR_FAILED
-} DBusGError;
-
-void dbus_set_g_error (GError **gerror,
- DBusError *derror);
-
-void dbus_g_thread_init (void);
-void dbus_connection_setup_with_g_main (DBusConnection *connection,
- GMainContext *context);
-void dbus_server_setup_with_g_main (DBusServer *server,
- GMainContext *context);
-DBusConnection* dbus_bus_get_with_g_main (DBusBusType type,
- GError **error);
-
-typedef struct DBusGObjectInfo DBusGObjectInfo;
-typedef struct DBusGMethodInfo DBusGMethodInfo;
-
-/**
- * Object typically generated by dbus-glib-tool that
- * stores a mapping from introspection data to a
- * function pointer for a C method to be invoked.
- */
-struct DBusGMethodInfo
-{
- GCallback function; /**< C method to invoke */
- DBusHandleMessageFunction marshaller; /**< Marshaller to go DBusMessage to C method */
- int data_offset; /**< Offset into the introspection data */
-};
-
-/**
- * Introspection data for a GObject, normally autogenerated by
- * a tool such as dbus-glib-tool.
- */
-struct DBusGObjectInfo
-{
- int format_version; /**< Allows us to change the rest of this struct
- * by adding DBusGObjectInfo2, DBusGObjectInfo3, etc.
- */
- const DBusGMethodInfo *infos; /**< Array of method pointers */
- const unsigned char *data; /**< Introspection data */
-};
-
-void dbus_g_object_class_install_info (GObjectClass *object_class,
- const DBusGObjectInfo *info);
-void dbus_connection_register_g_object (DBusConnection *connection,
- const char *at_path,
- GObject *object);
-
-
-typedef struct DBusGProxy DBusGProxy;
-typedef struct DBusGProxyClass DBusGProxyClass;
-
-typedef void (* DBusGProxySignalHandler) (DBusGProxy *proxy,
- DBusMessage *signal,
- void *user_data);
-
-#define DBUS_TYPE_GPROXY (dbus_gproxy_get_type ())
-#define DBUS_GPROXY(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), DBUS_TYPE_GPROXY, DBusGProxy))
-#define DBUS_GPROXY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DBUS_TYPE_GPROXY, DBusGProxyClass))
-#define DBUS_IS_GPROXY(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), DBUS_TYPE_GPROXY))
-#define DBUS_IS_GPROXY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DBUS_TYPE_GPROXY))
-#define DBUS_GPROXY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DBUS_TYPE_GPROXY, DBusGProxyClass))
-
-
-GType dbus_gproxy_get_type (void) G_GNUC_CONST;
-DBusGProxy* dbus_gproxy_new_for_service (DBusConnection *connection,
- const char *service_name,
- const char *path_name,
- const char *interface_name);
-DBusGProxy* dbus_gproxy_new_for_service_owner (DBusConnection *connection,
- const char *service_name,
- const char *path_name,
- const char *interface_name,
- GError **error);
-DBusGProxy* dbus_gproxy_new_for_peer (DBusConnection *connection,
- const char *path_name,
- const char *interface_name);
-void dbus_gproxy_connect_signal (DBusGProxy *proxy,
- const char *signal_name,
- DBusGProxySignalHandler handler,
- void *data,
- GClosureNotify free_data_func);
-void dbus_gproxy_disconnect_signal (DBusGProxy *proxy,
- const char *signal_name,
- DBusGProxySignalHandler handler,
- void *data);
-DBusPendingCall* dbus_gproxy_begin_call (DBusGProxy *proxy,
- const char *method,
- int first_arg_type,
- ...);
-gboolean dbus_gproxy_end_call (DBusGProxy *proxy,
- DBusPendingCall *pending,
- GError **error,
- int first_arg_type,
- ...);
-void dbus_gproxy_call_no_reply (DBusGProxy *proxy,
- const char *method,
- int first_arg_type,
- ...);
-void dbus_gproxy_send (DBusGProxy *proxy,
- DBusMessage *message,
- dbus_uint32_t *client_serial);
-
-
-#undef DBUS_INSIDE_DBUS_GLIB_H
-
-G_END_DECLS
-
-#endif /* DBUS_GLIB_H */
-
-
-
diff --git a/glib/dbus-gmain.c b/glib/dbus-gmain.c
index da2e555d..c0741ac2 100644
--- a/glib/dbus-gmain.c
+++ b/glib/dbus-gmain.c
@@ -1,7 +1,7 @@
/* -*- mode: C; c-file-style: "gnu" -*- */
/* dbus-gmain.c GLib main loop integration
*
- * Copyright (C) 2002, 2003 CodeFactory AB
+ * Copyright (C) 2002, 2003 CodeFactory AB
*
* Licensed under the Academic Free License version 2.0
*
@@ -22,8 +22,10 @@
*/
#include <config.h>
-#include "dbus-glib.h"
+#include <dbus/dbus-glib.h>
+#include <dbus/dbus-glib-lowlevel.h>
#include "dbus-gtest.h"
+#include "dbus-gutils.h"
#include <libintl.h>
#define _(x) dgettext (GETTEXT_PACKAGE, x)
@@ -582,16 +584,19 @@ dbus_server_setup_with_g_main (DBusServer *server,
}
/**
- * Calls dbus_bus_get() then calls dbus_connection_setup_with_g_main()
- * on the result and returns the bus connection.
+ * Returns a connection to the given bus. The connection is a global variable
+ * shared with other callers of this function.
+ *
+ * (Internally, calls dbus_bus_get() then calls
+ * dbus_connection_setup_with_g_main() on the result.)
*
* @param type bus type
* @param error address where an error can be returned.
* @returns a DBusConnection
*/
-DBusConnection*
-dbus_bus_get_with_g_main (DBusBusType type,
- GError **error)
+DBusGConnection*
+dbus_g_bus_get (DBusBusType type,
+ GError **error)
{
DBusConnection *connection;
DBusError derror;
@@ -612,7 +617,7 @@ dbus_bus_get_with_g_main (DBusBusType type,
dbus_connection_setup_with_g_main (connection, NULL);
}
- return connection;
+ return DBUS_G_CONNECTION_FROM_CONNECTION (connection);
}
/**
@@ -688,6 +693,104 @@ dbus_message_get_g_type (void)
return our_type;
}
+static DBusGConnection*
+dbus_g_connection_ref (DBusGConnection *gconnection)
+{
+ DBusConnection *c;
+
+ c = DBUS_CONNECTION_FROM_G_CONNECTION (gconnection);
+ dbus_connection_ref (c);
+ return gconnection;
+}
+
+static void
+dbus_g_connection_unref (DBusGConnection *gconnection)
+{
+ DBusConnection *c;
+
+ c = DBUS_CONNECTION_FROM_G_CONNECTION (gconnection);
+ dbus_connection_unref (c);
+}
+
+
+static DBusGMessage*
+dbus_g_message_ref (DBusGMessage *gmessage)
+{
+ DBusMessage *c;
+
+ c = DBUS_MESSAGE_FROM_G_MESSAGE (gmessage);
+ dbus_message_ref (c);
+ return gmessage;
+}
+
+static void
+dbus_g_message_unref (DBusGMessage *gmessage)
+{
+ DBusMessage *c;
+
+ c = DBUS_MESSAGE_FROM_G_MESSAGE (gmessage);
+ dbus_message_unref (c);
+}
+
+/**
+ * Get the GLib type ID for a DBusGConnection boxed type.
+ *
+ * @returns GLib type
+ */
+GType
+dbus_g_connection_get_g_type (void)
+{
+ static GType our_type = 0;
+
+ if (our_type == 0)
+ our_type = g_boxed_type_register_static ("DBusGConnection",
+ (GBoxedCopyFunc) dbus_g_connection_ref,
+ (GBoxedFreeFunc) dbus_g_connection_unref);
+
+ return our_type;
+}
+
+/**
+ * Get the GLib type ID for a DBusGMessage boxed type.
+ *
+ * @returns GLib type
+ */
+GType
+dbus_g_message_get_g_type (void)
+{
+ static GType our_type = 0;
+
+ if (our_type == 0)
+ our_type = g_boxed_type_register_static ("DBusGMessage",
+ (GBoxedCopyFunc) dbus_g_message_ref,
+ (GBoxedFreeFunc) dbus_g_message_unref);
+
+ return our_type;
+}
+
+/**
+ * Get the DBusConnection corresponding to this DBusGConnection.
+ * The return value does not have its refcount incremented.
+ *
+ * @returns DBusConnection
+ */
+DBusConnection*
+dbus_g_connection_get_connection (DBusGConnection *gconnection)
+{
+ return DBUS_CONNECTION_FROM_G_CONNECTION (gconnection);
+}
+
+/**
+ * Get the DBusMessage corresponding to this DBusGMessage.
+ * The return value does not have its refcount incremented.
+ *
+ * @returns DBusMessage
+ */
+DBusMessage*
+dbus_g_message_get_message (DBusGMessage *gmessage)
+{
+ return DBUS_MESSAGE_FROM_G_MESSAGE (gmessage);
+}
/** @} */ /* end of public API */
@@ -698,7 +801,7 @@ dbus_message_get_g_type (void)
* Unit test for GLib main loop integration
* @returns #TRUE on success.
*/
-dbus_bool_t
+gboolean
_dbus_gmain_test (const char *test_data_dir)
{
diff --git a/glib/dbus-gobject.c b/glib/dbus-gobject.c
index 80f766c5..dfd33f3e 100644
--- a/glib/dbus-gobject.c
+++ b/glib/dbus-gobject.c
@@ -1,7 +1,7 @@
/* -*- mode: C; c-file-style: "gnu" -*- */
/* dbus-gobject.c Exporting a GObject remotely
*
- * Copyright (C) 2003 Red Hat, Inc.
+ * Copyright (C) 2003, 2004 Red Hat, Inc.
*
* Licensed under the Academic Free License version 2.0
*
@@ -22,7 +22,8 @@
*/
#include <config.h>
-#include "dbus-glib.h"
+#include <dbus/dbus-glib.h>
+#include <dbus/dbus-glib-lowlevel.h>
#include "dbus-gtest.h"
#include "dbus-gutils.h"
#include "dbus-gvalue.h"
@@ -502,7 +503,7 @@ static DBusObjectPathVTable gobject_dbus_vtable = {
* class_init() for the object class.
*
* Once introspection information has been installed, instances of the
- * object registered with dbus_connection_register_g_object() can have
+ * object registered with dbus_g_connection_register_g_object() can have
* their methods invoked remotely.
*
* @param object_class class struct of the object
@@ -540,15 +541,15 @@ dbus_g_object_class_install_info (GObjectClass *object_class,
* @param object the object
*/
void
-dbus_connection_register_g_object (DBusConnection *connection,
- const char *at_path,
- GObject *object)
+dbus_g_connection_register_g_object (DBusGConnection *connection,
+ const char *at_path,
+ GObject *object)
{
g_return_if_fail (connection != NULL);
g_return_if_fail (at_path != NULL);
g_return_if_fail (G_IS_OBJECT (object));
- if (!dbus_connection_register_object_path (connection,
+ if (!dbus_connection_register_object_path (DBUS_CONNECTION_FROM_G_CONNECTION (connection),
at_path,
&gobject_dbus_vtable,
object))
@@ -569,7 +570,7 @@ dbus_connection_register_g_object (DBusConnection *connection,
* Unit test for GLib GObject integration ("skeletons")
* @returns #TRUE on success.
*/
-dbus_bool_t
+gboolean
_dbus_gobject_test (const char *test_data_dir)
{
int i;
diff --git a/glib/dbus-gproxy.c b/glib/dbus-gproxy.c
index 4e8d200f..a5827be9 100644
--- a/glib/dbus-gproxy.c
+++ b/glib/dbus-gproxy.c
@@ -1,7 +1,7 @@
/* -*- mode: C; c-file-style: "gnu" -*- */
/* dbus-gcall.c convenience routines for calling methods, etc.
*
- * Copyright (C) 2003 Red Hat, Inc.
+ * Copyright (C) 2003, 2004 Red Hat, Inc.
*
* Licensed under the Academic Free License version 2.0
*
@@ -20,7 +20,9 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
-#include "dbus-glib.h"
+#include <dbus/dbus-glib.h>
+#include <dbus/dbus-glib-lowlevel.h>
+#include "dbus-gutils.h"
#include <string.h>
/**
@@ -56,12 +58,12 @@ struct DBusGProxyClass
GObjectClass parent_class; /**< Parent class */
};
-static void dbus_gproxy_init (DBusGProxy *proxy);
-static void dbus_gproxy_class_init (DBusGProxyClass *klass);
-static void dbus_gproxy_finalize (GObject *object);
-static void dbus_gproxy_dispose (GObject *object);
-static void dbus_gproxy_destroy (DBusGProxy *proxy);
-static void dbus_gproxy_emit_received (DBusGProxy *proxy,
+static void dbus_g_proxy_init (DBusGProxy *proxy);
+static void dbus_g_proxy_class_init (DBusGProxyClass *klass);
+static void dbus_g_proxy_finalize (GObject *object);
+static void dbus_g_proxy_dispose (GObject *object);
+static void dbus_g_proxy_destroy (DBusGProxy *proxy);
+static void dbus_g_proxy_emit_received (DBusGProxy *proxy,
DBusMessage *message);
@@ -97,8 +99,8 @@ struct DBusGProxyManager
};
-static DBusGProxyManager *dbus_gproxy_manager_ref (DBusGProxyManager *manager);
-static DBusHandlerResult dbus_gproxy_manager_filter (DBusConnection *connection,
+static DBusGProxyManager *dbus_g_proxy_manager_ref (DBusGProxyManager *manager);
+static DBusHandlerResult dbus_g_proxy_manager_filter (DBusConnection *connection,
DBusMessage *message,
void *user_data);
@@ -107,28 +109,28 @@ static DBusHandlerResult dbus_gproxy_manager_filter (DBusConnection *connecti
/** Unlock the DBusGProxyManager */
#define UNLOCK_MANAGER(mgr) (g_static_mutex_unlock (&(mgr)->lock))
-static int gproxy_manager_slot = -1;
+static int g_proxy_manager_slot = -1;
/* Lock controlling get/set manager as data on each connection */
-static GStaticMutex connection_gproxy_lock = G_STATIC_MUTEX_INIT;
+static GStaticMutex connection_g_proxy_lock = G_STATIC_MUTEX_INIT;
static DBusGProxyManager*
-dbus_gproxy_manager_get (DBusConnection *connection)
+dbus_g_proxy_manager_get (DBusConnection *connection)
{
DBusGProxyManager *manager;
- dbus_connection_allocate_data_slot (&gproxy_manager_slot);
- if (gproxy_manager_slot < 0)
+ dbus_connection_allocate_data_slot (&g_proxy_manager_slot);
+ if (g_proxy_manager_slot < 0)
g_error ("out of memory");
- g_static_mutex_lock (&connection_gproxy_lock);
+ g_static_mutex_lock (&connection_g_proxy_lock);
- manager = dbus_connection_get_data (connection, gproxy_manager_slot);
+ manager = dbus_connection_get_data (connection, g_proxy_manager_slot);
if (manager != NULL)
{
- dbus_connection_free_data_slot (&gproxy_manager_slot);
- dbus_gproxy_manager_ref (manager);
- g_static_mutex_unlock (&connection_gproxy_lock);
+ dbus_connection_free_data_slot (&g_proxy_manager_slot);
+ dbus_g_proxy_manager_ref (manager);
+ g_static_mutex_unlock (&connection_g_proxy_lock);
return manager;
}
@@ -145,19 +147,19 @@ dbus_gproxy_manager_get (DBusConnection *connection)
*/
dbus_connection_ref (manager->connection);
- dbus_connection_set_data (connection, gproxy_manager_slot,
+ dbus_connection_set_data (connection, g_proxy_manager_slot,
manager, NULL);
- dbus_connection_add_filter (connection, dbus_gproxy_manager_filter,
+ dbus_connection_add_filter (connection, dbus_g_proxy_manager_filter,
manager, NULL);
- g_static_mutex_unlock (&connection_gproxy_lock);
+ g_static_mutex_unlock (&connection_g_proxy_lock);
return manager;
}
static DBusGProxyManager *
-dbus_gproxy_manager_ref (DBusGProxyManager *manager)
+dbus_g_proxy_manager_ref (DBusGProxyManager *manager)
{
g_assert (manager != NULL);
g_assert (manager->refcount > 0);
@@ -172,7 +174,7 @@ dbus_gproxy_manager_ref (DBusGProxyManager *manager)
}
static void
-dbus_gproxy_manager_unref (DBusGProxyManager *manager)
+dbus_g_proxy_manager_unref (DBusGProxyManager *manager)
{
g_assert (manager != NULL);
g_assert (manager->refcount > 0);
@@ -196,21 +198,21 @@ dbus_gproxy_manager_unref (DBusGProxyManager *manager)
g_static_mutex_free (&manager->lock);
- g_static_mutex_lock (&connection_gproxy_lock);
+ g_static_mutex_lock (&connection_g_proxy_lock);
- dbus_connection_remove_filter (manager->connection, dbus_gproxy_manager_filter,
+ dbus_connection_remove_filter (manager->connection, dbus_g_proxy_manager_filter,
manager);
dbus_connection_set_data (manager->connection,
- gproxy_manager_slot,
+ g_proxy_manager_slot,
NULL, NULL);
- g_static_mutex_unlock (&connection_gproxy_lock);
+ g_static_mutex_unlock (&connection_g_proxy_lock);
dbus_connection_unref (manager->connection);
g_free (manager);
- dbus_connection_free_data_slot (&gproxy_manager_slot);
+ dbus_connection_free_data_slot (&g_proxy_manager_slot);
}
else
{
@@ -356,7 +358,7 @@ tristring_from_message (DBusMessage *message)
}
static DBusGProxyList*
-gproxy_list_new (DBusGProxy *first_proxy)
+g_proxy_list_new (DBusGProxy *first_proxy)
{
DBusGProxyList *list;
@@ -370,7 +372,7 @@ gproxy_list_new (DBusGProxy *first_proxy)
}
static void
-gproxy_list_free (DBusGProxyList *list)
+g_proxy_list_free (DBusGProxyList *list)
{
/* we don't hold a reference to the proxies in the list,
* as they ref the GProxyManager
@@ -381,7 +383,7 @@ gproxy_list_free (DBusGProxyList *list)
}
static char*
-gproxy_get_match_rule (DBusGProxy *proxy)
+g_proxy_get_match_rule (DBusGProxy *proxy)
{
/* FIXME Escaping is required here */
@@ -394,7 +396,7 @@ gproxy_get_match_rule (DBusGProxy *proxy)
}
static void
-dbus_gproxy_manager_register (DBusGProxyManager *manager,
+dbus_g_proxy_manager_register (DBusGProxyManager *manager,
DBusGProxy *proxy)
{
DBusGProxyList *list;
@@ -407,7 +409,7 @@ dbus_gproxy_manager_register (DBusGProxyManager *manager,
manager->proxy_lists = g_hash_table_new_full (tristring_hash,
tristring_equal,
NULL,
- (GFreeFunc) gproxy_list_free);
+ (GFreeFunc) g_proxy_list_free);
}
else
{
@@ -422,7 +424,7 @@ dbus_gproxy_manager_register (DBusGProxyManager *manager,
if (list == NULL)
{
- list = gproxy_list_new (proxy);
+ list = g_proxy_list_new (proxy);
g_hash_table_replace (manager->proxy_lists,
list->name, list);
@@ -436,7 +438,7 @@ dbus_gproxy_manager_register (DBusGProxyManager *manager,
*/
char *rule;
- rule = gproxy_get_match_rule (proxy);
+ rule = g_proxy_get_match_rule (proxy);
/* We don't check for errors; it's not like anyone would handle them,
* and we don't want a round trip here.
@@ -455,7 +457,7 @@ dbus_gproxy_manager_register (DBusGProxyManager *manager,
}
static void
-dbus_gproxy_manager_unregister (DBusGProxyManager *manager,
+dbus_g_proxy_manager_unregister (DBusGProxyManager *manager,
DBusGProxy *proxy)
{
DBusGProxyList *list;
@@ -522,7 +524,7 @@ list_proxies_foreach (gpointer key,
tmp = list->proxies;
while (tmp != NULL)
{
- DBusGProxy *proxy = DBUS_GPROXY (tmp->data);
+ DBusGProxy *proxy = DBUS_G_PROXY (tmp->data);
g_object_ref (proxy);
*ret = g_slist_prepend (*ret, proxy);
@@ -532,7 +534,7 @@ list_proxies_foreach (gpointer key,
}
static GSList*
-dbus_gproxy_manager_list_all (DBusGProxyManager *manager)
+dbus_g_proxy_manager_list_all (DBusGProxyManager *manager)
{
GSList *ret;
@@ -549,7 +551,7 @@ dbus_gproxy_manager_list_all (DBusGProxyManager *manager)
}
static DBusHandlerResult
-dbus_gproxy_manager_filter (DBusConnection *connection,
+dbus_g_proxy_manager_filter (DBusConnection *connection,
DBusMessage *message,
void *user_data)
{
@@ -560,7 +562,7 @@ dbus_gproxy_manager_filter (DBusConnection *connection,
manager = user_data;
- dbus_gproxy_manager_ref (manager);
+ dbus_g_proxy_manager_ref (manager);
LOCK_MANAGER (manager);
@@ -574,17 +576,17 @@ dbus_gproxy_manager_filter (DBusConnection *connection,
GSList *all;
GSList *tmp;
- all = dbus_gproxy_manager_list_all (manager);
+ all = dbus_g_proxy_manager_list_all (manager);
tmp = all;
while (tmp != NULL)
{
DBusGProxy *proxy;
- proxy = DBUS_GPROXY (tmp->data);
+ proxy = DBUS_G_PROXY (tmp->data);
UNLOCK_MANAGER (manager);
- dbus_gproxy_destroy (proxy);
+ dbus_g_proxy_destroy (proxy);
g_object_unref (G_OBJECT (proxy));
LOCK_MANAGER (manager);
@@ -635,10 +637,10 @@ dbus_gproxy_manager_filter (DBusConnection *connection,
{
DBusGProxy *proxy;
- proxy = DBUS_GPROXY (tmp->data);
+ proxy = DBUS_G_PROXY (tmp->data);
UNLOCK_MANAGER (manager);
- dbus_gproxy_emit_received (proxy, message);
+ dbus_g_proxy_emit_received (proxy, message);
g_object_unref (G_OBJECT (proxy));
LOCK_MANAGER (manager);
@@ -650,7 +652,7 @@ dbus_gproxy_manager_filter (DBusConnection *connection,
}
UNLOCK_MANAGER (manager);
- dbus_gproxy_manager_unref (manager);
+ dbus_g_proxy_manager_unref (manager);
/* "Handling" signals doesn't make sense, they are for everyone
* who cares
@@ -675,20 +677,20 @@ static void *parent_class;
static guint signals[LAST_SIGNAL] = { 0 };
static void
-dbus_gproxy_init (DBusGProxy *proxy)
+dbus_g_proxy_init (DBusGProxy *proxy)
{
/* Nothing */
}
static void
-dbus_gproxy_class_init (DBusGProxyClass *klass)
+dbus_g_proxy_class_init (DBusGProxyClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
- object_class->finalize = dbus_gproxy_finalize;
- object_class->dispose = dbus_gproxy_dispose;
+ object_class->finalize = dbus_g_proxy_finalize;
+ object_class->dispose = dbus_g_proxy_dispose;
signals[DESTROY] =
g_signal_new ("destroy",
@@ -712,11 +714,11 @@ dbus_gproxy_class_init (DBusGProxyClass *klass)
static void
-dbus_gproxy_dispose (GObject *object)
+dbus_g_proxy_dispose (GObject *object)
{
DBusGProxy *proxy;
- proxy = DBUS_GPROXY (object);
+ proxy = DBUS_G_PROXY (object);
g_signal_emit (object, signals[DESTROY], 0);
@@ -724,16 +726,16 @@ dbus_gproxy_dispose (GObject *object)
}
static void
-dbus_gproxy_finalize (GObject *object)
+dbus_g_proxy_finalize (GObject *object)
{
DBusGProxy *proxy;
- proxy = DBUS_GPROXY (object);
+ proxy = DBUS_G_PROXY (object);
if (proxy->manager)
{
- dbus_gproxy_manager_unregister (proxy->manager, proxy);
- dbus_gproxy_manager_unref (proxy->manager);
+ dbus_g_proxy_manager_unregister (proxy->manager, proxy);
+ dbus_g_proxy_manager_unref (proxy->manager);
}
g_free (proxy->service);
@@ -744,7 +746,7 @@ dbus_gproxy_finalize (GObject *object)
}
static void
-dbus_gproxy_destroy (DBusGProxy *proxy)
+dbus_g_proxy_destroy (DBusGProxy *proxy)
{
/* FIXME do we need the GTK_IN_DESTRUCTION style flag
* from GtkObject?
@@ -768,7 +770,7 @@ create_signal_detail (const char *interface,
}
static void
-dbus_gproxy_emit_received (DBusGProxy *proxy,
+dbus_g_proxy_emit_received (DBusGProxy *proxy,
DBusMessage *message)
{
const char *interface;
@@ -811,7 +813,7 @@ dbus_gproxy_emit_received (DBusGProxy *proxy,
* @returns type ID for DBusGProxy class
*/
GType
-dbus_gproxy_get_type (void)
+dbus_g_proxy_get_type (void)
{
static GType object_type = 0;
@@ -822,12 +824,12 @@ dbus_gproxy_get_type (void)
sizeof (DBusGProxyClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
- (GClassInitFunc) dbus_gproxy_class_init,
+ (GClassInitFunc) dbus_g_proxy_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (DBusGProxy),
0, /* n_preallocs */
- (GInstanceInitFunc) dbus_gproxy_init,
+ (GInstanceInitFunc) dbus_g_proxy_init,
};
object_type = g_type_register_static (G_TYPE_OBJECT,
@@ -839,28 +841,28 @@ dbus_gproxy_get_type (void)
}
static DBusGProxy*
-dbus_gproxy_new (DBusConnection *connection,
- const char *service_name,
- const char *path_name,
- const char *interface_name)
+dbus_g_proxy_new (DBusGConnection *connection,
+ const char *service_name,
+ const char *path_name,
+ const char *interface_name)
{
DBusGProxy *proxy;
g_assert (connection != NULL);
- proxy = g_object_new (DBUS_TYPE_GPROXY, NULL);
+ proxy = g_object_new (DBUS_TYPE_G_PROXY, NULL);
/* These should all be construct-only mandatory properties,
* for now we just don't let people use g_object_new().
*/
- proxy->manager = dbus_gproxy_manager_get (connection);
+ proxy->manager = dbus_g_proxy_manager_get (DBUS_CONNECTION_FROM_G_CONNECTION (connection));
proxy->service = g_strdup (service_name);
proxy->path = g_strdup (path_name);
proxy->interface = g_strdup (interface_name);
- dbus_gproxy_manager_register (proxy->manager, proxy);
+ dbus_g_proxy_manager_register (proxy->manager, proxy);
return proxy;
}
@@ -873,7 +875,7 @@ dbus_gproxy_new (DBusConnection *connection,
* TIME, for example between two different method calls. If you need a
* fixed owner, you need to request the current owner and bind a proxy
* to that rather than to the generic service name; see
- * dbus_gproxy_new_for_service_owner().
+ * dbus_g_proxy_new_for_service_owner().
*
* A service-associated proxy only makes sense with a message bus,
* not for app-to-app direct dbus connections.
@@ -888,10 +890,10 @@ dbus_gproxy_new (DBusConnection *connection,
* @returns new proxy object
*/
DBusGProxy*
-dbus_gproxy_new_for_service (DBusConnection *connection,
- const char *service_name,
- const char *path_name,
- const char *interface_name)
+dbus_g_proxy_new_for_service (DBusGConnection *connection,
+ const char *service_name,
+ const char *path_name,
+ const char *interface_name)
{
DBusGProxy *proxy;
@@ -900,26 +902,26 @@ dbus_gproxy_new_for_service (DBusConnection *connection,
g_return_val_if_fail (path_name != NULL, NULL);
g_return_val_if_fail (interface_name != NULL, NULL);
- proxy = dbus_gproxy_new (connection, service_name,
+ proxy = dbus_g_proxy_new (connection, service_name,
path_name, interface_name);
return proxy;
}
/**
- * Similar to dbus_gproxy_new_for_service(), but makes a round-trip
+ * Similar to dbus_g_proxy_new_for_service(), but makes a round-trip
* request to the message bus to get the current service owner, then
* binds the proxy specifically to the current owner. As a result, the
* service owner will not change over time, and the proxy will emit
* the "destroy" signal when the owner disappears from the message
* bus.
*
- * An example of the difference between dbus_gproxy_new_for_service()
- * and dbus_gproxy_new_for_service_owner(): if you pass the service name
- * "org.freedesktop.Database" dbus_gproxy_new_for_service() remains bound
- * to that name as it changes owner. dbus_gproxy_new_for_service_owner()
+ * An example of the difference between dbus_g_proxy_new_for_service()
+ * and dbus_g_proxy_new_for_service_owner(): if you pass the service name
+ * "org.freedesktop.Database" dbus_g_proxy_new_for_service() remains bound
+ * to that name as it changes owner. dbus_g_proxy_new_for_service_owner()
* will fail if the service has no owner. If the service has an owner,
- * dbus_gproxy_new_for_service_owner() will bind to the unique name
+ * dbus_g_proxy_new_for_service_owner() will bind to the unique name
* of that owner rather than the generic service name.
*
* @param connection the connection to the remote bus
@@ -930,14 +932,13 @@ dbus_gproxy_new_for_service (DBusConnection *connection,
* @returns new proxy object, or #NULL on error
*/
DBusGProxy*
-dbus_gproxy_new_for_service_owner (DBusConnection *connection,
+dbus_g_proxy_new_for_service_owner (DBusGConnection *connection,
const char *service_name,
const char *path_name,
const char *interface_name,
GError **error)
{
DBusGProxy *proxy;
-
DBusMessage *request, *reply;
DBusError derror;
char *base_service_name;
@@ -965,8 +966,10 @@ dbus_gproxy_new_for_service_owner (DBusConnection *connection,
DBUS_TYPE_INVALID))
g_error ("Out of memory");
- reply = dbus_connection_send_with_reply_and_block (connection, request,
- 2000, &derror);
+ reply =
+ dbus_connection_send_with_reply_and_block (DBUS_CONNECTION_FROM_G_CONNECTION (connection),
+ request,
+ 2000, &derror);
if (reply == NULL)
goto error;
@@ -979,7 +982,7 @@ dbus_gproxy_new_for_service_owner (DBusConnection *connection,
goto error;
- proxy = dbus_gproxy_new (connection, base_service_name,
+ proxy = dbus_g_proxy_new (connection, base_service_name,
path_name, interface_name);
goto out;
@@ -1014,7 +1017,7 @@ dbus_gproxy_new_for_service_owner (DBusConnection *connection,
*
*/
DBusGProxy*
-dbus_gproxy_new_for_peer (DBusConnection *connection,
+dbus_g_proxy_new_for_peer (DBusGConnection *connection,
const char *path_name,
const char *interface_name)
{
@@ -1024,7 +1027,7 @@ dbus_gproxy_new_for_peer (DBusConnection *connection,
g_return_val_if_fail (path_name != NULL, NULL);
g_return_val_if_fail (interface_name != NULL, NULL);
- proxy = dbus_gproxy_new (connection, NULL,
+ proxy = dbus_g_proxy_new (connection, NULL,
path_name, interface_name);
return proxy;
@@ -1038,7 +1041,7 @@ dbus_gproxy_new_for_peer (DBusConnection *connection,
* dbus_connection_flush() to write out pending data. The call will
* be completed after a timeout, or when a reply is received.
* To collect the results of the call (which may be an error,
- * or a reply), use dbus_gproxy_end_call().
+ * or a reply), use dbus_g_proxy_end_call().
*
* @todo this particular function shouldn't die on out of memory,
* since you should be able to do a call with large arguments.
@@ -1049,8 +1052,8 @@ dbus_gproxy_new_for_peer (DBusConnection *connection,
*
* @returns opaque pending call object
* */
-DBusPendingCall*
-dbus_gproxy_begin_call (DBusGProxy *proxy,
+DBusGPendingCall*
+dbus_g_proxy_begin_call (DBusGProxy *proxy,
const char *method,
int first_arg_type,
...)
@@ -1059,7 +1062,7 @@ dbus_gproxy_begin_call (DBusGProxy *proxy,
DBusMessage *message;
va_list args;
- g_return_val_if_fail (DBUS_IS_GPROXY (proxy), NULL);
+ g_return_val_if_fail (DBUS_IS_G_PROXY (proxy), NULL);
message = dbus_message_new_method_call (proxy->service,
proxy->path,
@@ -1080,7 +1083,7 @@ dbus_gproxy_begin_call (DBusGProxy *proxy,
-1))
goto oom;
- return pending;
+ return DBUS_G_PENDING_CALL_FROM_PENDING_CALL (pending);
oom:
/* FIXME we should create a pending call that's
@@ -1094,7 +1097,7 @@ dbus_gproxy_begin_call (DBusGProxy *proxy,
/**
* Collects the results of a method call. The method call was normally
- * initiated with dbus_gproxy_end_call(). This function will block if
+ * initiated with dbus_g_proxy_end_call(). This function will block if
* the results haven't yet been received; use
* dbus_pending_call_set_notify() to be notified asynchronously that a
* pending call has been completed. Use
@@ -1109,17 +1112,17 @@ dbus_gproxy_begin_call (DBusGProxy *proxy,
* The list should be terminated with DBUS_TYPE_INVALID.
*
* This function doesn't affect the reference count of the
- * #DBusPendingCall, the caller of dbus_gproxy_begin_call() still owns
+ * #DBusPendingCall, the caller of dbus_g_proxy_begin_call() still owns
* a reference.
*
* @param proxy a proxy for a remote interface
- * @param pending the pending call from dbus_gproxy_begin_call()
+ * @param pending the pending call from dbus_g_proxy_begin_call()
* @param error return location for an error
* @param first_arg_type type of first "out" argument
* @returns #FALSE if an error is set */
gboolean
-dbus_gproxy_end_call (DBusGProxy *proxy,
- DBusPendingCall *pending,
+dbus_g_proxy_end_call (DBusGProxy *proxy,
+ DBusGPendingCall *pending,
GError **error,
int first_arg_type,
...)
@@ -1128,11 +1131,11 @@ dbus_gproxy_end_call (DBusGProxy *proxy,
va_list args;
DBusError derror;
- g_return_val_if_fail (DBUS_IS_GPROXY (proxy), FALSE);
+ g_return_val_if_fail (DBUS_IS_G_PROXY (proxy), FALSE);
g_return_val_if_fail (pending != NULL, FALSE);
- dbus_pending_call_block (pending);
- message = dbus_pending_call_get_reply (pending);
+ dbus_pending_call_block (DBUS_PENDING_CALL_FROM_G_PENDING_CALL (pending));
+ message = dbus_pending_call_get_reply (DBUS_PENDING_CALL_FROM_G_PENDING_CALL (pending));
g_assert (message != NULL);
@@ -1168,7 +1171,7 @@ dbus_gproxy_end_call (DBusGProxy *proxy,
}
/**
- * Sends a method call message as with dbus_gproxy_begin_call(), but
+ * Sends a method call message as with dbus_g_proxy_begin_call(), but
* does not ask for a reply or allow you to receive one.
*
* @todo this particular function shouldn't die on out of memory,
@@ -1179,7 +1182,7 @@ dbus_gproxy_end_call (DBusGProxy *proxy,
* @param first_arg_type type of the first argument
*/
void
-dbus_gproxy_call_no_reply (DBusGProxy *proxy,
+dbus_g_proxy_call_no_reply (DBusGProxy *proxy,
const char *method,
int first_arg_type,
...)
@@ -1187,7 +1190,7 @@ dbus_gproxy_call_no_reply (DBusGProxy *proxy,
DBusMessage *message;
va_list args;
- g_return_if_fail (DBUS_IS_GPROXY (proxy));
+ g_return_if_fail (DBUS_IS_G_PROXY (proxy));
message = dbus_message_new_method_call (proxy->service,
proxy->path,
@@ -1234,11 +1237,11 @@ dbus_gproxy_call_no_reply (DBusGProxy *proxy,
* @param message the message to address and send
* @param client_serial return location for message's serial, or #NULL */
void
-dbus_gproxy_send (DBusGProxy *proxy,
+dbus_g_proxy_send (DBusGProxy *proxy,
DBusMessage *message,
dbus_uint32_t *client_serial)
{
- g_return_if_fail (DBUS_IS_GPROXY (proxy));
+ g_return_if_fail (DBUS_IS_G_PROXY (proxy));
if (proxy->service)
{
@@ -1265,6 +1268,10 @@ dbus_gproxy_send (DBusGProxy *proxy,
* the remote interface emits the specified signal, the proxy will
* emit a corresponding GLib signal.
*
+ * @todo Right now there's no way to specify the signature to use
+ * for invoking the GCallback. Need to either rely on introspection,
+ * or require signature here.
+ *
* @param proxy a proxy for a remote interface
* @param signal_name the DBus signal name to listen for
* @param handler the handler to connect
@@ -1272,16 +1279,16 @@ dbus_gproxy_send (DBusGProxy *proxy,
* @param free_data_func callback function to destroy data
*/
void
-dbus_gproxy_connect_signal (DBusGProxy *proxy,
+dbus_g_proxy_connect_signal (DBusGProxy *proxy,
const char *signal_name,
- DBusGProxySignalHandler handler,
+ GCallback handler,
void *data,
GClosureNotify free_data_func)
{
GClosure *closure;
char *detail;
- g_return_if_fail (DBUS_IS_GPROXY (proxy));
+ g_return_if_fail (DBUS_IS_G_PROXY (proxy));
g_return_if_fail (signal_name != NULL);
g_return_if_fail (handler != NULL);
@@ -1306,15 +1313,15 @@ dbus_gproxy_connect_signal (DBusGProxy *proxy,
* @param data the data that was registered with handler
*/
void
-dbus_gproxy_disconnect_signal (DBusGProxy *proxy,
+dbus_g_proxy_disconnect_signal (DBusGProxy *proxy,
const char *signal_name,
- DBusGProxySignalHandler handler,
+ GCallback handler,
void *data)
{
char *detail;
GQuark q;
- g_return_if_fail (DBUS_IS_GPROXY (proxy));
+ g_return_if_fail (DBUS_IS_G_PROXY (proxy));
g_return_if_fail (signal_name != NULL);
g_return_if_fail (handler != NULL);
@@ -1350,8 +1357,8 @@ dbus_gproxy_disconnect_signal (DBusGProxy *proxy,
* Unit test for GLib proxy functions
* @returns #TRUE on success.
*/
-dbus_bool_t
-_dbus_gproxy_test (void)
+gboolean
+_dbus_g_proxy_test (void)
{
diff --git a/glib/dbus-gtest.c b/glib/dbus-gtest.c
index 420fc229..f583e3ba 100644
--- a/glib/dbus-gtest.c
+++ b/glib/dbus-gtest.c
@@ -56,6 +56,10 @@ dbus_glib_internal_do_not_use_run_tests (const char *test_data_dir)
else
printf ("No test data!\n");
+ printf ("%s: running glib tests\n", "dbus-glib-test");
+ if (!_dbus_glib_test (test_data_dir))
+ die ("glib");
+
printf ("%s: running utils tests\n", "dbus-glib-test");
if (!_dbus_gutils_test (test_data_dir))
die ("gutils");
diff --git a/glib/dbus-gtest.h b/glib/dbus-gtest.h
index 95b496e1..f0ef02e4 100644
--- a/glib/dbus-gtest.h
+++ b/glib/dbus-gtest.h
@@ -24,11 +24,12 @@
#ifndef DBUS_GLIB_TEST_H
#define DBUS_GLIB_TEST_H
-#include "dbus-glib.h"
+#include <dbus/dbus-glib.h>
-dbus_bool_t _dbus_gmain_test (const char *test_data_dir);
-dbus_bool_t _dbus_gobject_test (const char *test_data_dir);
-dbus_bool_t _dbus_gutils_test (const char *test_data_dir);
+gboolean _dbus_gmain_test (const char *test_data_dir);
+gboolean _dbus_gobject_test (const char *test_data_dir);
+gboolean _dbus_gutils_test (const char *test_data_dir);
+gboolean _dbus_glib_test (const char *test_data_dir);
void dbus_glib_internal_do_not_use_run_tests (const char *test_data_dir);
diff --git a/glib/dbus-gthread.c b/glib/dbus-gthread.c
index b0b2f14d..8bc55a57 100644
--- a/glib/dbus-gthread.c
+++ b/glib/dbus-gthread.c
@@ -23,7 +23,8 @@
#include <glib.h>
#include <dbus/dbus.h>
-#include "dbus-glib.h"
+#include <dbus/dbus-glib.h>
+#include <dbus/dbus-glib-lowlevel.h>
/** @addtogroup DBusGLibInternals
* @{
diff --git a/glib/dbus-gtool-test.h b/glib/dbus-gtool-test.h
index 4e679a13..73c27235 100644
--- a/glib/dbus-gtool-test.h
+++ b/glib/dbus-gtool-test.h
@@ -24,8 +24,8 @@
#ifndef DBUS_GLIB_TOOL_TEST_H
#define DBUS_GLIB_TOOL_TEST_H
-#include "dbus-glib.h"
+#include <dbus/dbus-glib.h>
-dbus_bool_t _dbus_gtool_test (const char *test_data_dir);
+gboolean _dbus_gtool_test (const char *test_data_dir);
#endif /* DBUS_GLIB_TEST_H */
diff --git a/glib/dbus-gutils.c b/glib/dbus-gutils.c
index 8c4d3d09..dd8739a6 100644
--- a/glib/dbus-gutils.c
+++ b/glib/dbus-gutils.c
@@ -118,7 +118,7 @@ _dbus_gutils_type_to_string (int type)
* Unit test for GLib utils internals
* @returns #TRUE on success.
*/
-dbus_bool_t
+gboolean
_dbus_gutils_test (const char *test_data_dir)
{
diff --git a/glib/dbus-gutils.h b/glib/dbus-gutils.h
index 84041d04..bed2d295 100644
--- a/glib/dbus-gutils.h
+++ b/glib/dbus-gutils.h
@@ -35,6 +35,21 @@ char **_dbus_gutils_split_path (const char *path);
const char *_dbus_gutils_type_to_string (int type);
+/* These munge the pointer to enforce that a plain cast won't work,
+ * accessor functions must be used; i.e. to ensure the ABI
+ * reflects our encapsulation.
+ */
+#define _DBUS_POINTER_SHIFT(p) ((void*) (((char*)p) + sizeof (void*)))
+#define _DBUS_POINTER_UNSHIFT(p) ((void*) (((char*)p) - sizeof (void*)))
+
+#define DBUS_CONNECTION_FROM_G_CONNECTION(x) ((DBusConnection*) _DBUS_POINTER_UNSHIFT(x))
+#define DBUS_MESSAGE_FROM_G_MESSAGE(x) ((DBusMessage*) _DBUS_POINTER_UNSHIFT(x))
+#define DBUS_PENDING_CALL_FROM_G_PENDING_CALL(x) ((DBusPendingCall*) _DBUS_POINTER_UNSHIFT(x))
+
+#define DBUS_G_CONNECTION_FROM_CONNECTION(x) ((DBusGConnection*) _DBUS_POINTER_SHIFT(x))
+#define DBUS_G_MESSAGE_FROM_MESSAGE(x) ((DBusGMessage*) _DBUS_POINTER_SHIFT(x))
+#define DBUS_G_PENDING_CALL_FROM_PENDING_CALL(x) ((DBusGPendingCall*) _DBUS_POINTER_SHIFT(x))
+
G_END_DECLS
#endif /* DBUS_GLIB_UTILS_H */