[vala] girparser: Properly handle the c:symbol-prefix hint for lower_case_cprefix



commit 221a7f79754643bdfd0817749b9f63d745b87408
Author: Luca Bruno <lucabru src gnome org>
Date:   Sun Jul 24 21:38:42 2011 +0200

    girparser: Properly handle the c:symbol-prefix hint for lower_case_cprefix

 vala/valagirparser.vala |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index e7c2ca6..67d9941 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -573,7 +573,11 @@ public class Vala.GirParser : CodeVisitor {
 				if (metadata.has_argument (ArgumentType.CPREFIX)) {
 					return metadata.get_string (ArgumentType.CPREFIX);
 				}
-				return "%s%s_".printf (parent.get_lower_case_cprefix (), Symbol.camel_case_to_lower_case (name));
+				if (girdata != null && girdata["c:symbol-prefix"] != null) {
+					return "%s%s_".printf (parent.get_lower_case_cprefix (), girdata["c:symbol-prefix"]);
+				} else {
+					return "%s%s_".printf (parent.get_lower_case_cprefix (), Symbol.camel_case_to_lower_case (name));
+				}
 			} else {
 				return symbol.get_lower_case_cprefix ();
 			}
@@ -860,6 +864,11 @@ public class Vala.GirParser : CodeVisitor {
 						symbol.add_cheader_filename (filename);
 					}
 				}
+
+				// lower_case_cprefix
+				if (symbol is Class) {
+					((Class) symbol).set_lower_case_cprefix (get_lower_case_cprefix ());
+				}
 			}
 
 			if (!(new_symbol && merged) && is_container (symbol)) {
@@ -2207,9 +2216,6 @@ public class Vala.GirParser : CodeVisitor {
 			if (cname != null) {
 				cl.set_cname (cname);
 			}
-			if (metadata.has_argument (ArgumentType.CPREFIX)) {
-				cl.set_lower_case_cprefix (metadata.get_string (ArgumentType.CPREFIX));
-			}
 			cl.is_abstract = reader.get_attribute ("abstract") == "1";
 
 			if (parent != null) {



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