dbus/glib dbus-gidl.c, 1.9, 1.10 dbus-gidl.h, 1.6, 1.7 dbus-gloader-expat.c, 1.4, 1.5 dbus-gobject.c, 1.14, 1.15 dbus-gproxy.c, 1.14, 1.15 dbus-gutils.c, 1.8, 1.9

Havoc Pennington hp at freedesktop.org
Sat Jan 29 21:18:46 PST 2005


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

Modified Files:
	dbus-gidl.c dbus-gidl.h dbus-gloader-expat.c dbus-gobject.c 
	dbus-gproxy.c dbus-gutils.c 
Log Message:
2005-01-30  Havoc Pennington  <hp at redhat.com>

        dbus-viewer introspected and displayed the bus driver
	
	* dbus/dbus-object-tree.c 
	(object_tree_test_iteration): add tests for a handler registered on "/"

	* dbus/dbus-object-tree.c
	(_dbus_decompose_path): fix to handle path "/" properly
	(run_decompose_tests): add tests for path decomposition
	
	* glib/dbus-gutils.c (_dbus_gutils_split_path): fix to handle "/"
	properly

	* glib/dbus-gobject.c (handle_introspect): fix quotes

	* test/glib/run-test.sh: support launching the bus, then running
	dbus-viewer

	* test/glib/test-service-glib.c (main): put in a trivial gobject
	subclass and register it on the connection

	* bus/driver.c (bus_driver_handle_introspect): implement
	introspection of the bus driver service

	* dbus/dbus-protocol.h: add #defines for the XML namespace,
	identifiers, doctype decl

	* bus/driver.c (bus_driver_handle_get_service_owner): handle
	attempts to get owner of DBUS_SERVICE_ORG_FREEDESKTOP_DBUS by 
	returning the service unchanged.
	(bus_driver_handle_message): remove old check for reply_serial in
	method calls, now the message type deals with that
	(bus_driver_handle_message): handle NULL interface

	* glib/dbus-gproxy.c (dbus_g_proxy_get_bus_name): new function

	* glib/dbus-gloader-expat.c (description_load_from_string): allow
	-1 for len

	* tools/dbus-viewer.c: add support for introspecting a service on
	a bus

	* glib/dbus-gproxy.c (dbus_g_pending_call_ref): add
	(dbus_g_pending_call_unref): add



Index: dbus-gidl.c
===================================================================
RCS file: /cvs/dbus/dbus/glib/dbus-gidl.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- dbus-gidl.c	29 Jan 2005 19:52:19 -0000	1.9
+++ dbus-gidl.c	30 Jan 2005 05:18:44 -0000	1.10
@@ -303,6 +303,20 @@
   info->nodes = g_slist_append (info->nodes, node);
 }
 
+void
+node_info_replace_node (NodeInfo            *info,
+                        NodeInfo            *old_child,
+                        NodeInfo            *new_child)
+{
+  GSList *link;
+
+  node_info_ref (new_child); /* before unref old_child in case they are the same */
+  link = g_slist_find (info->nodes, old_child);
+  g_assert (link != NULL);
+  node_info_unref (old_child);
+  link->data = new_child;
+}
+
 InterfaceInfo*
 interface_info_new (const char *name)
 {

Index: dbus-gidl.h
===================================================================
RCS file: /cvs/dbus/dbus/glib/dbus-gidl.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- dbus-gidl.h	29 Jan 2005 19:52:19 -0000	1.6
+++ dbus-gidl.h	30 Jan 2005 05:18:44 -0000	1.7
@@ -83,6 +83,9 @@
                                                    InterfaceInfo       *interface);
 void                node_info_add_node            (NodeInfo            *info,
                                                    NodeInfo            *child);
+void                node_info_replace_node        (NodeInfo            *info,
+                                                   NodeInfo            *old_child,
+                                                   NodeInfo            *new_child);
 InterfaceInfo*      interface_info_new            (const char          *name);
 InterfaceInfo*      interface_info_ref            (InterfaceInfo       *info);
 void                interface_info_unref          (InterfaceInfo       *info);

