]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Fix dbus-glib type for structs
authorJürg Billeter <j@bitron.ch>
Tue, 9 Dec 2008 16:50:17 +0000 (16:50 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Tue, 9 Dec 2008 16:50:17 +0000 (16:50 +0000)
2008-12-09  Jürg Billeter  <j@bitron.ch>

* gobject/valadbusclientmodule.vala:

Fix dbus-glib type for structs

svn path=/trunk/; revision=2128

ChangeLog
gobject/valadbusclientmodule.vala

index 0682fc6bfa0030e1bdd349002818dd564d88ed07..5ec2f5f1b697cfb5fec032932683d6b95acfdedb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-12-09  Jürg Billeter  <j@bitron.ch>
+
+       * gobject/valadbusclientmodule.vala:
+
+       Fix dbus-glib type for structs
+
 2008-12-09  Jürg Billeter  <j@bitron.ch>
 
        * gobject/valadbusclientmodule.vala:
index 5174614c8def15283e9723fe4ec2746eee3daae3..1f77f72517411ddcd8a102f8ef9de4a04ccd3f12 100644 (file)
@@ -497,10 +497,29 @@ public class Vala.DBusClientModule : DBusModule {
                        var type_args = data_type.get_type_arguments ();
 
                        cmap_type.add_argument (new CCodeConstant ("\"GHashTable\""));
-                       foreach (DataType type_arg in type_args)
+                       foreach (DataType type_arg in type_args) {
                                cmap_type.add_argument (get_dbus_g_type (type_arg));
+                       }
 
                        return cmap_type;
+               } else if (data_type.data_type.get_type_signature ().has_prefix ("(")) {
+                       // struct parameter
+                       var st = (Struct) data_type.data_type;
+
+                       var type_call = new CCodeFunctionCall (new CCodeIdentifier ("dbus_g_type_get_struct"));
+                       type_call.add_argument (new CCodeConstant ("\"GValueArray\""));
+
+                       foreach (Field f in st.get_fields ()) {
+                               if (f.binding != MemberBinding.INSTANCE) {
+                                       continue;
+                               }
+
+                               type_call.add_argument (get_dbus_g_type (f.field_type));
+                       }
+
+                       type_call.add_argument (new CCodeConstant ("G_TYPE_INVALID"));
+
+                       return type_call;
                } else {
                        return new CCodeIdentifier (data_type.data_type.get_type_id ());
                }