dbus/test/glib test-service-glib.c, 1.16, 1.17 test-dbus-glib.c, 1.22, 1.23

Colin Walters walters at freedesktop.org
Wed Jun 29 16:52:37 PDT 2005


Update of /cvs/dbus/dbus/test/glib
In directory gabe:/tmp/cvs-serv27531/test/glib

Modified Files:
	test-service-glib.c test-dbus-glib.c 
Log Message:
2005-06-29  Colin Walters  <walters at verbum.org>

	* dbus/dbus-glib.h: Delete DBUS_TYPE_G_PROXY_ARRAY.  Add
	DBUS_TYPE_G_OBJECT_PATH.

	* glib/dbus-gvalue.c (dbus_g_value_types_init): Remove marshallers
	for G_TYPE_OBJECT and DBUS_TYPE_G_PROXY_ARRAY (the latter should
	be handled more generically).  Add DBUS_TYPE_G_OBJECT_PATH.
	(dbus_g_object_path_get_g_type): New function.
	(dbus_gtype_from_signature_iter): Map DBUS_TYPE_OBJECT_PATH
	to DBUS_TYPE_G_OBJECT_PATH by default.
	(demarshal_proxy): Remove unused name variable.
	(demarshal_object_path, marshal_object_path): New functions.
	(demarshal_proxy_array, marshal_proxy_array): Delete.
	
	* glib/dbus-binding-tool-glib.c (dbus_g_type_get_c_name): Map
	DBUS_TYPE_G_OBJECT_PATH to char *.
	(dbus_g_type_get_lookup_function): Map builtin
	DBUS_TYPE_G_OBJECT_PATH.

	* test/glib/test-dbus-glib.c
	* test/glib/test-service-glib.c (my_object_objpath): 
	Adapt tests to new object path marshalling.


Index: test-service-glib.c
===================================================================
RCS file: /cvs/dbus/dbus/test/glib/test-service-glib.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- test-service-glib.c	29 Jun 2005 16:58:59 -0000	1.16
+++ test-service-glib.c	29 Jun 2005 23:52:35 -0000	1.17
@@ -61,7 +61,7 @@
 gboolean my_object_recursive1 (MyObject *obj, GArray *array, guint32 *len_ret, GError **error);
 gboolean my_object_recursive2 (MyObject *obj, guint32 reqlen, GArray **array, GError **error);
 
-gboolean my_object_objpath (MyObject *obj, GObject *in, GObject **arg1, GError **error);
+gboolean my_object_objpath (MyObject *obj, const char *in, char **arg1, GError **error);
 
 gboolean my_object_stringify (MyObject *obj, GValue *value, char **ret, GError **error);
 gboolean my_object_unstringify (MyObject *obj, const char *str, GValue *value, GError **error);
@@ -362,9 +362,9 @@
 }
 
 gboolean
-my_object_objpath (MyObject *obj, GObject *incoming, GObject **outgoing, GError **error)
+my_object_objpath (MyObject *obj, const char *incoming, char **outgoing, GError **error)
 {
-  if ((GObject*) obj != incoming)
+  if (strcmp (incoming, "/org/freedesktop/DBus/Tests/MyTestObject"))
     {
       g_set_error (error,
 		   MY_OBJECT_ERROR,
@@ -372,7 +372,7 @@
 		   "invalid incoming object");
       return FALSE;
     }
-  *outgoing = g_object_ref (obj2);
+  *outgoing = g_strdup ("/org/freedesktop/DBus/Tests/MyTestObject2");
   return TRUE;
 }
 

Index: test-dbus-glib.c
===================================================================
RCS file: /cvs/dbus/dbus/test/glib/test-dbus-glib.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- test-dbus-glib.c	29 Jun 2005 16:58:59 -0000	1.22
+++ test-dbus-glib.c	29 Jun 2005 23:52:35 -0000	1.23
@@ -749,11 +749,14 @@
 
   {
     guint val;
+    char *ret_path;
     DBusGProxy *ret_proxy;
 
     g_print ("Calling (wrapped) objpath\n");
-    if (!org_freedesktop_DBus_Tests_MyObject_objpath (proxy, proxy, &ret_proxy, &error))
-      lose_gerror ("Failed to complete (wrapped) Objpath call", error);
+    if (!dbus_g_proxy_call (proxy, "Objpath", &error,
+			    DBUS_TYPE_G_PROXY, proxy, G_TYPE_INVALID,
+			    DBUS_TYPE_G_PROXY, &ret_proxy, G_TYPE_INVALID))
+      lose_gerror ("Failed to complete Objpath call", error);
     if (strcmp ("/org/freedesktop/DBus/Tests/MyTestObject2",
 		dbus_g_proxy_get_path (ret_proxy)) != 0)
       lose ("(wrapped) objpath call returned unexpected proxy %s",
@@ -802,20 +805,25 @@
 
     g_print ("Calling objpath again\n");
     ret_proxy = NULL;
-    if (!org_freedesktop_DBus_Tests_MyObject_objpath (proxy, proxy, &ret_proxy, &error))
-      lose_gerror ("Failed to complete (wrapped) Objpath call 2", error);
-    if (strcmp ("/org/freedesktop/DBus/Tests/MyTestObject2",
-		dbus_g_proxy_get_path (ret_proxy)) != 0)
-      lose ("(wrapped) objpath call 2 returned unexpected proxy %s",
-	    dbus_g_proxy_get_path (ret_proxy));
-    {
-      const char *iface = dbus_g_proxy_get_interface (ret_proxy);
-      g_print ("returned proxy has interface \"%s\"\n",
-	       iface ? iface : "(NULL)");
-    }
 
-    dbus_g_proxy_set_interface (ret_proxy, "org.freedesktop.DBus.Tests.FooObject");
+    if (!dbus_g_proxy_call (proxy, "Objpath", &error,
+			    DBUS_TYPE_G_OBJECT_PATH,
+			    dbus_g_proxy_get_path (proxy),
+			    G_TYPE_INVALID,
+			    DBUS_TYPE_G_OBJECT_PATH,
+			    &ret_path,
+			    G_TYPE_INVALID))
+      lose_gerror ("Failed to complete (wrapped) Objpath call 2", error);
+    if (strcmp ("/org/freedesktop/DBus/Tests/MyTestObject2", ret_path) != 0)
+      lose ("(wrapped) objpath call 2 returned unexpected path %s",
+	    ret_path);
 
+    ret_proxy = dbus_g_proxy_new_for_name_owner (connection,
+						 "org.freedesktop.DBus.TestSuiteGLibService",
+						 ret_path,
+						 "org.freedesktop.DBus.Tests.FooObject",
+						 &error);
+    
     val = 0;
     if (!org_freedesktop_DBus_Tests_FooObject_get_value (ret_proxy, &val, &error))
       lose_gerror ("Failed to complete (wrapped) GetValue call", error);



More information about the dbus-commit mailing list