dbus/test/glib Makefile.am, 1.5, 1.6 test-dbus-glib.c, 1.7, 1.8 test-profile.c, 1.3, 1.4 test-service-glib.c, 1.2, 1.3 test-thread-client.c, 1.2, 1.3 test-thread-server.c, 1.2, 1.3

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


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

Modified Files:
	Makefile.am test-dbus-glib.c test-profile.c 
	test-service-glib.c test-thread-client.c test-thread-server.c 
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/test/glib/Makefile.am,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- Makefile.am	13 Apr 2004 11:39:41 -0000	1.5
+++ Makefile.am	20 Jun 2004 15:28:15 -0000	1.6
@@ -1,4 +1,4 @@
-INCLUDES=-I$(top_srcdir) $(DBUS_CLIENT_CFLAGS) $(DBUS_GLIB_CFLAGS) -I$(top_srcdir)/glib
+INCLUDES=-I$(top_srcdir) $(DBUS_CLIENT_CFLAGS) $(DBUS_GLIB_CFLAGS)
 
 ## note that TESTS has special meaning (stuff to use in make check)
 ## so if adding tests not to be run in make check, don't add them to 
@@ -58,4 +58,4 @@
 	test-profile.c
 
 test_profile_LDADD= $(DBUS_GLIB_THREADS_LIBS) $(top_builddir)/glib/libdbus-glib-1.la 
-endif
\ No newline at end of file
+endif

Index: test-dbus-glib.c
===================================================================
RCS file: /cvs/dbus/dbus/test/glib/test-dbus-glib.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- test-dbus-glib.c	15 Apr 2004 22:08:04 -0000	1.7
+++ test-dbus-glib.c	20 Jun 2004 15:28:15 -0000	1.8
@@ -1,5 +1,5 @@
 /* -*- mode: C; c-file-style: "gnu" -*- */
