]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Add get_ccode_nick and get_ccode_blurb for properties
authorLuca Bruno <lucabru@src.gnome.org>
Sat, 6 Aug 2011 18:46:11 +0000 (20:46 +0200)
committerLuca Bruno <lucabru@src.gnome.org>
Sat, 6 Aug 2011 18:46:11 +0000 (20:46 +0200)
codegen/valaccodebasemodule.vala
codegen/valagtypemodule.vala

index 7b5c0ba970a5fd20f1924d2eb1d46771edbb45eb..c189a6f4156c6c8bb537b36cf73349117cd66f17 100644 (file)
@@ -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) {
index 198c0cb6f3a1bcdf80c4d8d420d13d1ef633b25c..83be7408f2681dc0daf2ee4e65a5afb609c9c3ab 100644 (file)
@@ -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)));