diff options
author | Robert McQueen <robot101@debian.org> | 2006-02-13 22:30:11 +0000 |
---|---|---|
committer | Robert McQueen <robot101@debian.org> | 2006-02-13 22:30:11 +0000 |
commit | 4a48fff0c7c0377d68d1e24cc113e275057b4800 (patch) | |
tree | 729444babf3951c53d44b9be4f0569cc173f81a8 /glib/dbus-binding-tool-glib.c | |
parent | 385c443cc7aacaadbdef391d3951699a7511fbb2 (diff) |
2006-02-13 Robert McQueen <robot101@debian.org>
* glib/dbus-binding-tool-glib.c, glib/dbus-gmain.c,
glib/dbus-gsignature.c, glib/dbus-gtype-specialized.c,
glib/dbus-gtype-specialized.h, glib/dbus-gvalue-utils.c,
glib/dbus-gvalue-utils.h, glib/dbus-gvalue.c:
Patch from Rob Taylor <rob.taylor@collabora.co.uk> to add a big
missing piece of the glib bindings jigsaw puzzle. This modifies
the existing specialised types to have N type parameters (rather
than the current 1 or 2 for arrays and dictionaries respectively).
You can then use this to get a glib type to represent any arbitrary
D-Bus struct type using dbus_g_type_get_struct. The only
implementation of these types is with GValueArrays as before,
but it's now possible to store these in arrays, emit them in
signals, etc.
Diffstat (limited to 'glib/dbus-binding-tool-glib.c')
-rw-r--r-- | glib/dbus-binding-tool-glib.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/glib/dbus-binding-tool-glib.c b/glib/dbus-binding-tool-glib.c index 21e02744..1386e3f1 100644 --- a/glib/dbus-binding-tool-glib.c +++ b/glib/dbus-binding-tool-glib.c @@ -98,6 +98,10 @@ static const char * dbus_g_type_get_c_name (GType gtype) { GType subtype; + if (dbus_g_type_is_struct (gtype)) + { + return "GValueArray"; + } if (dbus_g_type_is_collection (gtype)) { subtype = dbus_g_type_get_collection_specialization(gtype); @@ -1050,6 +1054,28 @@ dbus_g_type_get_lookup_function (GType gtype) g_free (value_lookup); return type_lookup; } + else if (dbus_g_type_is_struct (gtype)) + { + GType value_gtype; + GString *string; + char *value_lookup = NULL; + guint size, i; + + string = g_string_new ("dbus_g_type_get_struct (\"GValueArray\""); + + size = dbus_g_type_get_struct_size (gtype); + for (i=0; i < size; i++) + { + value_gtype = dbus_g_type_get_struct_member_type(gtype, i); + value_lookup = dbus_g_type_get_lookup_function (value_gtype); + g_assert (value_lookup); + g_string_append_printf (string, ", %s", value_lookup); + g_free (value_lookup); + } + g_string_append (string, ", G_TYPE_INVALID)"); + return g_string_free (string, FALSE); + } + MAP_KNOWN(G_TYPE_VALUE); MAP_KNOWN(G_TYPE_STRV); MAP_KNOWN(G_TYPE_VALUE_ARRAY); |