dbus/glib Makefile.am, 1.7, 1.8 dbus-gidl.c, 1.6, 1.7 dbus-glib-tool.c, 1.4, 1.5 dbus-glib.c, NONE, 1.1 dbus-glib.h, 1.13, NONE dbus-gmain.c, 1.28, 1.29 dbus-gobject.c, 1.8, 1.9 dbus-gproxy.c, 1.10, 1.11 dbus-gtest.c, 1.3, 1.4 dbus-gtest.h, 1.3, 1.4 dbus-gthread.c, 1.7, 1.8 dbus-gtool-test.h, 1.3, 1.4 dbus-gutils.c, 1.4, 1.5 dbus-gutils.h, 1.4, 1.5

Havoc Pennington hp at pdx.freedesktop.org
Sun Jun 20 08:28:17 PDT 2004


Update of /cvs/dbus/dbus/glib
In directory pdx:/tmp/cvs-serv11424/glib

Modified Files:
	Makefile.am dbus-gidl.c dbus-glib-tool.c dbus-gmain.c 
	dbus-gobject.c dbus-gproxy.c dbus-gtest.c dbus-gtest.h 
	dbus-gthread.c dbus-gtool-test.h dbus-gutils.c dbus-gutils.h 
Added Files:
	dbus-glib.c 
Removed Files:
	dbus-glib.h 
Log Message:
2004-06-20  Havoc Pennington  <hp at 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
	


Index: Makefile.am
===================================================================
RCS file: /cvs/dbus/dbus/glib/Makefile.am,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- Makefile.am	1 Jun 2004 03:02:26 -0000	1.7
+++ Makefile.am	20 Jun 2004 15:28:15 -0000	1.8
@@ -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				\

Index: dbus-gidl.c
===================================================================
RCS file: /cvs/dbus/dbus/glib/dbus-gidl.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- dbus-gidl.c	1 Jun 2004 03:02:26 -0000	1.6
+++ dbus-gidl.c	20 Jun 2004 15:28:15 -0000	1.7
@@ -549,7 +549,7 @@
  * Unit test for GLib IDL internals
  * @returns #TRUE on success.
  */
-dbus_bool_t
+gboolean
 _dbus_gidl_test (void)
 {
 

Index: dbus-glib-tool.c
===================================================================
RCS file: /cvs/dbus/dbus/glib/dbus-glib-tool.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- dbus-glib-tool.c	1 Jun 2004 03:02:26 -0000	1.4
+++ dbus-glib-tool.c	20 Jun 2004 15:28:15 -0000	1.5
@@ -295,7 +295,7 @@
  * Unit test for GLib utility tool
  * @returns #TRUE on success.
  */
-static dbus_bool_t
+static gboolean
 _dbus_gtool_test (const char *test_data_dir)
 {
 

--- NEW FILE: dbus-glib.c ---
/* -*- 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 */

--- dbus-glib.h DELETED ---

Index: dbus-gmain.c
===================================================================
RCS file: /cvs/dbus/dbus/glib/dbus-gmain.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- dbus-gmain.c	2 Jun 2004 13:13:14 -0000	1.28
+++ dbus-gmain.c	20 Jun 2004 15:28:15 -0000	1.29
@@ -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 @@
 }
 
 /**
- * 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_connection_setup_with_g_main (connection, NULL);
     }
 
-  return connection;
+  return DBUS_G_CONNECTION_FROM_CONNECTION (connection);
 }
 
 /**
@@ -688,6 +693,104 @@
   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 @@
  * Unit test for GLib main loop integration
  * @returns #TRUE on success.
  */
-dbus_bool_t
+gboolean
 _dbus_gmain_test (const char *test_data_dir)
 {
   

Index: dbus-gobject.c
===================================================================
RCS file: /cvs/dbus/dbus/glib/dbus-gobject.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- dbus-gobject.c	5 Jun 2004 16:32:00 -0000	1.8
+++ dbus-gobject.c	20 Jun 2004 15:28:15 -0000	1.9
@@ -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 @@
  * 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 @@
  * @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 @@
  * 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;

Index: dbus-gproxy.c
===================================================================
RCS file: /cvs/dbus/dbus/glib/dbus-gproxy.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- dbus-gproxy.c	2 Jun 2004 13:13:14 -0000	1.10
+++ dbus-gproxy.c	20 Jun 2004 15:28:15 -0000	1.11
@@ -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 @@
   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 @@
 
 };
 
-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 @@
 /** 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_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 @@
 }
 
 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 @@
       
       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 @@
 }
 
 static DBusGProxyList*
-gproxy_list_new (DBusGProxy *first_proxy)
+g_proxy_list_new (DBusGProxy *first_proxy)
 {
   DBusGProxyList *list;
   
@@ -370,7 +372,7 @@
 }
 
 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 @@
 }
 
 static char*
-gproxy_get_match_rule (DBusGProxy *proxy)
+g_proxy_get_match_rule (DBusGProxy *proxy)
 {
   /* FIXME Escaping is required here */
   
@@ -394,7 +396,7 @@
 }
 
 static void
