From 65c706f0d9c2dd8ac34bcf9fe7b399eccea25fdc Mon Sep 17 00:00:00 2001 From: Johan Dahlin Date: Sun, 27 Apr 2008 23:13:24 +0000 Subject: [PATCH] Add two new functions to check sequence return values. Also fixes a 2008-04-27 Johan Dahlin * tests/parser/Foo-expected.gidl: * tests/parser/foo-object.h: * tests/parser/foo.c (foo_object_class_init), (foo_object_get_strings), (foo_object_get_objects): Add two new functions to check sequence return values. Also fixes a compilation warning. svn path=/trunk/; revision=232 --- ChangeLog | 9 +++++++++ tests/parser/Foo-expected.gidl | 14 +++++++++++++- tests/parser/foo-object.h | 2 ++ tests/parser/foo.c | 38 +++++++++++++++++++++++++++++++++++++- 4 files changed, 61 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0b6d19d..e681e6b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2008-04-27 Johan Dahlin + * tests/parser/Foo-expected.gidl: + * tests/parser/foo-object.h: + * tests/parser/foo.c (foo_object_class_init), + (foo_object_get_strings), (foo_object_get_objects): + Add two new functions to check sequence return values. + Also fixes a compilation warning. + +2008-04-27 Johan Dahlin + * giscanner/giscannermodule.c (]): Cast the getter, avoids a compilation warning. diff --git a/tests/parser/Foo-expected.gidl b/tests/parser/Foo-expected.gidl index 4259211..8e9547d 100644 --- a/tests/parser/Foo-expected.gidl +++ b/tests/parser/Foo-expected.gidl @@ -72,6 +72,18 @@ + + + + + + + + + + + + @@ -90,7 +102,7 @@ - + diff --git a/tests/parser/foo-object.h b/tests/parser/foo-object.h index 8605f26..bc2984a 100644 --- a/tests/parser/foo-object.h +++ b/tests/parser/foo-object.h @@ -57,6 +57,8 @@ gint foo_object_inout3 (FooObject *object, int *inou gint foo_object_in (FooObject *object, int *inarg); gint foo_object_calleeowns (FooObject *object, GObject *toown); gint foo_object_calleesowns (FooObject *object, GObject *toown1, GObject *toown2); +GList* foo_object_get_strings (FooObject *object); +GSList* foo_object_get_objects (FooObject *object); struct _FooSubobject diff --git a/tests/parser/foo.c b/tests/parser/foo.c index 6aba7cb..dbdb07a 100644 --- a/tests/parser/foo.c +++ b/tests/parser/foo.c @@ -102,7 +102,7 @@ foo_object_class_init (FooObjectClass *klass) g_signal_new ("signal", G_OBJECT_CLASS_TYPE (gobject_class), G_SIGNAL_RUN_LAST, - NULL, + 0, NULL, NULL, (GSignalCMarshaller)g_cclosure_marshal_STRING__OBJECT_POINTER, G_TYPE_STRING, 2, G_TYPE_OBJECT, G_TYPE_POINTER); @@ -244,6 +244,42 @@ foo_object_calleesowns (FooObject *object, GObject *toown1, GObject *toown2) /** + * foo_object_get_strings: + * @object: a #GObject + * + * This is a test for returning a list of strings + * + * Return value: (seq char* (callee-owns)) (caller-owns): list of strings + */ +GList* +foo_object_get_strings (FooObject *object) +{ + GList *list = NULL; + list = g_list_prepend (list, "foo"); + list = g_list_prepend (list, "bar"); + return list; +} + +/** + * foo_object_get_objects: + * @object: a #GObject + * + * This is a test for returning a list of objects. + * The list itself should be freed, but not the internal objects, + * intentionally similar example to gtk_container_get_children + * + * Return value: (seq FooObject* (callee-owns)) (caller-owns): a list + * of strings + */ +GSList* +foo_object_get_objects (FooObject *object) +{ + GSList *list = NULL; + list = g_slist_prepend (list, object); + return list; +} + +/** * foo_object_create_object: * @object: a #GObject * -- 2.7.4