gobject-introspection r935 - in trunk: girepository tests/scanner
- From: walters svn gnome org
- To: svn-commits-list gnome org
- Subject: gobject-introspection r935 - in trunk: girepository tests/scanner
- Date: Mon, 17 Nov 2008 00:27:44 +0000 (UTC)
Author: walters
Date: Mon Nov 17 00:27:44 2008
New Revision: 935
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=935&view=rev
Log:
Add test for interface prereq
Modified:
trunk/girepository/girparser.c
trunk/tests/scanner/foo-1.0-expected.gir
trunk/tests/scanner/foo-1.0-expected.tgir
trunk/tests/scanner/foo.c
trunk/tests/scanner/foo.h
Modified: trunk/girepository/girparser.c
==============================================================================
--- trunk/girepository/girparser.c (original)
+++ trunk/girepository/girparser.c Mon Nov 17 00:27:44 2008
@@ -2519,7 +2519,7 @@
GIrNodeInterface *iface;
iface = (GIrNodeInterface *)ctx->current_node;
- iface ->prerequisites = g_list_append (iface->prerequisites, g_strdup (name));
+ iface->prerequisites = g_list_append (iface->prerequisites, g_strdup (name));
}
goto out;
}
Modified: trunk/tests/scanner/foo-1.0-expected.gir
==============================================================================
--- trunk/tests/scanner/foo-1.0-expected.gir (original)
+++ trunk/tests/scanner/foo-1.0-expected.gir Mon Nov 17 00:27:44 2008
@@ -40,6 +40,42 @@
</parameters>
</callback>
</record>
+ <interface name="SubInterface"
+ c:type="FooSubInterface"
+ glib:type-name="FooSubInterface"
+ glib:get-type="foo_sub_interface_get_type">
+ <prerequisite name="Interface"/>
+ <method name="do_bar" c:identifier="foo_sub_interface_do_bar">
+ <return-value transfer-ownership="none">
+ <type name="none" c:type="void"/>
+ </return-value>
+ </method>
+ <callback name="do_bar" c:type="do_bar">
+ <return-value transfer-ownership="none">
+ <type name="none" c:type="void"/>
+ </return-value>
+ <parameters>
+ <parameter name="self" transfer-ownership="none">
+ <type name="SubInterface" c:type="FooSubInterface*"/>
+ </parameter>
+ </parameters>
+ </callback>
+ </interface>
+ <record name="SubInterfaceIface" c:type="FooSubInterfaceIface">
+ <field name="parent_iface">
+ <type name="GObject.TypeInterface" c:type="GTypeInterface"/>
+ </field>
+ <callback name="do_bar" c:type="do_bar">
+ <return-value transfer-ownership="none">
+ <type name="none" c:type="void"/>
+ </return-value>
+ <parameters>
+ <parameter name="self" transfer-ownership="none">
+ <type name="SubInterface" c:type="FooSubInterface*"/>
+ </parameter>
+ </parameters>
+ </callback>
+ </record>
<class name="Object"
c:type="FooObject"
parent="GObject.Object"
Modified: trunk/tests/scanner/foo-1.0-expected.tgir
==============================================================================
--- trunk/tests/scanner/foo-1.0-expected.tgir (original)
+++ trunk/tests/scanner/foo-1.0-expected.tgir Mon Nov 17 00:27:44 2008
@@ -13,6 +13,19 @@
<type name="GObject.TypeInterface"/>
</field>
</record>
+ <interface name="SubInterface" glib:type-name="FooSubInterface" glib:get-type="foo_sub_interface_get_type">
+ <prerequisite name="Interface"/>
+ <method name="do_bar" c:identifier="foo_sub_interface_do_bar">
+ <return-value transfer-ownership="none">
+ <type name="none"/>
+ </return-value>
+ </method>
+ </interface>
+ <record name="SubInterfaceIface">
+ <field name="parent_iface">
+ <type name="GObject.TypeInterface"/>
+ </field>
+ </record>
<class name="Object" parent="GObject.Object" glib:type-name="FooObject" glib:get-type="foo_object_get_type">
<implements name="Interface"/>
<field name="parent_instance">
Modified: trunk/tests/scanner/foo.c
==============================================================================
--- trunk/tests/scanner/foo.c (original)
+++ trunk/tests/scanner/foo.c Mon Nov 17 00:27:44 2008
@@ -75,6 +75,30 @@
iface->do_foo = foo_do_foo;
}
+GType
+foo_sub_interface_get_type (void)
+{
+ static GType object_type = 0;
+
+ if (!object_type)
+ {
+ object_type = g_type_register_static_simple (G_TYPE_INTERFACE,
+ "FooSubInterface",
+ sizeof (FooSubInterfaceIface),
+ NULL, 0, NULL, 0);
+
+ g_type_interface_add_prerequisite (object_type, FOO_TYPE_INTERFACE);
+ }
+
+ return object_type;
+}
+
+void foo_sub_interface_do_bar (FooSubInterface *self)
+{
+ FOO_SUBINTERFACE_GET_INTERFACE(self)->do_bar (self);
+}
+
+
G_DEFINE_TYPE_EXTENDED (FooObject, foo_object, G_TYPE_OBJECT,
0, G_IMPLEMENT_INTERFACE (FOO_TYPE_INTERFACE,
foo_foo_interface_init));
Modified: trunk/tests/scanner/foo.h
==============================================================================
--- trunk/tests/scanner/foo.h (original)
+++ trunk/tests/scanner/foo.h Mon Nov 17 00:27:44 2008
@@ -9,6 +9,12 @@
#define FOO_IS_INTERFACE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), FOO_TYPE_INTERFACE))
#define FOO_INTERFACE_GET_INTERFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), FOO_TYPE_INTERFACE, FooInterfaceIface))
+#define FOO_TYPE_SUBINTERFACE (foo_sub_interface_get_type ())
+#define FOO_SUBINTERFACE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), FOO_TYPE_SUBINTERFACE, FooSubInterface))
+#define FOO_IS_SUBINTERFACE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), FOO_TYPE_SUBINTERFACE))
+#define FOO_SUBINTERFACE_GET_INTERFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), FOO_TYPE_SUBINTERFACE, FooSubInterfaceIface))
+
+
#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))
@@ -19,6 +25,8 @@
typedef struct _FooInterface FooInterface;
typedef struct _FooInterfaceIface FooInterfaceIface;
+typedef struct _FooSubInterface FooSubInterface;
+typedef struct _FooSubInterfaceIface FooSubInterfaceIface;
typedef struct _FooObject FooObject;
typedef struct _FooObjectClass FooObjectClass;
typedef struct _FooSubobject FooSubobject;
@@ -33,6 +41,17 @@
GType foo_interface_get_type (void) G_GNUC_CONST;
+struct _FooSubInterfaceIface
+{
+ GTypeInterface parent_iface;
+
+ void (*do_bar) (FooSubInterface *self);
+};
+
+GType foo_sub_interface_get_type (void) G_GNUC_CONST;
+
+void foo_sub_interface_do_bar (FooSubInterface *self);
+
struct _FooObject
{
GObject parent_instance;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]