summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomeu Vizoso <tomeu@sugarlabs.org>2009-11-10 19:37:28 +0100
committerTomeu Vizoso <tomeu@sugarlabs.org>2009-11-11 13:55:15 +0100
commitdd3fb48f981d3bc6419e779b218180a079971806 (patch)
tree1275b18c10e2d36d260fd000d82ce9db36b64a89
parentf8693bda3775f6339f38a17c037ac7bc4a4cc3f7 (diff)
downloadgobject-introspection-dd3fb48f981d3bc6419e779b218180a079971806.tar.gz
Don't put the callback element inside the field if it's not a glib struct
https://bugzilla.gnome.org/show_bug.cgi?id=557383
-rw-r--r--giscanner/girwriter.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/giscanner/girwriter.py b/giscanner/girwriter.py
index 47df929c..76a77d80 100644
--- a/giscanner/girwriter.py
+++ b/giscanner/girwriter.py
@@ -409,6 +409,7 @@ and/or use gtk-doc annotations. ''')
('glib:get-type', boxed.get_type)]
def _write_record(self, record, extra_attrs=[]):
+ is_gtype_struct = False
attrs = list(extra_attrs)
if record.name is not None:
attrs.append(('name', record.name))
@@ -418,6 +419,7 @@ and/or use gtk-doc annotations. ''')
attrs.append(('disguised', '1'))
if isinstance(record, GLibRecord):
if record.is_gtype_struct_for:
+ is_gtype_struct = True
attrs.append(('glib:is-gtype-struct-for',
record.is_gtype_struct_for))
if record.doc:
@@ -430,7 +432,7 @@ and/or use gtk-doc annotations. ''')
self._write_attributes(record)
if record.fields:
for field in record.fields:
- self._write_field(field)
+ self._write_field(field, is_gtype_struct)
for method in record.constructors:
self._write_constructor(method)
for method in record.methods:
@@ -458,7 +460,7 @@ and/or use gtk-doc annotations. ''')
for method in union.methods:
self._write_method(method)
- def _write_field(self, field):
+ def _write_field(self, field, is_gtype_struct=False):
if isinstance(field, Function):
self._write_method(field)
return
@@ -467,7 +469,11 @@ and/or use gtk-doc annotations. ''')
attrs = [('name', field.name)]
with self.tagcontext('field', attrs):
self._write_attributes(field)
- self._write_callback(field)
+ if is_gtype_struct:
+ self._write_callback(field)
+ else:
+ attrs = [('name', 'any'), ('c:type', 'pointer')]
+ self.write_tag('type', attrs)
elif isinstance(field, Struct):
self._write_record(field)
elif isinstance(field, Union):