[vala] codegen: Add get_ccode_nick and get_ccode_blurb for properties



commit 3406a5d6c4532385a4a9fb0a06f2dae1518ea141
Author: Luca Bruno <lucabru src gnome org>
Date:   Sat Aug 6 20:46:11 2011 +0200

    codegen: Add get_ccode_nick and get_ccode_blurb for properties

 codegen/valaccodebasemodule.vala |   16 ++++++++++++++++
 codegen/valagtypemodule.vala     |   10 ++--------
 2 files changed, 18 insertions(+), 8 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 7b5c0ba..c189a6f 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -5813,6 +5813,22 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 		return prop.get_attribute_bool ("CCode", "notify", true);
 	}
 
+	public static string get_ccode_nick (Property prop) {
+		var nick = prop.get_attribute_string ("Description", "nick");
+		if (nick == null) {
+			nick = prop.name.replace ("_", "-");
+		}
+		return nick;
+	}
+
+	public static string get_ccode_blurb (Property prop) {
+		var blurb = prop.get_attribute_string ("Description", "blurb");
+		if (blurb == null) {
+			blurb = prop.name.replace ("_", "-");
+		}
+		return blurb;
+	}
+
 	public static string get_ccode_declarator_suffix (DataType type) {
 		var array_type = type as ArrayType;
 		if (array_type != null) {
diff --git a/codegen/valagtypemodule.vala b/codegen/valagtypemodule.vala
index 198c0cb..83be740 100644
--- a/codegen/valagtypemodule.vala
+++ b/codegen/valagtypemodule.vala
@@ -1675,14 +1675,8 @@ public class Vala.GTypeModule : GErrorModule {
 	public override CCodeFunctionCall get_param_spec (Property prop) {
 		var cspec = new CCodeFunctionCall ();
 		cspec.add_argument (get_property_canonical_cconstant (prop));
-		var nick = prop.get_attribute_string ("Description", "nick");
-		if (nick == null) {
-			nick = prop.name.replace ("_", "-");
-		}
-		var blurb = prop.get_attribute_string ("Description", "blurb");
-		if (blurb == null) {
-			blurb = prop.name.replace ("_", "-");
-		}
+		var nick = get_ccode_nick (prop);
+		var blurb = get_ccode_blurb (prop);
 		cspec.add_argument (new CCodeConstant ("\"%s\"".printf (nick)));
 		cspec.add_argument (new CCodeConstant ("\"%s\"".printf (blurb)));
 



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