]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
GIR writer: Improve property generation
authorDidier 'Ptitjes <ptitjes@free.fr>
Sat, 21 Mar 2009 04:20:22 +0000 (05:20 +0100)
committerJürg Billeter <j@bitron.ch>
Thu, 30 Apr 2009 21:37:41 +0000 (23:37 +0200)
Generate readable, construct and construct-only attributes on property.

Signed-off-by: Didier 'Ptitjes <ptitjes@free.fr>
gobject/valagirwriter.vala

index f19031a22992e339e451a286c4267a9c5c1b0cd1..53ef7eb1e145b5399b8b323c64a7decbb6714444 100644 (file)
@@ -562,11 +562,18 @@ public class Vala.GIRWriter : CodeVisitor {
 
                write_indent ();
                stream.printf ("<property name=\"%s\"", prop.get_canonical_name ());
-               if (prop.get_accessor != null) {
-                       stream.printf (" readable=\"1\"");
+               if (prop.get_accessor == null) {
+                       stream.printf (" readable=\"0\"");
                }
                if (prop.set_accessor != null) {
                        stream.printf (" writable=\"1\"");
+                       if (prop.set_accessor.construction) {
+                               if (!prop.set_accessor.writable) {
+                                       stream.printf (" construct-only=\"1\"");
+                               } else {
+                                       stream.printf (" construct=\"1\"");
+                               }
+                       }
                }
                stream.printf (">\n");
                indent++;