[vala] GIR writer: Improve property generation



commit c8abdb70a5f35f5eab388bca049d12432f70552a
Author: Didier 'Ptitjes <ptitjes free fr>
Date:   Sat Mar 21 05:20:22 2009 +0100

    GIR writer: Improve property generation
    
    Generate readable, construct and construct-only attributes on property.
    
    Signed-off-by: Didier 'Ptitjes <ptitjes free fr>
---
 gobject/valagirwriter.vala |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/gobject/valagirwriter.vala b/gobject/valagirwriter.vala
index f19031a..53ef7eb 100644
--- a/gobject/valagirwriter.vala
+++ b/gobject/valagirwriter.vala
@@ -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++;



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