]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
support GType properties, patch by Ali Sabil
authorJuerg Billeter <j@bitron.ch>
Sat, 9 Feb 2008 18:56:19 +0000 (18:56 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Sat, 9 Feb 2008 18:56:19 +0000 (18:56 +0000)
2008-02-09  Juerg Billeter  <j@bitron.ch>

* gobject/valaccodegenerator.vala,
  gobject/valaccodegeneratorinterface.vala: support GType
  properties, patch by Ali Sabil

svn path=/trunk/; revision=1003

ChangeLog
gobject/valaccodegenerator.vala
gobject/valaccodegeneratorinterface.vala

index 6f176970a214d4dbc31ce0db2d0ba3fcbe32962e..8c212ab29991a3a9853ca7054db11f90a8ef5ceb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-02-09  Jürg Billeter  <j@bitron.ch>
+
+       * gobject/valaccodegenerator.vala,
+         gobject/valaccodegeneratorinterface.vala: support GType
+         properties, patch by Ali Sabil
+
 2008-02-09  Jürg Billeter  <j@bitron.ch>
 
        * vapi/glib-2.0.vapi: remove static modifier from GSourceFunc
index 8b3e50074b8533f85ff57f9d56747e30df223493..cdd643a4b0d7134f401e256a8829515c3d459f12 100644 (file)
@@ -93,6 +93,7 @@ public class Vala.CCodeGenerator : CodeGenerator {
        public DataType string_type;
        public DataType float_type;
        public DataType double_type;
+       public Typesymbol gtype_type;
        public Typesymbol gtypeinstance_type;
        public Typesymbol gobject_type;
        public Typesymbol gerror_type;
@@ -216,7 +217,8 @@ public class Vala.CCodeGenerator : CodeGenerator {
                substring_method = (Method) string_type.data_type.scope.lookup ("substring");
 
                var glib_ns = root_symbol.scope.lookup ("GLib");
-               
+
+               gtype_type = (Typesymbol) glib_ns.scope.lookup ("Type");
                gtypeinstance_type = (Typesymbol) glib_ns.scope.lookup ("TypeInstance");
                gobject_type = (Typesymbol) glib_ns.scope.lookup ("Object");
                gerror_type = (Typesymbol) glib_ns.scope.lookup ("Error");
index c8d2103ff8055a4f8db945c1b82b6e5e5da75b21..ec6027e504127ba42b905cdc7fb65d76b6de2dd8 100644 (file)
@@ -166,6 +166,13 @@ public class Vala.CCodeGenerator {
                        } else {
                                cspec.add_argument (new CCodeConstant ("0.0"));
                        }
+               } else if (prop.type_reference.data_type == gtype_type) {
+                       cspec.call = new CCodeIdentifier ("g_param_spec_gtype");
+                       if (prop.default_expression != null) {
+                               cspec.add_argument ((CCodeExpression) prop.default_expression.ccodenode);
+                       } else {
+                               cspec.add_argument (new CCodeConstant ("G_TYPE_NONE"));
+                       }
                } else {
                        cspec.call = new CCodeIdentifier ("g_param_spec_pointer");
                }