]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
gdbus: Use GLib.VariantType for D-Bus signature type
authorSergey Bugaev <bugaevc@gmail.com>
Mon, 23 Mar 2026 05:58:25 +0000 (08:58 +0300)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sat, 16 May 2026 11:23:32 +0000 (13:23 +0200)
The only complication here is that we can't easily use
g_variant_new_signature to construct one, since it takes an unowned
string, we have an owned one from g_variant_type_dup_string, and the way
the module is structured, it's hard to add clean-up code after producing
the desired value. So, we call the lower level g_variant_new_from_data
API instead, transferring ownership of our string, the same way as the
serialize_buffer_array code path does.

codegen/valagvariantmodule.vala
tests/dbus/basic-types.test
tests/dbus/basic-types_client.c-expected
tests/dbus/basic-types_server.c-expected
vapi/glib-2.0.vapi

index 596db9508dcdf9112d5730dc106c839c3ae8296d..af90ad4daa5d1f8a58491f4357c71ddcf70b920a 100644 (file)
@@ -314,14 +314,21 @@ public class Vala.GVariantModule : GValueModule {
                var get_call = new CCodeFunctionCall (new CCodeIdentifier ("g_variant_get_" + basic_type.type_name));
                get_call.add_argument (variant_expr);
 
+               bool is_signature = basic_type.signature == "g";
+
                if (basic_type.is_string) {
-                       if (transfer) {
+                       if (transfer || is_signature) {
                                get_call.call = new CCodeIdentifier ("g_variant_get_string");
                        } else {
                                get_call.call = new CCodeIdentifier ("g_variant_dup_string");
                        }
                        get_call.add_argument (new CCodeConstant ("NULL"));
                }
+               if (is_signature) {
+                       var type_new_call = new CCodeFunctionCall (new CCodeIdentifier ("g_variant_type_new"));
+                       type_new_call.add_argument (get_call);
+                       return type_new_call;
+               }
 
                return get_call;
        }
@@ -685,6 +692,29 @@ public class Vala.GVariantModule : GValueModule {
        }
 
        CCodeExpression? serialize_basic (BasicTypeInfo basic_type, CCodeExpression expr) {
+               if (basic_type.signature == "g") {
+                       string temp_name = "_tmp%d_".printf (next_temp_var_id++);
+                       ccode.add_declaration ("gchar*", new CCodeVariableDeclarator (temp_name));
+                       var ctemp = new CCodeIdentifier (temp_name);
+                       var dup_string_call = new CCodeFunctionCall (new CCodeIdentifier ("g_variant_type_dup_string"));
+                       dup_string_call.add_argument (expr);
+                       ccode.add_assignment (ctemp, dup_string_call);
+
+                       // Avoid g_variant_new_signature, since it takes an unowned string, and
+                       // we want to transfer ownership of ours.
+                       var strlen_call = new CCodeFunctionCall (new CCodeIdentifier ("strlen"));
+                       strlen_call.add_argument (ctemp);
+                       var csize = new CCodeBinaryExpression (CCodeBinaryOperator.PLUS, strlen_call, new CCodeConstant ("1"));
+                       var new_call = new CCodeFunctionCall (new CCodeIdentifier ("g_variant_new_from_data"));
+                       new_call.add_argument (new CCodeConstant ("G_VARIANT_TYPE_SIGNATURE"));
+                       new_call.add_argument (ctemp);
+                       new_call.add_argument (csize);
+                       new_call.add_argument (new CCodeConstant ("TRUE"));
+                       new_call.add_argument (new CCodeIdentifier ("g_free"));
+                       new_call.add_argument (ctemp);
+                       return new_call;
+               }
+
                var new_call = new CCodeFunctionCall (new CCodeIdentifier ("g_variant_new_" + basic_type.type_name));
                new_call.add_argument (expr);
                return new_call;
index cb61ea66229da8cc1de73e08c89616706178cfdb..756992f5d5ac7cfbb4a80d85c1558c1909822a09 100644 (file)
@@ -7,10 +7,12 @@ Program: client
 interface Test : Object {
        public abstract string test_property { owned get; set; }
        public abstract int test_int_property { get; set; }
+       public abstract VariantType test_signature_property { owned get; set; }
 
        public abstract void test_void () throws IOError;
        public abstract int test_int (int i, out int j) throws IOError;
        public abstract string test_string (string s, out string t) throws IOError;
+       public abstract VariantType test_signature (VariantType tp1, out VariantType tp2) throws IOError;
 }
 
 void main () {
@@ -29,6 +31,11 @@ void main () {
        assert (t == "world");
        assert (u == "vala");
 
+       VariantType tp1, tp2;
+       tp1 = test.test_signature (new VariantType ("a(bgha{sv})"), out tp2);
+       assert (tp1.dup_string () == "aaaas");
+       assert (tp2.dup_string () == "(ibt)");
+
        test.test_property = "hello";
        t = test.test_property;
        assert (t == "hello");
@@ -36,6 +43,10 @@ void main () {
        test.test_int_property = 42;
        j = test.test_int_property;
        assert (j == 42);
+
+       test.test_signature_property = tp2;
+       tp1 = test.test_signature_property;
+       assert (tp1.equal (tp2));
 }
 
 Program: server
@@ -44,6 +55,7 @@ Program: server
 class Test : Object {
        public string test_property { owned get; set; }
        public int test_int_property { get; set; }
+       public VariantType test_signature_property { owned get; set; }
 
        public void test_void () {
        }
@@ -59,6 +71,12 @@ class Test : Object {
                t = "world";
                return "vala";
        }
+
+       public VariantType test_signature (VariantType tp1, out VariantType tp2) {
+               assert (tp1.dup_string () == "a(bgha{sv})");
+               tp2 = new VariantType.tuple ({ VariantType.INT32, VariantType.BOOLEAN, VariantType.UINT64 });
+               return new VariantType.array (new VariantType.array (new VariantType.array (VariantType.STRING_ARRAY)));
+       }
 }
 
 MainLoop main_loop;
index d72b2019fda22abf2aa69050a883e8823ed6c1b5..67e9b333385eb0067536e38256b711ae1bd1932d 100644 (file)
@@ -37,6 +37,7 @@ typedef struct _TestIface TestIface;
 typedef GDBusProxy TestProxy;
 typedef GDBusProxyClass TestProxyClass;
 #define _g_free0(var) (var = (g_free (var), NULL))
+#define _g_variant_type_free0(var) ((var == NULL) ? NULL : (var = (g_variant_type_free (var), NULL)))
 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
 #define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
 #define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
@@ -48,10 +49,13 @@ struct _TestIface {
        void (*test_void) (Test* self, GError** error);
        gint (*test_int) (Test* self, gint i, gint* j, GError** error);
        gchar* (*test_string) (Test* self, const gchar* s, gchar** t, GError** error);
+       GVariantType* (*test_signature) (Test* self, const GVariantType* tp1, GVariantType** tp2, GError** error);
        gchar* (*get_test_property) (Test* self);
        void (*set_test_property) (Test* self, const gchar* value);
        gint (*get_test_int_property) (Test* self);
        void (*set_test_int_property) (Test* self, gint value);
+       GVariantType* (*get_test_signature_property) (Test* self);
+       void (*set_test_signature_property) (Test* self, const GVariantType* value);
 };
 
 VALA_EXTERN GType test_proxy_get_type (void) G_GNUC_CONST ;
@@ -71,12 +75,19 @@ VALA_EXTERN gchar* test_test_string (Test* self,
                          const gchar* s,
                          gchar** t,
                          GError** error);
+VALA_EXTERN GVariantType* test_test_signature (Test* self,
+                                   const GVariantType* tp1,
+                                   GVariantType** tp2,
+                                   GError** error);
 VALA_EXTERN gchar* test_get_test_property (Test* self);
 VALA_EXTERN void test_set_test_property (Test* self,
                              const gchar* value);
 VALA_EXTERN gint test_get_test_int_property (Test* self);
 VALA_EXTERN void test_set_test_int_property (Test* self,
                                  gint value);
+VALA_EXTERN GVariantType* test_get_test_signature_property (Test* self);
+VALA_EXTERN void test_set_test_signature_property (Test* self,
+                                       const GVariantType* value);
 static GType test_get_type_once (void);
 static void test_proxy_g_signal (GDBusProxy* proxy,
                           const gchar* sender_name,
@@ -92,12 +103,19 @@ static gchar* test_proxy_test_string (Test* self,
                                const gchar* s,
                                gchar** t,
                                GError** error);
+static GVariantType* test_proxy_test_signature (Test* self,
+                                         const GVariantType* tp1,
+                                         GVariantType** tp2,
+                                         GError** error);
 static gchar* test_dbus_proxy_get_test_property (Test* self);
 static void test_dbus_proxy_set_test_property (Test* self,
                                         const gchar* value);
 static gint test_dbus_proxy_get_test_int_property (Test* self);
 static void test_dbus_proxy_set_test_int_property (Test* self,
                                             gint value);
+static GVariantType* test_dbus_proxy_get_test_signature_property (Test* self);
+static void test_dbus_proxy_set_test_signature_property (Test* self,
+                                                  const GVariantType* value);
 static void test_proxy_test_interface_init (TestIface* iface);
 static void _dbus_test_test_void (Test* self,
                            GVariant* _parameters_,
@@ -108,6 +126,9 @@ static void _dbus_test_test_int (Test* self,
 static void _dbus_test_test_string (Test* self,
                              GVariant* _parameters_,
                              GDBusMethodInvocation* invocation);
+static void _dbus_test_test_signature (Test* self,
+                                GVariant* _parameters_,
+                                GDBusMethodInvocation* invocation);
 static void test_dbus_interface_method_call (GDBusConnection* connection,
                                       const gchar* sender,
                                       const gchar* object_path,
@@ -125,6 +146,7 @@ static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
                                             gpointer user_data);
 static GVariant* _dbus_test_get_test_property (Test* self);
 static GVariant* _dbus_test_get_test_int_property (Test* self);
+static GVariant* _dbus_test_get_test_signature_property (Test* self);
 static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
                                            const gchar* sender,
                                            const gchar* object_path,
@@ -137,6 +159,8 @@ static void _dbus_test_set_test_property (Test* self,
                                    GVariant* _value);
 static void _dbus_test_set_test_int_property (Test* self,
                                        GVariant* _value);
+static void _dbus_test_set_test_signature_property (Test* self,
+                                             GVariant* _value);
 static void _test_unregister_object (gpointer user_data);
 static void _vala_main (void);
 
@@ -155,11 +179,18 @@ static const GDBusArgInfo _test_dbus_arg_info_test_string_result = {-1, "result"
 static const GDBusArgInfo * const _test_dbus_arg_info_test_string_in[] = {&_test_dbus_arg_info_test_string_s, NULL};
 static const GDBusArgInfo * const _test_dbus_arg_info_test_string_out[] = {&_test_dbus_arg_info_test_string_t, &_test_dbus_arg_info_test_string_result, NULL};
 static const GDBusMethodInfo _test_dbus_method_info_test_string = {-1, "TestString", (GDBusArgInfo **) (&_test_dbus_arg_info_test_string_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_string_out), NULL};
-static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_test_void, &_test_dbus_method_info_test_int, &_test_dbus_method_info_test_string, NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_signature_tp1 = {-1, "tp1", "g", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_signature_tp2 = {-1, "tp2", "g", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_signature_result = {-1, "result", "g", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_signature_in[] = {&_test_dbus_arg_info_test_signature_tp1, NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_signature_out[] = {&_test_dbus_arg_info_test_signature_tp2, &_test_dbus_arg_info_test_signature_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_signature = {-1, "TestSignature", (GDBusArgInfo **) (&_test_dbus_arg_info_test_signature_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_signature_out), NULL};
+static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_test_void, &_test_dbus_method_info_test_int, &_test_dbus_method_info_test_string, &_test_dbus_method_info_test_signature, NULL};
 static const GDBusSignalInfo * const _test_dbus_signal_info[] = {NULL};
 static const GDBusPropertyInfo _test_dbus_property_info_test_property = {-1, "TestProperty", "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, NULL};
 static const GDBusPropertyInfo _test_dbus_property_info_test_int_property = {-1, "TestIntProperty", "i", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, NULL};
-static const GDBusPropertyInfo * const _test_dbus_property_info[] = {&_test_dbus_property_info_test_property, &_test_dbus_property_info_test_int_property, NULL};
+static const GDBusPropertyInfo _test_dbus_property_info_test_signature_property = {-1, "TestSignatureProperty", "g", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] = {&_test_dbus_property_info_test_property, &_test_dbus_property_info_test_int_property, &_test_dbus_property_info_test_signature_property, NULL};
 static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) (&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) (&_test_dbus_property_info), NULL};
 static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, test_dbus_interface_get_property, test_dbus_interface_set_property};
 
@@ -205,6 +236,21 @@ test_test_string (Test* self,
        return NULL;
 }
 
+GVariantType*
+test_test_signature (Test* self,
+                     const GVariantType* tp1,
+                     GVariantType** tp2,
+                     GError** error)
+{
+       TestIface* _iface_;
+       g_return_val_if_fail (IS_TEST (self), NULL);
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->test_signature) {
+               return _iface_->test_signature (self, tp1, tp2, error);
+       }
+       return NULL;
+}
+
 gchar*
 test_get_test_property (Test* self)
 {
@@ -253,6 +299,30 @@ test_set_test_int_property (Test* self,
        }
 }
 
+GVariantType*
+test_get_test_signature_property (Test* self)
+{
+       TestIface* _iface_;
+       g_return_val_if_fail (IS_TEST (self), NULL);
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->get_test_signature_property) {
+               return _iface_->get_test_signature_property (self);
+       }
+       return NULL;
+}
+
+void
+test_set_test_signature_property (Test* self,
+                                  const GVariantType* value)
+{
+       TestIface* _iface_;
+       g_return_if_fail (IS_TEST (self));
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->set_test_signature_property) {
+               _iface_->set_test_signature_property (self, value);
+       }
+}
+
 static void
 test_default_init (TestIface * iface,
                    gpointer iface_data)
@@ -421,6 +491,52 @@ test_proxy_test_string (Test* self,
        return _result;
 }
 
+static GVariantType*
+test_proxy_test_signature (Test* self,
+                           const GVariantType* tp1,
+                           GVariantType** tp2,
+                           GError** error)
+{
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       gchar* _tmp6_;
+       GDBusMessage *_reply_message;
+       GVariant *_reply;
+       GVariantIter _reply_iter;
+       GVariantType* _vala_tp2 = NULL;
+       GVariant* _tmp7_;
+       GVariantType* _result = NULL;
+       GVariant* _tmp8_;
+       G_IO_ERROR;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.Test", "TestSignature");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       _tmp6_ = g_variant_type_dup_string (tp1);
+       g_variant_builder_add_value (&_arguments_builder, g_variant_new_from_data (G_VARIANT_TYPE_SIGNATURE, _tmp6_, strlen (_tmp6_) + 1, TRUE, g_free, _tmp6_));
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       _reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout ((GDBusProxy *) self), NULL, NULL, error);
+       g_object_unref (_message);
+       if (!_reply_message) {
+               return NULL;
+       }
+       if (g_dbus_message_to_gerror (_reply_message, error)) {
+               g_object_unref (_reply_message);
+               return NULL;
+       }
+       _reply = g_dbus_message_get_body (_reply_message);
+       g_variant_iter_init (&_reply_iter, _reply);
+       _tmp7_ = g_variant_iter_next_value (&_reply_iter);
+       _vala_tp2 = g_variant_type_new (g_variant_get_string (_tmp7_, NULL));
+       g_variant_unref (_tmp7_);
+       *tp2 = _vala_tp2;
+       _tmp8_ = g_variant_iter_next_value (&_reply_iter);
+       _result = g_variant_type_new (g_variant_get_string (_tmp8_, NULL));
+       g_variant_unref (_tmp8_);
+       g_object_unref (_reply_message);
+       return _result;
+}
+
 static gchar*
 test_dbus_proxy_get_test_property (Test* self)
 {
@@ -484,8 +600,8 @@ test_dbus_proxy_get_test_int_property (Test* self)
                _arguments = g_variant_builder_end (&_arguments_builder);
                _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
                if (!_reply) {
-                       gint _tmp6_ = 0;
-                       return _tmp6_;
+                       gint _tmp9_ = 0;
+                       return _tmp9_;
                }
                g_variant_get (_reply, "(v)", &_inner_reply);
                g_variant_unref (_reply);
@@ -516,16 +632,68 @@ test_dbus_proxy_set_test_int_property (Test* self,
        g_variant_unref (_reply);
 }
 
+static GVariantType*
+test_dbus_proxy_get_test_signature_property (Test* self)
+{
+       GVariant *_inner_reply;
+       GVariantType* _result;
+       _inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "TestSignatureProperty");
+       if (!_inner_reply) {
+               GVariant *_arguments;
+               GVariant *_reply;
+               GVariantBuilder _arguments_builder;
+               g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+               g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.example.Test"));
+               g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("TestSignatureProperty"));
+               _arguments = g_variant_builder_end (&_arguments_builder);
+               _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+               if (!_reply) {
+                       return NULL;
+               }
+               g_variant_get (_reply, "(v)", &_inner_reply);
+               g_variant_unref (_reply);
+       }
+       _result = g_variant_type_new (g_variant_get_string (_inner_reply, NULL));
+       g_variant_unref (_inner_reply);
+       return _result;
+}
+
+static void
+test_dbus_proxy_set_test_signature_property (Test* self,
+                                             const GVariantType* value)
+{
+       GVariant *_arguments;
+       GVariant *_reply;
+       GVariantBuilder _arguments_builder;
+       gchar* _tmp10_;
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.example.Test"));
+       g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("TestSignatureProperty"));
+       g_variant_builder_open (&_arguments_builder, G_VARIANT_TYPE_VARIANT);
+       _tmp10_ = g_variant_type_dup_string (value);
+       g_variant_builder_add_value (&_arguments_builder, g_variant_new_from_data (G_VARIANT_TYPE_SIGNATURE, _tmp10_, strlen (_tmp10_) + 1, TRUE, g_free, _tmp10_));
+       g_variant_builder_close (&_arguments_builder);
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Set", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+       if (!_reply) {
+               return;
+       }
+       g_variant_unref (_reply);
+}
+
 static void
 test_proxy_test_interface_init (TestIface* iface)
 {
        iface->test_void = test_proxy_test_void;
        iface->test_int = test_proxy_test_int;
        iface->test_string = test_proxy_test_string;
+       iface->test_signature = test_proxy_test_signature;
        iface->get_test_property = test_dbus_proxy_get_test_property;
        iface->set_test_property = test_dbus_proxy_set_test_property;
        iface->get_test_int_property = test_dbus_proxy_get_test_int_property;
        iface->set_test_int_property = test_dbus_proxy_set_test_int_property;
+       iface->get_test_signature_property = test_dbus_proxy_get_test_signature_property;
+       iface->set_test_signature_property = test_dbus_proxy_set_test_signature_property;
 }
 
 static void
@@ -561,16 +729,16 @@ _dbus_test_test_int (Test* self,
        GError* error = NULL;
        GVariantIter _arguments_iter;
        gint i = 0;
-       GVariant* _tmp7_;
+       GVariant* _tmp11_;
        GDBusMessage* _reply_message = NULL;
        GVariant* _reply;
        GVariantBuilder _reply_builder;
        gint j = 0;
        gint result;
        g_variant_iter_init (&_arguments_iter, _parameters_);
-       _tmp7_ = g_variant_iter_next_value (&_arguments_iter);
-       i = g_variant_get_int32 (_tmp7_);
-       g_variant_unref (_tmp7_);
+       _tmp11_ = g_variant_iter_next_value (&_arguments_iter);
+       i = g_variant_get_int32 (_tmp11_);
+       g_variant_unref (_tmp11_);
        result = test_test_int (self, i, &j, &error);
        if (error) {
                g_dbus_method_invocation_take_error (invocation, error);
@@ -595,16 +763,16 @@ _dbus_test_test_string (Test* self,
        GError* error = NULL;
        GVariantIter _arguments_iter;
        gchar* s = NULL;
-       GVariant* _tmp8_;
+       GVariant* _tmp12_;
        GDBusMessage* _reply_message = NULL;
        GVariant* _reply;
        GVariantBuilder _reply_builder;
        gchar* t = NULL;
        gchar* result;
        g_variant_iter_init (&_arguments_iter, _parameters_);
-       _tmp8_ = g_variant_iter_next_value (&_arguments_iter);
-       s = g_variant_dup_string (_tmp8_, NULL);
-       g_variant_unref (_tmp8_);
+       _tmp12_ = g_variant_iter_next_value (&_arguments_iter);
+       s = g_variant_dup_string (_tmp12_, NULL);
+       g_variant_unref (_tmp12_);
        result = test_test_string (self, s, &t, &error);
        if (error) {
                g_dbus_method_invocation_take_error (invocation, error);
@@ -626,6 +794,49 @@ _dbus_test_test_string (Test* self,
        ;
 }
 
+static void
+_dbus_test_test_signature (Test* self,
+                           GVariant* _parameters_,
+                           GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       GVariantType* tp1 = NULL;
+       GVariant* _tmp13_;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       GVariantType* tp2 = NULL;
+       gchar* _tmp14_;
+       GVariantType* result;
+       gchar* _tmp15_;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _tmp13_ = g_variant_iter_next_value (&_arguments_iter);
+       tp1 = g_variant_type_new (g_variant_get_string (_tmp13_, NULL));
+       g_variant_unref (_tmp13_);
+       result = test_test_signature (self, tp1, &tp2, &error);
+       if (error) {
+               g_dbus_method_invocation_take_error (invocation, error);
+               goto _error;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _tmp14_ = g_variant_type_dup_string (tp2);
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_from_data (G_VARIANT_TYPE_SIGNATURE, _tmp14_, strlen (_tmp14_) + 1, TRUE, g_free, _tmp14_));
+       _tmp15_ = g_variant_type_dup_string (result);
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_from_data (G_VARIANT_TYPE_SIGNATURE, _tmp15_, strlen (_tmp15_) + 1, TRUE, g_free, _tmp15_));
+       _g_variant_type_free0 (result);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+       _error:
+       _g_variant_type_free0 (tp1);
+       _g_variant_type_free0 (tp2);
+       ;
+}
+
 static void
 test_dbus_interface_method_call (GDBusConnection* connection,
                                  const gchar* sender,
@@ -646,6 +857,8 @@ test_dbus_interface_method_call (GDBusConnection* connection,
                _dbus_test_test_int (object, parameters, invocation);
        } else if (strcmp (method_name, "TestString") == 0) {
                _dbus_test_test_string (object, parameters, invocation);
+       } else if (strcmp (method_name, "TestSignature") == 0) {
+               _dbus_test_test_signature (object, parameters, invocation);
        } else {
                g_object_unref (invocation);
        }
@@ -672,6 +885,19 @@ _dbus_test_get_test_int_property (Test* self)
        return _reply;
 }
 
+static GVariant*
+_dbus_test_get_test_signature_property (Test* self)
+{
+       GVariantType* result;
+       GVariant* _reply;
+       gchar* _tmp16_;
+       result = test_get_test_signature_property (self);
+       _tmp16_ = g_variant_type_dup_string (result);
+       _reply = g_variant_new_from_data (G_VARIANT_TYPE_SIGNATURE, _tmp16_, strlen (_tmp16_) + 1, TRUE, g_free, _tmp16_);
+       _g_variant_type_free0 (result);
+       return _reply;
+}
+
 static GVariant*
 test_dbus_interface_get_property (GDBusConnection* connection,
                                   const gchar* sender,
@@ -689,6 +915,8 @@ test_dbus_interface_get_property (GDBusConnection* connection,
                return _dbus_test_get_test_property (object);
        } else if (strcmp (property_name, "TestIntProperty") == 0) {
                return _dbus_test_get_test_int_property (object);
+       } else if (strcmp (property_name, "TestSignatureProperty") == 0) {
+               return _dbus_test_get_test_signature_property (object);
        }
        return NULL;
 }
@@ -712,6 +940,16 @@ _dbus_test_set_test_int_property (Test* self,
        test_set_test_int_property (self, value);
 }
 
+static void
+_dbus_test_set_test_signature_property (Test* self,
+                                        GVariant* _value)
+{
+       GVariantType* value = NULL;
+       value = g_variant_type_new (g_variant_get_string (_value, NULL));
+       test_set_test_signature_property (self, value);
+       _g_variant_type_free0 (value);
+}
+
 static gboolean
 test_dbus_interface_set_property (GDBusConnection* connection,
                                   const gchar* sender,
@@ -732,6 +970,9 @@ test_dbus_interface_set_property (GDBusConnection* connection,
        } else if (strcmp (property_name, "TestIntProperty") == 0) {
                _dbus_test_set_test_int_property (object, value);
                return TRUE;
+       } else if (strcmp (property_name, "TestSignatureProperty") == 0) {
+               _dbus_test_set_test_signature_property (object, value);
+               return TRUE;
        }
        return FALSE;
 }
@@ -787,15 +1028,38 @@ _vala_main (void)
        gchar* _tmp10_;
        const gchar* _tmp11_;
        const gchar* _tmp12_;
-       Test* _tmp13_;
+       GVariantType* tp1 = NULL;
+       GVariantType* tp2 = NULL;
+       GVariantType* _tmp13_ = NULL;
        Test* _tmp14_;
-       gchar* _tmp15_;
-       gchar* _tmp16_;
-       const gchar* _tmp17_;
-       Test* _tmp18_;
-       Test* _tmp19_;
-       gint _tmp20_;
-       gint _tmp21_;
+       GVariantType* _tmp15_;
+       GVariantType* _tmp16_;
+       GVariantType* _tmp17_ = NULL;
+       GVariantType* _tmp18_;
+       GVariantType* _tmp19_;
+       GVariantType* _tmp20_;
+       const GVariantType* _tmp21_;
+       gchar* _tmp22_;
+       gchar* _tmp23_;
+       const GVariantType* _tmp24_;
+       gchar* _tmp25_;
+       gchar* _tmp26_;
+       Test* _tmp27_;
+       Test* _tmp28_;
+       gchar* _tmp29_;
+       gchar* _tmp30_;
+       const gchar* _tmp31_;
+       Test* _tmp32_;
+       Test* _tmp33_;
+       gint _tmp34_;
+       gint _tmp35_;
+       Test* _tmp36_;
+       const GVariantType* _tmp37_;
+       Test* _tmp38_;
+       GVariantType* _tmp39_;
+       GVariantType* _tmp40_;
+       const GVariantType* _tmp41_;
+       const GVariantType* _tmp42_;
        GError* _inner_error0_ = NULL;
        _tmp0_ = (Test*) g_initable_new (TYPE_TEST_PROXY, NULL, &_inner_error0_, "g-flags", G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, "g-name", "org.example.Test", "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/example/test", "g-interface-name", "org.example.Test", NULL);
        test = (Test*) _tmp0_;
@@ -846,22 +1110,70 @@ _vala_main (void)
        _vala_assert (g_strcmp0 (_tmp11_, "world") == 0, "t == \"world\"");
        _tmp12_ = u;
        _vala_assert (g_strcmp0 (_tmp12_, "vala") == 0, "u == \"vala\"");
-       _tmp13_ = test;
-       test_set_test_property (_tmp13_, "hello");
        _tmp14_ = test;
-       _tmp15_ = test_get_test_property (_tmp14_);
+       _tmp15_ = g_variant_type_new ("a(bgha{sv})");
        _tmp16_ = _tmp15_;
+       _tmp18_ = test_test_signature (_tmp14_, _tmp16_, &_tmp17_, &_inner_error0_);
+       _g_variant_type_free0 (tp2);
+       tp2 = _tmp17_;
+       _tmp19_ = _tmp18_;
+       _g_variant_type_free0 (_tmp16_);
+       _tmp13_ = _tmp19_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_variant_type_free0 (tp2);
+               _g_variant_type_free0 (tp1);
+               _g_free0 (_tmp6_);
+               _g_free0 (u);
+               _g_free0 (t);
+               _g_object_unref0 (test);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp20_ = _tmp13_;
+       _tmp13_ = NULL;
+       _g_variant_type_free0 (tp1);
+       tp1 = _tmp20_;
+       _tmp21_ = tp1;
+       _tmp22_ = g_variant_type_dup_string (_tmp21_);
+       _tmp23_ = _tmp22_;
+       _vala_assert (g_strcmp0 (_tmp23_, "aaaas") == 0, "tp1.dup_string () == \"aaaas\"");
+       _g_free0 (_tmp23_);
+       _tmp24_ = tp2;
+       _tmp25_ = g_variant_type_dup_string (_tmp24_);
+       _tmp26_ = _tmp25_;
+       _vala_assert (g_strcmp0 (_tmp26_, "(ibt)") == 0, "tp2.dup_string () == \"(ibt)\"");
+       _g_free0 (_tmp26_);
+       _tmp27_ = test;
+       test_set_test_property (_tmp27_, "hello");
+       _tmp28_ = test;
+       _tmp29_ = test_get_test_property (_tmp28_);
+       _tmp30_ = _tmp29_;
        _g_free0 (t);
-       t = _tmp16_;
-       _tmp17_ = t;
-       _vala_assert (g_strcmp0 (_tmp17_, "hello") == 0, "t == \"hello\"");
-       _tmp18_ = test;
-       test_set_test_int_property (_tmp18_, 42);
-       _tmp19_ = test;
-       _tmp20_ = test_get_test_int_property (_tmp19_);
-       _tmp21_ = _tmp20_;
-       j = _tmp21_;
+       t = _tmp30_;
+       _tmp31_ = t;
+       _vala_assert (g_strcmp0 (_tmp31_, "hello") == 0, "t == \"hello\"");
+       _tmp32_ = test;
+       test_set_test_int_property (_tmp32_, 42);
+       _tmp33_ = test;
+       _tmp34_ = test_get_test_int_property (_tmp33_);
+       _tmp35_ = _tmp34_;
+       j = _tmp35_;
        _vala_assert (j == 42, "j == 42");
+       _tmp36_ = test;
+       _tmp37_ = tp2;
+       test_set_test_signature_property (_tmp36_, _tmp37_);
+       _tmp38_ = test;
+       _tmp39_ = test_get_test_signature_property (_tmp38_);
+       _tmp40_ = _tmp39_;
+       _g_variant_type_free0 (tp1);
+       tp1 = _tmp40_;
+       _tmp41_ = tp1;
+       _tmp42_ = tp2;
+       _vala_assert (g_variant_type_equal (_tmp41_, _tmp42_), "tp1.equal (tp2)");
+       _g_variant_type_free0 (_tmp13_);
+       _g_variant_type_free0 (tp2);
+       _g_variant_type_free0 (tp1);
        _g_free0 (_tmp6_);
        _g_free0 (u);
        _g_free0 (t);
index 6693c704f84f3a507b1a723bc4bf625d27e38652..b323ebe0d06856a133e8d56a489d1cb8ea72e6d9 100644 (file)
@@ -39,10 +39,12 @@ enum  {
        TEST_0_PROPERTY,
        TEST_TEST_PROPERTY_PROPERTY,
        TEST_TEST_INT_PROPERTY_PROPERTY,
+       TEST_TEST_SIGNATURE_PROPERTY_PROPERTY,
        TEST_NUM_PROPERTIES
 };
 static GParamSpec* test_properties[TEST_NUM_PROPERTIES];
 #define _g_free0(var) (var = (g_free (var), NULL))
+#define _g_variant_type_free0(var) ((var == NULL) ? NULL : (var = (g_variant_type_free (var), NULL)))
 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
 #define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
 #define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
@@ -63,6 +65,7 @@ struct _TestClass {
 struct _TestPrivate {
        gchar* _test_property;
        gint _test_int_property;
+       GVariantType* _test_signature_property;
 };
 
 static gint Test_private_offset;
@@ -83,6 +86,9 @@ VALA_EXTERN gint test_test_int (Test* self,
 VALA_EXTERN gchar* test_test_string (Test* self,
                          const gchar* s,
                          gchar** t);
+VALA_EXTERN GVariantType* test_test_signature (Test* self,
+                                   const GVariantType* tp1,
+                                   GVariantType** tp2);
 VALA_EXTERN Test* test_new (void);
 VALA_EXTERN Test* test_construct (GType object_type);
 VALA_EXTERN gchar* test_get_test_property (Test* self);
@@ -91,6 +97,9 @@ VALA_EXTERN void test_set_test_property (Test* self,
 VALA_EXTERN gint test_get_test_int_property (Test* self);
 VALA_EXTERN void test_set_test_int_property (Test* self,
                                  gint value);
+VALA_EXTERN GVariantType* test_get_test_signature_property (Test* self);
+VALA_EXTERN void test_set_test_signature_property (Test* self,
+                                       const GVariantType* value);
 static void test_finalize (GObject * obj);
 static GType test_get_type_once (void);
 static void _vala_test_get_property (GObject * object,
@@ -110,6 +119,9 @@ static void _dbus_test_test_int (Test* self,
 static void _dbus_test_test_string (Test* self,
                              GVariant* _parameters_,
                              GDBusMethodInvocation* invocation);
+static void _dbus_test_test_signature (Test* self,
+                                GVariant* _parameters_,
+                                GDBusMethodInvocation* invocation);
 static void test_dbus_interface_method_call (GDBusConnection* connection,
                                       const gchar* sender,
                                       const gchar* object_path,
@@ -127,6 +139,7 @@ static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
                                             gpointer user_data);
 static GVariant* _dbus_test_get_test_property (Test* self);
 static GVariant* _dbus_test_get_test_int_property (Test* self);
+static GVariant* _dbus_test_get_test_signature_property (Test* self);
 static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
                                            const gchar* sender,
                                            const gchar* object_path,
@@ -139,6 +152,8 @@ static void _dbus_test_set_test_property (Test* self,
                                    GVariant* _value);
 static void _dbus_test_set_test_int_property (Test* self,
                                        GVariant* _value);
+static void _dbus_test_set_test_signature_property (Test* self,
+                                             GVariant* _value);
 static void _test_unregister_object (gpointer user_data);
 VALA_EXTERN void client_exit (GPid pid,
                   gint status);
@@ -169,11 +184,18 @@ static const GDBusArgInfo _test_dbus_arg_info_test_string_result = {-1, "result"
 static const GDBusArgInfo * const _test_dbus_arg_info_test_string_in[] = {&_test_dbus_arg_info_test_string_s, NULL};
 static const GDBusArgInfo * const _test_dbus_arg_info_test_string_out[] = {&_test_dbus_arg_info_test_string_t, &_test_dbus_arg_info_test_string_result, NULL};
 static const GDBusMethodInfo _test_dbus_method_info_test_string = {-1, "TestString", (GDBusArgInfo **) (&_test_dbus_arg_info_test_string_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_string_out), NULL};
-static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_test_void, &_test_dbus_method_info_test_int, &_test_dbus_method_info_test_string, NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_signature_tp1 = {-1, "tp1", "g", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_signature_tp2 = {-1, "tp2", "g", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_signature_result = {-1, "result", "g", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_signature_in[] = {&_test_dbus_arg_info_test_signature_tp1, NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_signature_out[] = {&_test_dbus_arg_info_test_signature_tp2, &_test_dbus_arg_info_test_signature_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_signature = {-1, "TestSignature", (GDBusArgInfo **) (&_test_dbus_arg_info_test_signature_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_signature_out), NULL};
+static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_test_void, &_test_dbus_method_info_test_int, &_test_dbus_method_info_test_string, &_test_dbus_method_info_test_signature, NULL};
 static const GDBusSignalInfo * const _test_dbus_signal_info[] = {NULL};
 static const GDBusPropertyInfo _test_dbus_property_info_test_property = {-1, "TestProperty", "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, NULL};
 static const GDBusPropertyInfo _test_dbus_property_info_test_int_property = {-1, "TestIntProperty", "i", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, NULL};
-static const GDBusPropertyInfo * const _test_dbus_property_info[] = {&_test_dbus_property_info_test_property, &_test_dbus_property_info_test_int_property, NULL};
+static const GDBusPropertyInfo _test_dbus_property_info_test_signature_property = {-1, "TestSignatureProperty", "g", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] = {&_test_dbus_property_info_test_property, &_test_dbus_property_info_test_int_property, &_test_dbus_property_info_test_signature_property, NULL};
 static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) (&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) (&_test_dbus_property_info), NULL};
 static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, test_dbus_interface_get_property, test_dbus_interface_set_property};
 
@@ -231,6 +253,78 @@ test_test_string (Test* self,
        return result;
 }
 
+static gpointer
+_g_variant_type_copy0 (gpointer self)
+{
+       return self ? g_variant_type_copy (self) : NULL;
+}
+
+GVariantType*
+test_test_signature (Test* self,
+                     const GVariantType* tp1,
+                     GVariantType** tp2)
+{
+       GVariantType* _vala_tp2 = NULL;
+       gchar* _tmp0_;
+       gchar* _tmp1_;
+       const GVariantType* _tmp2_;
+       GVariantType* _tmp3_;
+       const GVariantType* _tmp4_;
+       GVariantType* _tmp5_;
+       const GVariantType* _tmp6_;
+       GVariantType* _tmp7_;
+       GVariantType** _tmp8_;
+       GVariantType** _tmp9_;
+       gint _tmp9__length1;
+       GVariantType* _tmp10_;
+       const GVariantType* _tmp11_;
+       GVariantType* _tmp12_;
+       GVariantType* _tmp13_;
+       GVariantType* _tmp14_;
+       GVariantType* _tmp15_;
+       GVariantType* _tmp16_;
+       GVariantType* _tmp17_;
+       GVariantType* result;
+       g_return_val_if_fail (IS_TEST (self), NULL);
+       g_return_val_if_fail (tp1 != NULL, NULL);
+       _tmp0_ = g_variant_type_dup_string (tp1);
+       _tmp1_ = _tmp0_;
+       _vala_assert (g_strcmp0 (_tmp1_, "a(bgha{sv})") == 0, "tp1.dup_string () == \"a(bgha{sv})\"");
+       _g_free0 (_tmp1_);
+       _tmp2_ = G_VARIANT_TYPE_INT32;
+       _tmp3_ = _g_variant_type_copy0 (_tmp2_);
+       _tmp4_ = G_VARIANT_TYPE_BOOLEAN;
+       _tmp5_ = _g_variant_type_copy0 (_tmp4_);
+       _tmp6_ = G_VARIANT_TYPE_UINT64;
+       _tmp7_ = _g_variant_type_copy0 (_tmp6_);
+       _tmp8_ = g_new0 (GVariantType*, 3 + 1);
+       _tmp8_[0] = _tmp3_;
+       _tmp8_[1] = _tmp5_;
+       _tmp8_[2] = _tmp7_;
+       _tmp9_ = _tmp8_;
+       _tmp9__length1 = 3;
+       _tmp10_ = g_variant_type_new_tuple (_tmp9_, 3);
+       _g_variant_type_free0 (_vala_tp2);
+       _vala_tp2 = _tmp10_;
+       _tmp9_ = (_vala_array_free (_tmp9_, _tmp9__length1, (GDestroyNotify) g_variant_type_free), NULL);
+       _tmp11_ = G_VARIANT_TYPE_STRING_ARRAY;
+       _tmp12_ = g_variant_type_new_array (_tmp11_);
+       _tmp13_ = _tmp12_;
+       _tmp14_ = g_variant_type_new_array (_tmp13_);
+       _tmp15_ = _tmp14_;
+       _tmp16_ = g_variant_type_new_array (_tmp15_);
+       _tmp17_ = _tmp16_;
+       _g_variant_type_free0 (_tmp15_);
+       _g_variant_type_free0 (_tmp13_);
+       result = _tmp17_;
+       if (tp2) {
+               *tp2 = _vala_tp2;
+       } else {
+               _g_variant_type_free0 (_vala_tp2);
+       }
+       return result;
+}
+
 Test*
 test_construct (GType object_type)
 {
@@ -297,6 +391,36 @@ test_set_test_int_property (Test* self,
        }
 }
 
+GVariantType*
+test_get_test_signature_property (Test* self)
+{
+       GVariantType* result;
+       const GVariantType* _tmp0_;
+       GVariantType* _tmp1_;
+       g_return_val_if_fail (IS_TEST (self), NULL);
+       _tmp0_ = self->priv->_test_signature_property;
+       _tmp1_ = _g_variant_type_copy0 (_tmp0_);
+       result = _tmp1_;
+       return result;
+}
+
+void
+test_set_test_signature_property (Test* self,
+                                  const GVariantType* value)
+{
+       GVariantType* old_value;
+       g_return_if_fail (IS_TEST (self));
+       old_value = test_get_test_signature_property (self);
+       if (old_value != value) {
+               GVariantType* _tmp0_;
+               _tmp0_ = _g_variant_type_copy0 (value);
+               _g_variant_type_free0 (self->priv->_test_signature_property);
+               self->priv->_test_signature_property = _tmp0_;
+               g_object_notify_by_pspec ((GObject *) self, test_properties[TEST_TEST_SIGNATURE_PROPERTY_PROPERTY]);
+       }
+       _g_variant_type_free0 (old_value);
+}
+
 static void
 test_class_init (TestClass * klass,
                  gpointer klass_data)
@@ -308,6 +432,7 @@ test_class_init (TestClass * klass,
        G_OBJECT_CLASS (klass)->finalize = test_finalize;
        g_object_class_install_property (G_OBJECT_CLASS (klass), TEST_TEST_PROPERTY_PROPERTY, test_properties[TEST_TEST_PROPERTY_PROPERTY] = g_param_spec_string ("test-property", "test-property", "test-property", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
        g_object_class_install_property (G_OBJECT_CLASS (klass), TEST_TEST_INT_PROPERTY_PROPERTY, test_properties[TEST_TEST_INT_PROPERTY_PROPERTY] = g_param_spec_int ("test-int-property", "test-int-property", "test-int-property", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), TEST_TEST_SIGNATURE_PROPERTY_PROPERTY, test_properties[TEST_TEST_SIGNATURE_PROPERTY_PROPERTY] = g_param_spec_boxed ("test-signature-property", "test-signature-property", "test-signature-property", G_TYPE_VARIANT_TYPE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
 }
 
 static void
@@ -323,6 +448,7 @@ test_finalize (GObject * obj)
        Test * self;
        self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_TEST, Test);
        _g_free0 (self->priv->_test_property);
+       _g_variant_type_free0 (self->priv->_test_signature_property);
        G_OBJECT_CLASS (test_parent_class)->finalize (obj);
 }
 
@@ -364,6 +490,9 @@ _vala_test_get_property (GObject * object,
                case TEST_TEST_INT_PROPERTY_PROPERTY:
                g_value_set_int (value, test_get_test_int_property (self));
                break;
+               case TEST_TEST_SIGNATURE_PROPERTY_PROPERTY:
+               g_value_take_boxed (value, test_get_test_signature_property (self));
+               break;
                default:
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
                break;
@@ -385,6 +514,9 @@ _vala_test_set_property (GObject * object,
                case TEST_TEST_INT_PROPERTY_PROPERTY:
                test_set_test_int_property (self, g_value_get_int (value));
                break;
+               case TEST_TEST_SIGNATURE_PROPERTY_PROPERTY:
+               test_set_test_signature_property (self, g_value_get_boxed (value));
+               break;
                default:
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
                break;
@@ -475,6 +607,43 @@ _dbus_test_test_string (Test* self,
        _g_free0 (t);
 }
 
+static void
+_dbus_test_test_signature (Test* self,
+                           GVariant* _parameters_,
+                           GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       GVariantType* tp1 = NULL;
+       GVariant* _tmp2_;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       GVariantType* tp2 = NULL;
+       gchar* _tmp3_;
+       GVariantType* result;
+       gchar* _tmp4_;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _tmp2_ = g_variant_iter_next_value (&_arguments_iter);
+       tp1 = g_variant_type_new (g_variant_get_string (_tmp2_, NULL));
+       g_variant_unref (_tmp2_);
+       result = test_test_signature (self, tp1, &tp2);
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _tmp3_ = g_variant_type_dup_string (tp2);
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_from_data (G_VARIANT_TYPE_SIGNATURE, _tmp3_, strlen (_tmp3_) + 1, TRUE, g_free, _tmp3_));
+       _tmp4_ = g_variant_type_dup_string (result);
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_from_data (G_VARIANT_TYPE_SIGNATURE, _tmp4_, strlen (_tmp4_) + 1, TRUE, g_free, _tmp4_));
+       _g_variant_type_free0 (result);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+       _g_variant_type_free0 (tp1);
+       _g_variant_type_free0 (tp2);
+}
+
 static void
 test_dbus_interface_method_call (GDBusConnection* connection,
                                  const gchar* sender,
@@ -495,6 +664,8 @@ test_dbus_interface_method_call (GDBusConnection* connection,
                _dbus_test_test_int (object, parameters, invocation);
        } else if (strcmp (method_name, "TestString") == 0) {
                _dbus_test_test_string (object, parameters, invocation);
+       } else if (strcmp (method_name, "TestSignature") == 0) {
+               _dbus_test_test_signature (object, parameters, invocation);
        } else {
                g_object_unref (invocation);
        }
@@ -521,6 +692,19 @@ _dbus_test_get_test_int_property (Test* self)
        return _reply;
 }
 
+static GVariant*
+_dbus_test_get_test_signature_property (Test* self)
+{
+       GVariantType* result;
+       GVariant* _reply;
+       gchar* _tmp5_;
+       result = test_get_test_signature_property (self);
+       _tmp5_ = g_variant_type_dup_string (result);
+       _reply = g_variant_new_from_data (G_VARIANT_TYPE_SIGNATURE, _tmp5_, strlen (_tmp5_) + 1, TRUE, g_free, _tmp5_);
+       _g_variant_type_free0 (result);
+       return _reply;
+}
+
 static GVariant*
 test_dbus_interface_get_property (GDBusConnection* connection,
                                   const gchar* sender,
@@ -538,6 +722,8 @@ test_dbus_interface_get_property (GDBusConnection* connection,
                return _dbus_test_get_test_property (object);
        } else if (strcmp (property_name, "TestIntProperty") == 0) {
                return _dbus_test_get_test_int_property (object);
+       } else if (strcmp (property_name, "TestSignatureProperty") == 0) {
+               return _dbus_test_get_test_signature_property (object);
        }
        return NULL;
 }
@@ -561,6 +747,16 @@ _dbus_test_set_test_int_property (Test* self,
        test_set_test_int_property (self, value);
 }
 
+static void
+_dbus_test_set_test_signature_property (Test* self,
+                                        GVariant* _value)
+{
+       GVariantType* value = NULL;
+       value = g_variant_type_new (g_variant_get_string (_value, NULL));
+       test_set_test_signature_property (self, value);
+       _g_variant_type_free0 (value);
+}
+
 static gboolean
 test_dbus_interface_set_property (GDBusConnection* connection,
                                   const gchar* sender,
@@ -581,6 +777,9 @@ test_dbus_interface_set_property (GDBusConnection* connection,
        } else if (strcmp (property_name, "TestIntProperty") == 0) {
                _dbus_test_set_test_int_property (object, value);
                return TRUE;
+       } else if (strcmp (property_name, "TestSignatureProperty") == 0) {
+               _dbus_test_set_test_signature_property (object, value);
+               return TRUE;
        }
        return FALSE;
 }
index bd75f0edd48183ef429c550a599073b8393188aa..1449ffd2e7811e9134beb54cbb457c19c8483c8d 100644 (file)
@@ -6472,7 +6472,7 @@ namespace GLib {
        [Compact]
        [Immutable]
        [Version (since = "2.24")]
-       [CCode (copy_function = "g_variant_type_copy", free_function = "g_variant_type_free", type_id = "G_TYPE_VARIANT_TYPE")]
+       [CCode (copy_function = "g_variant_type_copy", free_function = "g_variant_type_free", type_id = "G_TYPE_VARIANT_TYPE", type_signature = "g")]
        public class VariantType {
                [CCode (cname = "G_VARIANT_TYPE_BOOLEAN")]
                public static VariantType BOOLEAN;