-dbus_gproxy_manager_register (DBusGProxyManager *manager,
+dbus_g_proxy_manager_register (DBusGProxyManager *manager,
                               DBusGProxy        *proxy)
 {
   DBusGProxyList *list;
@@ -407,7 +409,7 @@
       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 @@
       
   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 @@
        */
       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 @@
 }
 
 static void
-dbus_gproxy_manager_unregister (DBusGProxyManager *manager,
+dbus_g_proxy_manager_unregister (DBusGProxyManager *manager,
                                 DBusGProxy        *proxy)
 {
   DBusGProxyList *list;
@@ -522,7 +524,7 @@
   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 @@
 }
 
 static GSList*
-dbus_gproxy_manager_list_all (DBusGProxyManager *manager)
+dbus_g_proxy_manager_list_all (DBusGProxyManager *manager)
 {
   GSList *ret;
 
@@ -549,7 +551,7 @@
 }
 
 static DBusHandlerResult
-dbus_gproxy_manager_filter (DBusConnection    *connection,
+dbus_g_proxy_manager_filter (DBusConnection    *connection,
                             DBusMessage       *message,
                             void              *user_data)
 {
@@ -560,7 +562,7 @@
 
   manager = user_data;
 
-  dbus_gproxy_manager_ref (manager);
+  dbus_g_proxy_manager_ref (manager);
   
   LOCK_MANAGER (manager);
   
@@ -574,17 +576,17 @@
       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 @@
             {
               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 @@
     }
 
   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 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 @@
 
 
 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 @@
 }
 
 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 @@
 }
 
 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 @@
 }
 
 static void
-dbus_gproxy_emit_received (DBusGProxy  *proxy,
+dbus_g_proxy_emit_received (DBusGProxy  *proxy,
                            DBusMessage *message)
 {
   const char *interface;
@@ -811,7 +813,7 @@
  * @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 @@
           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 @@
 }
 
 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 @@
  * 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 @@
  * @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 @@
   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 @@
  * @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_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 @@
     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 @@
  * 
  */
 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 @@
   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_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 @@
  *
  * @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 @@
   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 @@
                                         -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 @@
 
 /**
  * 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 @@
  * 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 @@
   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 @@
 }
 
 /**
- * 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 @@
  * @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 @@
   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 @@
  * @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 @@
  * 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 @@
  * @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 @@
  * @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 @@
  * Unit test for GLib proxy functions
  * @returns #TRUE on success.
  */
-dbus_bool_t
-_dbus_gproxy_test (void)
+gboolean
+_dbus_g_proxy_test (void)
 {
   
   

Index: dbus-gtest.c
===================================================================
RCS file: /cvs/dbus/dbus/glib/dbus-gtest.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- dbus-gtest.c	2 Dec 2003 10:44:21 -0000	1.3
+++ dbus-gtest.c	20 Jun 2004 15:28:15 -0000	1.4
@@ -56,6 +56,10 @@
   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");

Index: dbus-gtest.h
===================================================================
RCS file: /cvs/dbus/dbus/glib/dbus-gtest.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- dbus-gtest.h	2 Dec 2003 10:44:21 -0000	1.3
+++ dbus-gtest.h	20 Jun 2004 15:28:15 -0000	1.4
@@ -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);
 

Index: dbus-gthread.c
===================================================================
RCS file: /cvs/dbus/dbus/glib/dbus-gthread.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- dbus-gthread.c	2 Dec 2003 10:44:21 -0000	1.7
+++ dbus-gthread.c	20 Jun 2004 15:28:15 -0000	1.8
@@ -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
  * @{

Index: dbus-gtool-test.h
===================================================================
RCS file: /cvs/dbus/dbus/glib/dbus-gtool-test.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- dbus-gtool-test.h	2 Dec 2003 10:44:22 -0000	1.3
+++ dbus-gtool-test.h	20 Jun 2004 15:28:15 -0000	1.4
@@ -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 */

Index: dbus-gutils.c
===================================================================
RCS file: /cvs/dbus/dbus/glib/dbus-gutils.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- dbus-gutils.c	1 Jun 2004 03:02:26 -0000	1.4
+++ dbus-gutils.c	20 Jun 2004 15:28:15 -0000	1.5
@@ -118,7 +118,7 @@
  * Unit test for GLib utils internals
  * @returns #TRUE on success.
  */
-dbus_bool_t
+gboolean
 _dbus_gutils_test (const char *test_data_dir)
 {
 

Index: dbus-gutils.h
===================================================================
RCS file: /cvs/dbus/dbus/glib/dbus-gutils.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- dbus-gutils.h	1 Jun 2004 03:02:26 -0000	1.4
+++ dbus-gutils.h	20 Jun 2004 15:28:15 -0000	1.5
@@ -35,6 +35,21 @@
 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 */




More information about the dbus-commit mailing list