[gobject-introspection/gir-docbook] Add Regress method for a closure taking and returning a GVariant
- From: Johan Dahlin <johan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection/gir-docbook] Add Regress method for a closure taking and returning a GVariant
- Date: Sat, 13 Aug 2011 12:43:20 +0000 (UTC)
commit 74850f014aba3f3c07456a9a95c86bf9e5d0e37c
Author: Martin Pitt <martin pitt ubuntu com>
Date: Fri Aug 12 09:57:41 2011 +0200
Add Regress method for a closure taking and returning a GVariant
tests/scanner/Regress-1.0-expected.gir | 17 +++++++++++++++++
tests/scanner/regress.c | 32 ++++++++++++++++++++++++++++++++
tests/scanner/regress.h | 1 +
3 files changed, 50 insertions(+), 0 deletions(-)
---
diff --git a/tests/scanner/Regress-1.0-expected.gir b/tests/scanner/Regress-1.0-expected.gir
index a85f38b..a19969e 100644
--- a/tests/scanner/Regress-1.0-expected.gir
+++ b/tests/scanner/Regress-1.0-expected.gir
@@ -1807,6 +1807,23 @@ call and can be released on return.</doc>
</parameter>
</parameters>
</function>
+ <function name="test_closure_variant"
+ c:identifier="regress_test_closure_variant">
+ <return-value transfer-ownership="full">
+ <doc xml:whitespace="preserve">the return value of @closure</doc>
+ <type name="GLib.Variant" c:type="GVariant*"/>
+ </return-value>
+ <parameters>
+ <parameter name="closure" transfer-ownership="none">
+ <doc xml:whitespace="preserve">GClosure which takes one GVariant and returns a GVariant</doc>
+ <type name="GObject.Closure" c:type="GClosure*"/>
+ </parameter>
+ <parameter name="arg" transfer-ownership="none">
+ <doc xml:whitespace="preserve">a GVariant passed as argument to @closure</doc>
+ <type name="GLib.Variant" c:type="GVariant*"/>
+ </parameter>
+ </parameters>
+ </function>
<function name="test_date_in_gvalue"
c:identifier="regress_test_date_in_gvalue">
<return-value transfer-ownership="full">
diff --git a/tests/scanner/regress.c b/tests/scanner/regress.c
index 220bc12..c6608f4 100644
--- a/tests/scanner/regress.c
+++ b/tests/scanner/regress.c
@@ -213,6 +213,38 @@ regress_test_closure_one_arg (GClosure *closure, int arg)
}
/**
+ * regress_test_closure_variant:
+ * @closure: GClosure which takes one GVariant and returns a GVariant
+ * @arg: (transfer none): a GVariant passed as argument to @closure
+ *
+ * Return value: (transfer full): the return value of @closure
+ */
+GVariant*
+regress_test_closure_variant (GClosure *closure, const GVariant* arg)
+{
+ GValue return_value = {0, };
+ GValue arguments[1] = {{0,} };
+ int ret;
+
+ g_value_init (&return_value, G_TYPE_VARIANT);
+
+ g_value_init (&arguments[0], G_TYPE_VARIANT);
+ g_value_set_variant (&arguments[0], arg);
+
+ g_closure_invoke (closure,
+ &return_value,
+ 1, arguments,
+ NULL);
+
+ ret = g_value_get_variant (&return_value);
+
+ g_value_unset (&return_value);
+ g_value_unset (&arguments[0]);
+
+ return ret;
+}
+
+/**
* regress_test_value_arg:
* @v: (transfer none): a GValue expected to contain an int
*
diff --git a/tests/scanner/regress.h b/tests/scanner/regress.h
index f3c3687..04ebe29 100644
--- a/tests/scanner/regress.h
+++ b/tests/scanner/regress.h
@@ -116,6 +116,7 @@ GHashTable *regress_test_ghash_nested_everything_return2 (void);
/* closure */
int regress_test_closure (GClosure *closure);
int regress_test_closure_one_arg (GClosure *closure, int arg);
+GVariant *regress_test_closure_variant (GClosure *closure, const GVariant* arg);
/* value */
int regress_test_int_value_arg(const GValue *v);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]