summaryrefslogtreecommitdiffstats
path: root/glib
diff options
context:
space:
mode:
authorRobert McQueen <robot101@debian.org>2006-01-19 02:54:07 +0000
committerRobert McQueen <robot101@debian.org>2006-01-19 02:54:07 +0000
commit78245816603b8f03331f892cd87922e9d2b9b5cb (patch)
treef83339c3de9ee2085fbb2f29ff722c199bf6c4f8 /glib
parentec45ff438943f9ec9e417ae48db7a1ca9dceca30 (diff)
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).
Diffstat (limited to 'glib')
-rw-r--r--glib/dbus-binding-tool-glib.c32
1 files changed, 26 insertions, 6 deletions
diff --git a/glib/dbus-binding-tool-glib.c b/glib/dbus-binding-tool-glib.c
index f75a18a4..719296f0 100644
--- a/glib/dbus-binding-tool-glib.c
+++ b/glib/dbus-binding-tool-glib.c
@@ -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))