diff options
author | Juerg Billeter <j@bitron.ch> | 2008-01-11 17:52:29 +0000 |
---|---|---|
committer | Jürg Billeter <juergbi@src.gnome.org> | 2008-01-11 17:52:29 +0000 |
commit | 3bbe00773680bf4221afc2ab6007c9e25f0b0a63 (patch) | |
tree | c1b3c6c17631b0fe50479443522e4ad3ca5a7cb0 /tests | |
parent | 1def4610511fb455742f38b794e9b0e3d34db5fe (diff) | |
download | gobject-introspection-3bbe00773680bf4221afc2ab6007c9e25f0b0a63.tar.gz |
Initialize GObject to fix scanning interface properties.
2008-01-11 Juerg Billeter <j@bitron.ch>
* src/scanner.c: (g_igenerator_generate):
Initialize GObject to fix scanning interface properties.
* tests/parser/Foo-expected.gidl:
* tests/parser/foo-object.h:
* tests/parser/foo.c: (foo_interface_get_type):
Test interfaces with GObject prerequisite.
* tests/parser/Makefile.am:
Set G_DEBUG=fatal_warnings to abort test on warnings and criticals.
svn path=/trunk/; revision=93
Diffstat (limited to 'tests')
-rw-r--r-- | tests/parser/Foo-expected.gidl | 5 | ||||
-rw-r--r-- | tests/parser/Makefile.am | 2 | ||||
-rw-r--r-- | tests/parser/foo-object.h | 13 | ||||
-rw-r--r-- | tests/parser/foo.c | 18 |
4 files changed, 37 insertions, 1 deletions
diff --git a/tests/parser/Foo-expected.gidl b/tests/parser/Foo-expected.gidl index a95ce47c..464884a9 100644 --- a/tests/parser/Foo-expected.gidl +++ b/tests/parser/Foo-expected.gidl @@ -20,5 +20,10 @@ <return-type type="FooSubobject*"/> </constructor> </object> + <interface name="FooInterface" type-name="FooInterface" get-type="foo_interface_get_type"> + <requires> + <interface name="GObject"/> + </requires> + </interface> </namespace> </api> diff --git a/tests/parser/Makefile.am b/tests/parser/Makefile.am index 0c62ff48..a4b096f2 100644 --- a/tests/parser/Makefile.am +++ b/tests/parser/Makefile.am @@ -14,7 +14,7 @@ CLEANFILES = Foo.gidl SCAN_SOURCES = foo-object.h Foo.gidl: libfoo.la foo-object.h $(top_builddir)/src/g-idl-scanner - $(top_builddir)/src/g-idl-scanner -v --namespace=Foo \ + G_DEBUG=fatal_warnings $(top_builddir)/src/g-idl-scanner -v --namespace=Foo \ --include-idl=$(top_srcdir)/gidl/GLib.gidl \ $(SCAN_SOURCES) -I. $(GOBJECT_CFLAGS) \ libfoo.la --output $@ diff --git a/tests/parser/foo-object.h b/tests/parser/foo-object.h index 808a5e3b..20f69e47 100644 --- a/tests/parser/foo-object.h +++ b/tests/parser/foo-object.h @@ -3,6 +3,10 @@ #include <glib-object.h> +#define FOO_TYPE_INTERFACE (foo_interface_get_type ()) +#define FOO_INTERFACE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), FOO_TYPE_INTERFACE, FooInterface)) +#define FOO_IS_INTERFACE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), FOO_TYPE_INTERFACE)) + #define FOO_TYPE_OBJECT (foo_object_get_type ()) #define FOO_OBJECT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), FOO_TYPE_OBJECT, FooObject)) #define FOO_IS_OBJECT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), FOO_TYPE_OBJECT)) @@ -11,11 +15,20 @@ #define FOO_SUBOBJECT(subobject) (G_TYPE_CHECK_INSTANCE_CAST ((subobject), FOO_TYPE_SUBOBJECT, FooSubobject)) #define FOO_IS_SUBOBJECT(subobject) (G_TYPE_CHECK_INSTANCE_TYPE ((subobject), FOO_TYPE_SUBOBJECT)) +typedef struct _FooInterface FooInterface; +typedef struct _FooInterfaceIface FooInterfaceIface; typedef struct _FooObject FooObject; typedef struct _FooObjectClass FooObjectClass; typedef struct _FooSubobject FooSubobject; typedef struct _FooSubobjectClass FooSubobjectClass; +struct _FooInterfaceIface +{ + GTypeInterface parent_iface; +}; + +GType foo_interface_get_type (void) G_GNUC_CONST; + struct _FooObject { GObject parent_instance; diff --git a/tests/parser/foo.c b/tests/parser/foo.c index f96072b2..b073178e 100644 --- a/tests/parser/foo.c +++ b/tests/parser/foo.c @@ -2,6 +2,24 @@ #include "foo-object.h" +GType +foo_interface_get_type (void) +{ + static GType object_type = 0; + + if (!object_type) + { + object_type = g_type_register_static_simple (G_TYPE_INTERFACE, + "FooInterface", + sizeof (FooInterfaceIface), + NULL, 0, NULL, 0); + + g_type_interface_add_prerequisite (object_type, G_TYPE_OBJECT); + } + + return object_type; +} + G_DEFINE_TYPE (FooObject, foo_object, G_TYPE_OBJECT); static void |