Index: dbus-gloader-expat.c
===================================================================
RCS file: /cvs/dbus/dbus/glib/dbus-gloader-expat.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- dbus-gloader-expat.c	10 Aug 2004 03:07:00 -0000	1.4
+++ dbus-gloader-expat.c	30 Jan 2005 05:18:44 -0000	1.5
@@ -23,6 +23,7 @@
 
 #include "dbus-gparser.h"
 #include <expat.h>
+#include <string.h>
 
 static void*
 expat_g_malloc (size_t sz)
@@ -192,6 +193,9 @@
   
   g_return_val_if_fail (error == NULL || *error == NULL, NULL);
 
+  if (len < 0)
+    len = strlen (str);
+  
   expat = NULL;
   context.parser = NULL;
   context.error = error;

Index: dbus-gobject.c
===================================================================
RCS file: /cvs/dbus/dbus/glib/dbus-gobject.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- dbus-gobject.c	29 Jan 2005 20:12:21 -0000	1.14
+++ dbus-gobject.c	30 Jan 2005 05:18:44 -0000	1.15
@@ -289,26 +289,28 @@
   
   xml = g_string_new (NULL);
 
+  g_string_append (xml, DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE);
+  
   g_string_append (xml, "<node>\n");
 
   /* We are introspectable, though I guess that was pretty obvious */
   g_string_append (xml, "  <interface name=\"org.freedesktop.Introspectable\">\n");
   g_string_append (xml, "    <method name=\"Introspect\">\n");
-  g_string_append (xml, "      <arg name=\"data\" direction=\"out\" type=\"string\"\"/>\n");
+  g_string_append (xml, "      <arg name=\"data\" direction=\"out\" type=\"string\"/>\n");
   g_string_append (xml, "    </method>\n");
   g_string_append (xml, "  </interface>\n");
 
   /* We support get/set properties */
   g_string_append (xml, "  <interface name=\"org.freedesktop.Properties\">\n");
   g_string_append (xml, "    <method name=\"Get\">\n");
-  g_string_append (xml, "      <arg name=\"interface\" direction=\"in\" type=\"string\"\"/>\n");
-  g_string_append (xml, "      <arg name=\"propname\" direction=\"in\" type=\"string\"\"/>\n");
-  g_string_append (xml, "      <arg name=\"value\" direction=\"out\" type=\"variant\"\"/>\n");
+  g_string_append (xml, "      <arg name=\"interface\" direction=\"in\" type=\"string\"/>\n");
+  g_string_append (xml, "      <arg name=\"propname\" direction=\"in\" type=\"string\"/>\n");
+  g_string_append (xml, "      <arg name=\"value\" direction=\"out\" type=\"variant\"/>\n");
   g_string_append (xml, "    </method>\n");
   g_string_append (xml, "    <method name=\"Set\">\n");
-  g_string_append (xml, "      <arg name=\"interface\" direction=\"in\" type=\"string\"\"/>\n");
-  g_string_append (xml, "      <arg name=\"propname\" direction=\"in\" type=\"string\"\"/>\n");
-  g_string_append (xml, "      <arg name=\"value\" direction=\"in\" type=\"variant\"\"/>\n");
+  g_string_append (xml, "      <arg name=\"interface\" direction=\"in\" type=\"string\"/>\n");
+  g_string_append (xml, "      <arg name=\"propname\" direction=\"in\" type=\"string\"/>\n");
+  g_string_append (xml, "      <arg name=\"value\" direction=\"in\" type=\"variant\"/>\n");
   g_string_append (xml, "    </method>\n");
   g_string_append (xml, "  </interface>\n");
   

