gobject-introspection r742 - in trunk: . giscanner tests tests/scanner tools



Author: tko
Date: Fri Oct 17 14:57:38 2008
New Revision: 742
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=742&view=rev

Log:
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"

Modified:
   trunk/ChangeLog
   trunk/giscanner/girwriter.py
   trunk/tests/object.gir
   trunk/tests/scanner/foo-1.0-expected.gir
   trunk/tools/generate.c

Modified: trunk/giscanner/girwriter.py
==============================================================================
--- trunk/giscanner/girwriter.py	(original)
+++ trunk/giscanner/girwriter.py	Fri Oct 17 14:57:38 2008
@@ -261,11 +261,13 @@
 
     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):

Modified: trunk/tests/object.gir
==============================================================================
--- trunk/tests/object.gir	(original)
+++ trunk/tests/object.gir	Fri Oct 17 14:57:38 2008
@@ -8,7 +8,7 @@
     <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">

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	Fri Oct 17 14:57:38 2008
@@ -133,7 +133,7 @@
           </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">

Modified: trunk/tools/generate.c
==============================================================================
--- trunk/tools/generate.c	(original)
+++ trunk/tools/generate.c	Fri Oct 17 14:57:38 2008
@@ -841,16 +841,12 @@
 
   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\"");



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]