+2008-10-17 Tommi Komulainen <tommi.komulainen@iki.fi>
+
+ Bug 556732 – generate gir files consistently
+
+ * giscanner/girwriter.py (_write_property): write properties
+ 'construct' attribute if set
+ * tools/generate.c (write_property_info): write properties
+ 'readable' and 'writable' attributes only if non-default
+ * tests/object.gir: add writable="0"
+ * tests/scanner/foo-1.0-expected.gir: add construct="1"
+
2008-10-17 Johan Bilien <jobi@via.ecp.fr>
* gir/glib-2.0.c: added annotations
def _write_property(self, prop):
attrs = [('name', prop.name)]
- # Properties are assumed to be readable
+ # Properties are assumed to be readable (see also generate.c)
if not prop.readable:
attrs.append(('readable', '0'))
if prop.writable:
attrs.append(('writable', '1'))
+ if prop.construct:
+ attrs.append(('construct', '1'))
if prop.construct_only:
attrs.append(('construct-only', '1'))
with self.tagcontext('property', attrs):
<interface name="IFace1" glib:type-name="IFace1" glib:get-type="iface1_get_type"/>
<class name="Object1" parent="Object2" glib:type-name="Object1" glib:get-type="object1_get_type">
<implements name="IFace1"/>
- <property name="prop1" readable="0" writable="0">
+ <property name="prop1" readable="0">
<type name="int"/>
</property>
<glib:signal name="signal1" when="LAST">
</parameter>
</parameters>
</method>
- <property name="string" writable="1">
+ <property name="string" writable="1" construct="1">
<type name="utf8" c:type="gchararray"/>
</property>
<field name="parent_instance">
if (deprecated)
xml_printf (file, " deprecated=\"1\"");
-
- if (flags & G_PARAM_READABLE)
- xml_printf (file, " readable=\"1\"");
- else
- xml_printf (file, " readable=\"0\"");
+ /* Properties are assumed to be read-only (see also girwriter.py) */
+ if (!(flags & G_PARAM_READABLE))
+ xml_printf (file, " readable=\"0\"");
if (flags & G_PARAM_WRITABLE)
xml_printf (file, " writable=\"1\"");
- else
- xml_printf (file, " writable=\"0\"");
if (flags & G_PARAM_CONSTRUCT)
xml_printf (file, " construct=\"1\"");