[vala/0.12] Support setting type_id to Vala.Interface



commit f3793a29eeb2f0787c9d181fbbc50143427f5182
Author: Luca Bruno <lucabru src gnome org>
Date:   Thu Mar 10 22:35:59 2011 +0100

    Support setting type_id to Vala.Interface

 vala/valacodewriter.vala |    2 ++
 vala/valainterface.vala  |   10 +++++++++-
 2 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/vala/valacodewriter.vala b/vala/valacodewriter.vala
index b6e31c2..dbbd516 100644
--- a/vala/valacodewriter.vala
+++ b/vala/valacodewriter.vala
@@ -509,6 +509,8 @@ public class Vala.CodeWriter : CodeVisitor {
 			write_string (", lower_case_csuffix = \"%s\"".printf (iface.get_lower_case_csuffix ()));
 		if (iface.get_type_cname () != iface.get_default_type_cname ())
 			write_string (", type_cname = \"%s\"".printf (iface.get_type_cname ()));
+		if (iface.get_type_id () != iface.get_default_type_id ())
+			write_string (", type_id = \"%s\"".printf (iface.get_type_id ()));
 
 		write_string (")]");
 		write_newline ();
diff --git a/vala/valainterface.vala b/vala/valainterface.vala
index 2c98426..92d9cbc 100644
--- a/vala/valainterface.vala
+++ b/vala/valainterface.vala
@@ -560,14 +560,22 @@ public class Vala.Interface : ObjectTypeSymbol {
 		return null;
 	}
 
+	public string? get_default_type_id () {
+		return get_upper_case_cname ("TYPE_");
+	}
+
 	public override string? get_type_id () {
 		if (type_id == null) {
-			type_id = get_upper_case_cname ("TYPE_");
+			type_id = get_default_type_id ();
 		}
 		
 		return type_id;
 	}
 
+	public void set_type_id (string type_id) {
+		this.type_id = type_id;
+	}
+
 	public override void replace_type (DataType old_type, DataType new_type) {
 		for (int i = 0; i < prerequisites.size; i++) {
 			if (prerequisites[i] == old_type) {



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