[vala/switch-to-gir: 48/49] Support setting type_id to Vala.Interface



commit 32ebe7dcbca6ae37cdaf88b3d936f9b5f82bd838
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 ed16303..c3a7d64 100644
--- a/vala/valacodewriter.vala
+++ b/vala/valacodewriter.vala
@@ -498,6 +498,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 72e0f64..b7ee017 100644
--- a/vala/valainterface.vala
+++ b/vala/valainterface.vala
@@ -558,14 +558,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]