dbus/glib dbus-binding-tool-glib.c,1.24,1.25
Robert McQueen
robot101 at freedesktop.org
Wed Jan 18 18:54:09 PST 2006
Update of /cvs/dbus/dbus/glib
In directory gabe:/tmp/cvs-serv30124/glib
Modified Files:
dbus-binding-tool-glib.c
Log Message:
2006-01-19 Robert McQueen <robot101 at debian.org>
* glib/dbus-binding-tool-glib.c: Patch from Rob Taylor
<rob.taylor at 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).
Index: dbus-binding-tool-glib.c
===================================================================
RCS file: /cvs/dbus/dbus/glib/dbus-binding-tool-glib.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- dbus-binding-tool-glib.c 5 Jan 2006 20:03:38 -0000 1.24
+++ dbus-binding-tool-glib.c 19 Jan 2006 02:54:07 -0000 1.25
@@ -97,11 +97,19 @@
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 @@
*/
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 @@
{
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))
More information about the dbus-commit
mailing list