Index: dbus-gproxy.c
===================================================================
RCS file: /cvs/dbus/dbus/glib/dbus-gproxy.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- dbus-gproxy.c	18 Jan 2005 20:42:15 -0000	1.14
+++ dbus-gproxy.c	30 Jan 2005 05:18:44 -0000	1.15
@@ -1032,12 +1032,31 @@
   g_return_val_if_fail (interface_name != NULL, NULL);
 
   proxy = dbus_g_proxy_new (connection, NULL,
-                           path_name, interface_name);
+                            path_name, interface_name);
 
   return proxy;
 }
 
 /**
+ * Gets the bus name a proxy is bound to (may be #NULL in some cases).
+ * If you created the proxy with dbus_g_proxy_new_for_name(), then
+ * the name you passed to that will be returned.
+ * If you created it with dbus_g_proxy_new_for_name_owner(), then the
+ * unique connection name will be returned. If you created it
+ * with dbus_g_proxy_new_for_peer() then #NULL will be returned.
+ *
+ * @param proxy the proxy
+ * @returns the bus name the proxy sends messages to
+ */
+const char*
+dbus_g_proxy_get_bus_name (DBusGProxy        *proxy)
+{
+  g_return_val_if_fail (DBUS_IS_G_PROXY (proxy), NULL);
+
+  return proxy->name;
+}
+
+/**
  * Invokes a method on a remote interface. This function does not
  * block; instead it returns an opaque #DBusPendingCall object that
  * tracks the pending call.  The method call will not be sent over the
@@ -1113,23 +1132,28 @@
  *
  * Otherwise, the "out" parameters and return value of the
  * method are stored in the provided varargs list.
- * The list should be terminated with DBUS_TYPE_INVALID.
+ * The list should be terminated with #DBUS_TYPE_INVALID.
  *
  * This function doesn't affect the reference count of the
  * #DBusPendingCall, the caller of dbus_g_proxy_begin_call() still owns
  * a reference.
  *
+ * @todo this should be changed to make a g_malloc() copy of the
+ * data returned probably; right now the data vanishes
+ * when you free the PendingCall which is sort of strange.
+ *
  * @param proxy a proxy for a remote interface
  * @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 */
+ * @returns #FALSE if an error is set
+ */
 gboolean
 dbus_g_proxy_end_call (DBusGProxy          *proxy,
-                      DBusGPendingCall    *pending,
-                      GError             **error,
-                      int                  first_arg_type,
-                      ...)
+                       DBusGPendingCall    *pending,
+                       GError             **error,
+                       int                  first_arg_type,
+                       ...)
 {
   DBusMessage *message;
   va_list args;
@@ -1223,6 +1247,30 @@
 }
 
 /**
+ * Increments refcount on a pending call.
+ *
+ * @param call the call
+ * @returns the same call
+ */
+DBusGPendingCall*
+dbus_g_pending_call_ref (DBusGPendingCall  *call)
+{
+  dbus_pending_call_ref (DBUS_PENDING_CALL_FROM_G_PENDING_CALL (call));
+  return call;
+}
+
+/**
+ * Decrements refcount on a pending call.
+ *
+ * @param call the call
+ */
+void
+dbus_g_pending_call_unref (DBusGPendingCall  *call)
+{
+  dbus_pending_call_unref (DBUS_PENDING_CALL_FROM_G_PENDING_CALL (call));
+}
+
+/**
  * Sends a message to the interface we're proxying for.  Does not
  * block or wait for a reply. The message is only actually written out
  * when you return to the main loop or block in

Index: dbus-gutils.c
===================================================================
RCS file: /cvs/dbus/dbus/glib/dbus-gutils.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- dbus-gutils.c	28 Jan 2005 03:06:56 -0000	1.8
+++ dbus-gutils.c	30 Jan 2005 05:18:44 -0000	1.9
@@ -39,19 +39,25 @@
   len = strlen (path);
 
   n_components = 0;
-  i = 0;
-  while (i < len)
+  if (path[1] != '\0') /* if not "/" */
     {
-      if (path[i] == '/')
-        n_components += 1;
-      ++i;
+      i = 0;
+      while (i < len)
+        {
+          if (path[i] == '/')
+            n_components += 1;
+          ++i;
+        }
     }
 
   split = g_new0 (char*, n_components + 1);
 
   comp = 0;
-  i = 0;
-  while (i < len)
+  if (n_components == 0)
+    i = 1;
+  else
+    i = 0;
+  while (comp < n_components)
     {
       if (path[i] == '/')
         ++i;



More information about the dbus-commit mailing list