diff --git a/gio/gdbus-2.0/codegen/codegen.py b/gio/gdbus-2.0/codegen/codegen.py
index 5bc256713..03fc2dc9a 100644
--- a/gio/gdbus-2.0/codegen/codegen.py
+++ b/gio/gdbus-2.0/codegen/codegen.py
@@ -1395,7 +1395,7 @@ class CodeGenerator:
' * @proxy: A #%sProxy.\n'
%(i.name_lower, m.name_lower, i.camel_name))
for a in m.out_args:
- self.c.write(' * @out_%s: (out): Return location for return parameter or %%NULL to ignore.\n'%(a.name))
+ self.c.write(' * @out_%s: (out)%s: Return location for return parameter or %%NULL to ignore.\n'%(a.name, ' ' + a.array_annotation if a.array_annotation else ''))
if unix_fd:
self.c.write(' * @out_fd_list: (out): Return location for a #GUnixFDList or %NULL.\n')
self.c.write(self.docbook_gen.expand(
@@ -1450,7 +1450,7 @@ class CodeGenerator:
if unix_fd:
self.c.write(' * @fd_list: (nullable): A #GUnixFDList or %NULL.\n')
for a in m.out_args:
- self.c.write(' * @out_%s: (out): Return location for return parameter or %%NULL to ignore.\n'%(a.name))
+ self.c.write(' * @out_%s: (out)%s: Return location for return parameter or %%NULL to ignore.\n'%(a.name, ' ' + a.array_annotation if a.array_annotation else ''))
if unix_fd:
self.c.write(' * @out_fd_list: (out): Return location for a #GUnixFDList or %NULL.\n')
self.c.write(self.docbook_gen.expand(
diff --git a/gio/gdbus-2.0/codegen/dbustypes.py b/gio/gdbus-2.0/codegen/dbustypes.py
index b163cb935..2dc8e11eb 100644
--- a/gio/gdbus-2.0/codegen/dbustypes.py
+++ b/gio/gdbus-2.0/codegen/dbustypes.py
@@ -54,6 +54,8 @@ class Arg:
self.format_out = '@' + self.signature
self.gvariant_get = 'XXX'
self.gvalue_get = 'g_value_get_variant'
+ self.array_annotation = ''
+
if not utils.lookup_annotation(self.annotations, 'org.gtk.GDBus.C.ForceGVariant'):
if self.signature == 'b':
self.ctype_in_g = 'gboolean '
@@ -200,6 +202,7 @@ class Arg:
self.format_out = '^as'
self.gvariant_get = 'g_variant_get_strv'
self.gvalue_get = 'g_value_get_boxed'
+ self.array_annotation = '(array zero-terminated=1)'
elif self.signature == 'ao':
self.ctype_in_g = 'const gchar *const *'
self.ctype_in = 'const gchar *const *'
@@ -211,6 +214,7 @@ class Arg:
self.format_out = '^ao'
self.gvariant_get = 'g_variant_get_objv'
self.gvalue_get = 'g_value_get_boxed'
+ self.array_annotation = '(array zero-terminated=1)'
elif self.signature == 'aay':
self.ctype_in_g = 'const gchar *const *'
self.ctype_in = 'const gchar *const *'
@@ -222,6 +226,8 @@ class Arg:
self.format_out = '^aay'
self.gvariant_get = 'g_variant_get_bytestring_array'
self.gvalue_get = 'g_value_get_boxed'
+ self.array_annotation = '(array zero-terminated=1)'
+
class Method:
def __init__(self, name):
diff --git a/gio/tests/gdbus-test-codegen.c b/gio/tests/gdbus-test-codegen.c
index 3a0235106..c54c7aceb 100644
--- a/gio/tests/gdbus-test-codegen.c
+++ b/gio/tests/gdbus-test-codegen.c
@@ -172,7 +172,12 @@ on_handle_test_non_primitive_types (FooiGenBar *object,
s = g_strjoinv (", ", (gchar **) array_of_bytestrings);
g_string_append_printf (str, "array_of_bytestrings: [%s] ", s);
g_free (s);
- foo_igen_bar_complete_test_non_primitive_types (object, invocation, str->str);
+ foo_igen_bar_complete_test_non_primitive_types (object, invocation,
+ array_of_strings,
+ array_of_objpaths,
+ array_of_signatures,
+ array_of_bytestrings,
+ str->str);
g_string_free (str, TRUE);
return TRUE;
}
@@ -700,7 +705,12 @@ check_bar_proxy (FooiGenBar *proxy,
const gchar *array_of_strings[3] = {"one", "two", NULL};
const gchar *array_of_strings_2[3] = {"one2", "two2", NULL};
const gchar *array_of_objpaths[3] = {"/one", "/one/two", NULL};
+ GVariant *array_of_signatures = NULL;
const gchar *array_of_bytestrings[3] = {"one\xff", "two\xff", NULL};
+ gchar **ret_array_of_strings = NULL;
+ gchar **ret_array_of_objpaths = NULL;
+ GVariant *ret_array_of_signatures = NULL;
+ gchar **ret_array_of_bytestrings = NULL;
guchar ret_val_byte;
gboolean ret_val_boolean;
gint16 ret_val_int16;
@@ -888,6 +898,7 @@ check_bar_proxy (FooiGenBar *proxy,
g_assert (ret);
error = NULL;
+ array_of_signatures = g_variant_ref_sink (g_variant_new_parsed ("[@g 'ass', 'git']"));
ret = foo_igen_bar_call_test_non_primitive_types_sync (proxy,
g_variant_new_parsed ("{'one': 'red',"
" 'two': 'blue'}"),
@@ -896,8 +907,12 @@ check_bar_proxy (FooiGenBar *proxy,
g_variant_new_parsed ("(42, 'foo', 'bar')"),
array_of_strings,
array_of_objpaths,
- g_variant_new_parsed ("[@g 'ass', 'git']"),
+ array_of_signatures,
array_of_bytestrings,
+ &ret_array_of_strings,
+ &ret_array_of_objpaths,
+ &ret_array_of_signatures,
+ &ret_array_of_bytestrings,
&s,
NULL, /* GCancellable */
&error);
@@ -905,6 +920,24 @@ check_bar_proxy (FooiGenBar *proxy,
g_assert_no_error (error);
g_assert (ret);
+ g_assert_nonnull (ret_array_of_strings);
+ g_assert_cmpuint (g_strv_length ((gchar **) ret_array_of_strings), ==,
+ g_strv_length ((gchar **) array_of_strings));
+ g_assert_nonnull (ret_array_of_objpaths);
+ g_assert_cmpuint (g_strv_length ((gchar **) ret_array_of_objpaths), ==,
+ g_strv_length ((gchar **) array_of_objpaths));
+ g_assert_nonnull (ret_array_of_signatures);
+ g_assert_true (g_variant_equal (ret_array_of_signatures, array_of_signatures));
+ g_assert_nonnull (ret_array_of_bytestrings);
+ g_assert_cmpuint (g_strv_length ((gchar **) ret_array_of_bytestrings), ==,
+ g_strv_length ((gchar **) array_of_bytestrings));
+
+ g_clear_pointer (&ret_array_of_strings, g_strfreev);
+ g_clear_pointer (&ret_array_of_objpaths, g_strfreev);
+ g_clear_pointer (&ret_array_of_signatures, g_variant_unref);
+ g_clear_pointer (&ret_array_of_bytestrings, g_strfreev);
+ g_clear_pointer (&s, g_free);
+
/* Check that org.freedesktop.DBus.Error.UnknownMethod is returned on
* unimplemented methods.
*/
@@ -1049,6 +1082,7 @@ check_bar_proxy (FooiGenBar *proxy,
/* cleanup */
g_free (data);
+ g_variant_unref (array_of_signatures);
}
/* ---------------------------------------------------------------------------------------------------- */
diff --git a/gio/tests/test-codegen.xml b/gio/tests/test-codegen.xml
index 505ae5c17..885a21f77 100644
--- a/gio/tests/test-codegen.xml
+++ b/gio/tests/test-codegen.xml
@@ -50,9 +50,13 @@
+
+
+
+