]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
2006-01-19 Robert McQueen <robot101@debian.org>
authorRobert McQueen <robot101@debian.org>
Thu, 19 Jan 2006 02:54:07 +0000 (02:54 +0000)
committerRobert McQueen <robot101@debian.org>
Thu, 19 Jan 2006 02:54:07 +0000 (02:54 +0000)
* glib/dbus-binding-tool-glib.c: Patch from Rob Taylor
<rob.taylor@collabora.co.uk> to add support for generating bindings
to arrays that are represented as GPtrArrays rather than GArrays (ie
size-variable things, such as strings, objects, structs, etc).

ChangeLog
glib/dbus-binding-tool-glib.c

index 6c0fbdc43095461988081e3786bc5746aae9050a..825ad957de8fa4286f2fec4a28eef9c0a41f6b73 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-01-19  Robert McQueen  <robot101@debian.org>
+
+       * glib/dbus-binding-tool-glib.c: Patch from Rob Taylor
+       <rob.taylor@collabora.co.uk> to add support for generating bindings
+       to arrays that are represented as GPtrArrays rather than GArrays (ie
+       size-variable things, such as strings, objects, structs, etc).
+
 2006-01-05  Robert McQueen  <robot101@debian.org>
 
        * dbus/dbus-glib.h, glib/dbus-gproxy.c: Patch from Ricardo Kekki
index f75a18a4dc7ba46ff474b367eb1d47406a11d059..719296f0e56c643b999ea3a3696ed9914f83f5cc 100644 (file)
@@ -97,11 +97,19 @@ dbus_g_type_get_marshal_name (GType gtype)
 static const char *
 dbus_g_type_get_c_name (GType gtype)
 {
+  GType subtype;
   if (dbus_g_type_is_collection (gtype))
-    return "GArray";
+    {
+      subtype = dbus_g_type_get_collection_specialization(gtype);
+      if (_dbus_g_type_is_fixed (subtype))
+        return "GArray";
+      else
+        return "GPtrArray";
+    }
+
   if (dbus_g_type_is_map (gtype))
     return "GHashTable";
-  
+
   if (g_type_is_a (gtype, G_TYPE_STRING))
     return "char *";
 
@@ -110,9 +118,10 @@ dbus_g_type_get_c_name (GType gtype)
    */
   if (g_type_is_a (gtype, G_TYPE_STRV))
     return "char *";
+
   if (g_type_is_a (gtype, DBUS_TYPE_G_OBJECT_PATH))
     return "char";
-  
+
   return g_type_name (gtype);
 }
 
@@ -1005,13 +1014,24 @@ dbus_g_type_get_lookup_function (GType gtype)
     {
       GType elt_gtype;
       char *sublookup;
-      
+
       elt_gtype = dbus_g_type_get_collection_specialization (gtype);
       sublookup = dbus_g_type_get_lookup_function (elt_gtype);
       g_assert (sublookup);
-      type_lookup = g_strdup_printf ("dbus_g_type_get_collection (\"GArray\", %s)",
-                                    sublookup);
+
+      if (_dbus_g_type_is_fixed (elt_gtype))
+        {
+          type_lookup = g_strdup_printf ("dbus_g_type_get_collection "
+              "(\"GArray\", %s)", sublookup);
+        }
+      else
+        {
+          type_lookup = g_strdup_printf ("dbus_g_type_get_collection "
+              "(\"GPtrArray\", %s)", sublookup);
+        }
+
       g_free (sublookup);
+
       return type_lookup;
     }
   else if (dbus_g_type_is_map (gtype))