-#include "dbus-glib.h"
+#include <dbus/dbus-glib.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -16,10 +16,15 @@
 
 static void
 foo_signal_handler (DBusGProxy  *proxy,
-                    DBusMessage *signal,
                     void        *user_data)
 {
+#if 0
   double d;
+  
+  /* FIXME - need to fix up dbus_gproxy_signal_connect() to be able to
+   * get signal args
+   */
+  
   DBusError derror;
   
   if (!dbus_message_is_signal (signal,
@@ -38,6 +43,7 @@
       dbus_error_free (&derror);
       exit (1);
     }
+#endif
 
   n_times_foo_received += 1;
 
@@ -47,15 +53,15 @@
 int
 main (int argc, char **argv)
 {
-  DBusConnection *connection;
+  DBusGConnection *connection;
   GError *error;
   DBusGProxy *driver;
   DBusGProxy *proxy;
-  DBusPendingCall *call;
+  DBusGPendingCall *call;
   char **service_list;
   int service_list_len;
   int i;
-  dbus_uint32_t result;
+  guint32 result;
   char *str;
   
   g_type_init ();
@@ -63,8 +69,8 @@
   loop = g_main_loop_new (NULL, FALSE);
 
   error = NULL;
-  connection = dbus_bus_get_with_g_main (DBUS_BUS_SESSION,
-                                         &error);
+  connection = dbus_g_bus_get (DBUS_BUS_SESSION,
+                               &error);
   if (connection == NULL)
     {
       g_printerr ("Failed to open connection to bus: %s\n",
@@ -75,20 +81,20 @@
 
   /* Create a proxy object for the "bus driver" */
   
-  driver = dbus_gproxy_new_for_service (connection,
-                                        DBUS_SERVICE_ORG_FREEDESKTOP_DBUS,
-                                        DBUS_PATH_ORG_FREEDESKTOP_DBUS,
-                                        DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS);
+  driver = dbus_g_proxy_new_for_service (connection,
+                                         DBUS_SERVICE_ORG_FREEDESKTOP_DBUS,
+                                         DBUS_PATH_ORG_FREEDESKTOP_DBUS,
+                                         DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS);
 
   /* Call ListServices method */
   
-  call = dbus_gproxy_begin_call (driver, "ListServices", DBUS_TYPE_INVALID);
+  call = dbus_g_proxy_begin_call (driver, "ListServices", DBUS_TYPE_INVALID);
 
   error = NULL;
-  if (!dbus_gproxy_end_call (driver, call, &error,
-                             DBUS_TYPE_ARRAY, DBUS_TYPE_STRING,
-                             &service_list, &service_list_len,
-                             DBUS_TYPE_INVALID))
+  if (!dbus_g_proxy_end_call (driver, call, &error,
+                              DBUS_TYPE_ARRAY, DBUS_TYPE_STRING,
+                              &service_list, &service_list_len,
+                              DBUS_TYPE_INVALID))
     {
       g_printerr ("Failed to complete ListServices call: %s\n",
                   error->message);
@@ -105,11 +111,11 @@
       ++i;
     }
   g_assert (service_list[i] == NULL);
-  
-  dbus_free_string_array (service_list);
+
+  g_strfreev (service_list);
 
   /* Test handling of unknown method */
-  call = dbus_gproxy_begin_call (driver, "ThisMethodDoesNotExist",
+  call = dbus_g_proxy_begin_call (driver, "ThisMethodDoesNotExist",
                                  DBUS_TYPE_STRING,
                                  "blah blah blah blah blah",
                                  DBUS_TYPE_INT32,
@@ -117,7 +123,7 @@
                                  DBUS_TYPE_INVALID);
 
   error = NULL;
-  if (dbus_gproxy_end_call (driver, call, &error,
+  if (dbus_g_proxy_end_call (driver, call, &error,
                             DBUS_TYPE_INVALID))
     {
       g_printerr ("Calling nonexistent method succeeded!\n");
@@ -129,7 +135,7 @@
   g_error_free (error);
   
   /* Activate a service */
-  call = dbus_gproxy_begin_call (driver, "ActivateService",
+  call = dbus_g_proxy_begin_call (driver, "ActivateService",
                                  DBUS_TYPE_STRING,
                                  "org.freedesktop.DBus.TestSuiteEchoService",
                                  DBUS_TYPE_UINT32,
@@ -137,7 +143,7 @@
                                  DBUS_TYPE_INVALID);
 
   error = NULL;
-  if (!dbus_gproxy_end_call (driver, call, &error,
+  if (!dbus_g_proxy_end_call (driver, call, &error,
                              DBUS_TYPE_UINT32, &result,
                              DBUS_TYPE_INVALID))
     {
@@ -150,7 +156,7 @@
   g_print ("Activation of echo service = 0x%x\n", result);
 
   /* Activate a service again */
-  call = dbus_gproxy_begin_call (driver, "ActivateService",
+  call = dbus_g_proxy_begin_call (driver, "ActivateService",
                                  DBUS_TYPE_STRING,
                                  "org.freedesktop.DBus.TestSuiteEchoService",
                                  DBUS_TYPE_UINT32,
@@ -158,7 +164,7 @@
                                  DBUS_TYPE_INVALID);
 
   error = NULL;
-  if (!dbus_gproxy_end_call (driver, call, &error,
+  if (!dbus_g_proxy_end_call (driver, call, &error,
                              DBUS_TYPE_UINT32, &result,
                              DBUS_TYPE_INVALID))
     {
@@ -172,11 +178,11 @@
 
   /* Talk to the new service */
   
-  proxy = dbus_gproxy_new_for_service_owner (connection,
-					     "org.freedesktop.DBus.TestSuiteEchoService",
-					     "/org/freedesktop/TestSuite",
-					     "org.freedesktop.TestSuite",
-					     &error);
+  proxy = dbus_g_proxy_new_for_service_owner (connection,
+                                              "org.freedesktop.DBus.TestSuiteEchoService",
+                                              "/org/freedesktop/TestSuite",
+                                              "org.freedesktop.TestSuite",
+                                              &error);
   
   if (proxy == NULL)
     {
@@ -186,13 +192,13 @@
       exit (1);      
     }
 
-  call = dbus_gproxy_begin_call (proxy, "Echo",
+  call = dbus_g_proxy_begin_call (proxy, "Echo",
                                  DBUS_TYPE_STRING,
                                  "my string hello",
                                  DBUS_TYPE_INVALID);
 
   error = NULL;
-  if (!dbus_gproxy_end_call (proxy, call, &error,
+  if (!dbus_g_proxy_end_call (proxy, call, &error,
                              DBUS_TYPE_STRING, &str,
                              DBUS_TYPE_INVALID))
     {
@@ -203,18 +209,18 @@
     }
 
   g_print ("String echoed = \"%s\"\n", str);
-  dbus_free (str);
+  g_free (str);
 
   /* Test oneway call and signal handling */
 
-  dbus_gproxy_connect_signal (proxy, "Foo",
-                              foo_signal_handler,
-                              NULL, NULL);
+  dbus_g_proxy_connect_signal (proxy, "Foo",
+                               G_CALLBACK (foo_signal_handler),
+                               NULL, NULL);
   
-  dbus_gproxy_call_no_reply (proxy, "EmitFoo",
-                             DBUS_TYPE_INVALID);
-
-  dbus_connection_flush (connection);
+  dbus_g_proxy_call_no_reply (proxy, "EmitFoo",
+                              DBUS_TYPE_INVALID);
+  
+  dbus_g_connection_flush (connection);
   
   g_timeout_add (5000, timed_exit, loop);
 

Index: test-profile.c
===================================================================
RCS file: /cvs/dbus/dbus/test/glib/test-profile.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- test-profile.c	2 Dec 2003 10:44:22 -0000	1.3
+++ test-profile.c	20 Jun 2004 15:28:15 -0000	1.4
@@ -28,7 +28,7 @@
 
 #include <config.h>
 #include <glib.h>
-#include "dbus-glib.h"
+#include <dbus/dbus-glib-lowlevel.h>
 #include <stdlib.h>
 
 #define N_CLIENT_THREADS 1

Index: test-service-glib.c
===================================================================
RCS file: /cvs/dbus/dbus/test/glib/test-service-glib.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- test-service-glib.c	28 May 2004 22:30:04 -0000	1.2
+++ test-service-glib.c	20 Jun 2004 15:28:15 -0000	1.3
@@ -1,5 +1,5 @@
 /* -*- mode: C; c-file-style: "gnu" -*- */
-#include "dbus-glib.h"
+#include <dbus/dbus-glib.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -9,7 +9,7 @@
 int
 main (int argc, char **argv)
 {
-  DBusConnection *connection;
+  DBusGConnection *connection;
   GError *error;
   
   g_type_init ();
@@ -17,8 +17,8 @@
   loop = g_main_loop_new (NULL, FALSE);
 
   error = NULL;
-  connection = dbus_bus_get_with_g_main (DBUS_BUS_ACTIVATION,
-                                         &error);
+  connection = dbus_g_bus_get (DBUS_BUS_ACTIVATION,
+                               &error);
   if (connection == NULL)
     {
       g_printerr ("Failed to open connection to bus: %s\n",

Index: test-thread-client.c
===================================================================
RCS file: /cvs/dbus/dbus/test/glib/test-thread-client.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- test-thread-client.c	30 Sep 2003 02:43:21 -0000	1.2
+++ test-thread-client.c	20 Jun 2004 15:28:15 -0000	1.3
@@ -1,5 +1,5 @@
 #include <glib.h>
-#include "dbus-glib.h"
+#include <dbus/dbus-glib-lowlevel.h>
 #include <stdio.h>
 #include <string.h>
 #include <unistd.h>

Index: test-thread-server.c
===================================================================
RCS file: /cvs/dbus/dbus/test/glib/test-thread-server.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- test-thread-server.c	30 Sep 2003 02:43:21 -0000	1.2
+++ test-thread-server.c	20 Jun 2004 15:28:15 -0000	1.3
@@ -1,5 +1,5 @@
 #include <glib.h>
-#include "dbus-glib.h"
+#include <dbus/dbus-glib-lowlevel.h>
 #include <stdio.h>
 #include <string.h>
 




More information about the dbus-commit mailing list