[gobject-introspection] [scanner] Allow nameless parameters for vfuncs
- From: Johan Dahlin <johan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection] [scanner] Allow nameless parameters for vfuncs
- Date: Thu, 2 Sep 2010 12:12:45 +0000 (UTC)
commit b6fb70f9b867d3ae4100e295d7c4dbb17293e8ed
Author: Johan Dahlin <johan gnome org>
Date: Thu Sep 2 09:10:30 2010 -0300
[scanner] Allow nameless parameters for vfuncs
Add a test case and disable fatal warnings since there's
currently no way to avoid the warning(s)
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=628567
giscanner/maintransformer.py | 1 +
tests/scanner/Foo-1.0-expected.gir | 47 ++++++++++++++++++++++++++++++++++++
tests/scanner/Makefile.am | 2 +-
tests/scanner/foo.c | 12 ++++++++-
tests/scanner/foo.h | 5 ++++
5 files changed, 65 insertions(+), 2 deletions(-)
---
diff --git a/giscanner/maintransformer.py b/giscanner/maintransformer.py
index 5463744..b529ee8 100644
--- a/giscanner/maintransformer.py
+++ b/giscanner/maintransformer.py
@@ -940,6 +940,7 @@ method or constructor of some type."""
callback_param.scope = ast.PARAM_SCOPE_NOTIFIED
callback_param.transfer = ast.PARAM_TRANSFER_NONE
elif (param.type.is_equiv(ast.TYPE_ANY) and
+ param.argname is not None and
param.argname.endswith('data')):
callback_param.closure_name = param.argname
diff --git a/tests/scanner/Foo-1.0-expected.gir b/tests/scanner/Foo-1.0-expected.gir
index 73c0310..59aa9ed 100644
--- a/tests/scanner/Foo-1.0-expected.gir
+++ b/tests/scanner/Foo-1.0-expected.gir
@@ -644,11 +644,40 @@ exposed to language bindings.</doc>
<type name="none" c:type="void"/>
</return-value>
</virtual-method>
+ <virtual-method name="do_baz" invoker="do_baz" introspectable="0">
+ <return-value transfer-ownership="none">
+ <type name="none" c:type="void"/>
+ </return-value>
+ <parameters>
+ <parameter transfer-ownership="none">
+ <type name="GObject.Callback" c:type="GCallback"/>
+ </parameter>
+ <parameter transfer-ownership="none">
+ <type name="gpointer" c:type="gpointer"/>
+ </parameter>
+ </parameters>
+ </virtual-method>
<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>
+ <method name="do_baz" c:identifier="foo_sub_interface_do_baz">
+ <return-value transfer-ownership="none">
+ <type name="none" c:type="void"/>
+ </return-value>
+ <parameters>
+ <parameter name="callback"
+ transfer-ownership="none"
+ scope="call"
+ closure="1">
+ <type name="GObject.Callback" c:type="GCallback"/>
+ </parameter>
+ <parameter name="data" transfer-ownership="none">
+ <type name="gpointer" c:type="gpointer"/>
+ </parameter>
+ </parameters>
+ </method>
<glib:signal name="destroy-event">
<return-value transfer-ownership="none">
<type name="none"/>
@@ -685,6 +714,24 @@ exposed to language bindings.</doc>
</parameters>
</callback>
</field>
+ <field name="do_baz" introspectable="0">
+ <callback name="do_baz" introspectable="0">
+ <return-value transfer-ownership="none">
+ <type name="none" c:type="void"/>
+ </return-value>
+ <parameters>
+ <parameter transfer-ownership="none">
+ <type name="SubInterface" c:type="FooSubInterface*"/>
+ </parameter>
+ <parameter transfer-ownership="none">
+ <type name="GObject.Callback" c:type="GCallback"/>
+ </parameter>
+ <parameter transfer-ownership="none">
+ <type name="gpointer" c:type="gpointer"/>
+ </parameter>
+ </parameters>
+ </callback>
+ </field>
</record>
<class name="Subobject"
c:symbol-prefix="subobject"
diff --git a/tests/scanner/Makefile.am b/tests/scanner/Makefile.am
index 5b20131..1b73d6b 100644
--- a/tests/scanner/Makefile.am
+++ b/tests/scanner/Makefile.am
@@ -1,7 +1,7 @@
include $(top_srcdir)/common.mk
include $(top_srcdir)/Makefile.introspection
-INTROSPECTION_SCANNER_ARGS += --warn-all --warn-error
+INTROSPECTION_SCANNER_ARGS += --warn-all
# We need to build a shared library, which can be dlopened
# it does not work with noinst_LTLIBRARIES
diff --git a/tests/scanner/foo.c b/tests/scanner/foo.c
index 9f4a3ed..3118be4 100644
--- a/tests/scanner/foo.c
+++ b/tests/scanner/foo.c
@@ -121,6 +121,16 @@ void foo_sub_interface_do_bar (FooSubInterface *self)
FOO_SUBINTERFACE_GET_INTERFACE(self)->do_bar (self);
}
+/**
+ * foo_sub_interface_do_baz:
+ * @self:
+ * @callback: (scope call):
+ */
+void
+foo_sub_interface_do_baz (FooSubInterface *self, GCallback callback, gpointer user_data)
+{
+ FOO_SUBINTERFACE_GET_INTERFACE(self)->do_baz (self, callback, user_data);
+}
G_DEFINE_TYPE_EXTENDED (FooObject, foo_object, G_TYPE_OBJECT,
0, G_IMPLEMENT_INTERFACE (FOO_TYPE_INTERFACE,
@@ -206,7 +216,7 @@ foo_object_init (FooObject *object)
/**
* foo_object_external_type:
* @object: a #FooObject
- *
+ *
* Returns: (transfer none): %NULL always
*/
UtilityObject*
diff --git a/tests/scanner/foo.h b/tests/scanner/foo.h
index 8687c94..6b65e1e 100644
--- a/tests/scanner/foo.h
+++ b/tests/scanner/foo.h
@@ -67,11 +67,16 @@ struct _FooSubInterfaceIface
/* virtual table */
void (*do_bar) (FooSubInterface *self);
+
+ void (*do_baz) (FooSubInterface *, GCallback, gpointer);
};
GType foo_sub_interface_get_type (void) G_GNUC_CONST;
void foo_sub_interface_do_bar (FooSubInterface *self);
+void foo_sub_interface_do_baz (FooSubInterface *self,
+ GCallback callback,
+ gpointer data);
struct _FooObject
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]