]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Move parameter handling to GObjectClassModule and signal handling to
authorJürg Billeter <j@bitron.ch>
Mon, 3 Nov 2008 07:38:39 +0000 (07:38 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Mon, 3 Nov 2008 07:38:39 +0000 (07:38 +0000)
2008-11-03  Jürg Billeter  <j@bitron.ch>

* gobject/Makefile.am:
* gobject/valaccodegenerator.vala:
* gobject/valagobjectclassmodule.vala:
* gobject/valagobjectmodule.vala:
* gobject/valagobjectsignalmodule.vala:

Move parameter handling to GObjectClassModule and signal handling
to GObjectSignalModule

svn path=/trunk/; revision=1959

ChangeLog
gobject/Makefile.am
gobject/valaccodegenerator.vala
gobject/valagobjectclassmodule.vala
gobject/valagobjectmodule.vala [deleted file]
gobject/valagobjectsignalmodule.vala

index 32a847f5ab6774daadcfe7ec0e964da2c3b5e930..068944d1fc9794e820e45ee30a9902fdbe48f548 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2008-11-03  Jürg Billeter  <j@bitron.ch>
+
+       * gobject/Makefile.am:
+       * gobject/valaccodegenerator.vala:
+       * gobject/valagobjectclassmodule.vala:
+       * gobject/valagobjectmodule.vala:
+       * gobject/valagobjectsignalmodule.vala:
+
+       Move parameter handling to GObjectClassModule and signal handling
+       to GObjectSignalModule
+
 2008-11-03  Jürg Billeter  <j@bitron.ch>
 
        * gobject/Makefile.am:
index 6d46c95ddb6c60f7b158aa84e408e00f003a8cd5..1ad78571c77713ef0a53a9a4d5c4d705ddc552b2 100644 (file)
@@ -30,7 +30,6 @@ libvala_la_VALASOURCES = \
        valagirwriter.vala \
        valagobjectclassmodule.vala \
        valagobjectinterfacemodule.vala \
-       valagobjectmodule.vala \
        valagobjectsignalmodule.vala \
        valainterfaceregisterfunction.vala \
        valatyperegisterfunction.vala \
index e8802ee1927db1db4d323e9daeb68f0ec684ff60..32bb3992232b450c27fa3f6ff7ad3de5eff32165 100644 (file)
@@ -152,7 +152,6 @@ public class Vala.CCodeGenerator : CodeGenerator {
                head = new CCodeArrayModule (this, head);
                head = new CCodeDynamicPropertyModule (this, head);
                head = new CCodeDynamicSignalModule (this, head);
-               head = new GObjectModule (this, head);
                head = new GObjectClassModule (this, head);
                head = new GObjectInterfaceModule (this, head);
                head = new GObjectSignalModule (this, head);
index 235e2d759b3291647a5b052477cf9f68f0974f90..c8dc91d562b23087e4b26eceaeb37d5d3aa45edd 100644 (file)
@@ -1278,6 +1278,180 @@ public class Vala.GObjectClassModule : CCodeModule {
                return new CCodeExpressionStatement (cwarn);
        }
 
+       public override CCodeFunctionCall get_param_spec (Property prop) {
+               var cspec = new CCodeFunctionCall ();
+               cspec.add_argument (prop.get_canonical_cconstant ());
+               cspec.add_argument (new CCodeConstant ("\"%s\"".printf (prop.nick)));
+               cspec.add_argument (new CCodeConstant ("\"%s\"".printf (prop.blurb)));
 
+
+               if ((prop.property_type.data_type is Class && !(((Class) prop.property_type.data_type).is_compact)) || prop.property_type.data_type is Interface) {
+                       string param_spec_name = prop.property_type.data_type.get_param_spec_function ();
+                       if (param_spec_name == null) {
+                               cspec.call = new CCodeIdentifier ("g_param_spec_pointer");
+                       } else {
+                               cspec.call = new CCodeIdentifier ( param_spec_name );
+                               cspec.add_argument (new CCodeIdentifier (prop.property_type.data_type.get_type_id ()));
+                       }
+               } else if (prop.property_type.data_type == codegen.string_type.data_type) {
+                       cspec.call = new CCodeIdentifier ("g_param_spec_string");
+                       cspec.add_argument (new CCodeConstant ("NULL"));
+               } else if (prop.property_type.data_type is Enum) {
+                       var e = prop.property_type.data_type as Enum;
+                       if (e.has_type_id) {
+                               if (e.is_flags) {
+                                       cspec.call = new CCodeIdentifier ("g_param_spec_flags");
+                               } else {
+                                       cspec.call = new CCodeIdentifier ("g_param_spec_enum");
+                               }
+                               cspec.add_argument (new CCodeIdentifier (e.get_type_id ()));
+                       } else {
+                               if (e.is_flags) {
+                                       cspec.call = new CCodeIdentifier ("g_param_spec_uint");
+                                       cspec.add_argument (new CCodeConstant ("0"));
+                                       cspec.add_argument (new CCodeConstant ("G_MAXUINT"));
+                               } else {
+                                       cspec.call = new CCodeIdentifier ("g_param_spec_int");
+                                       cspec.add_argument (new CCodeConstant ("G_MININT"));
+                                       cspec.add_argument (new CCodeConstant ("G_MAXINT"));
+                               }
+                       }
+
+                       if (prop.default_expression != null) {
+                               cspec.add_argument ((CCodeExpression) prop.default_expression.ccodenode);
+                       } else {
+                               cspec.add_argument (new CCodeConstant (prop.property_type.data_type.get_default_value ()));
+                       }
+               } else if (prop.property_type.data_type is Struct) {
+                       var st = (Struct) prop.property_type.data_type;
+                       if (st.get_type_id () == "G_TYPE_INT") {
+                               cspec.call = new CCodeIdentifier ("g_param_spec_int");
+                               cspec.add_argument (new CCodeConstant ("G_MININT"));
+                               cspec.add_argument (new CCodeConstant ("G_MAXINT"));
+                               if (prop.default_expression != null) {
+                                       cspec.add_argument ((CCodeExpression) prop.default_expression.ccodenode);
+                               } else {
+                                       cspec.add_argument (new CCodeConstant ("0"));
+                               }
+                       } else if (st.get_type_id () == "G_TYPE_UINT") {
+                               cspec.call = new CCodeIdentifier ("g_param_spec_uint");
+                               cspec.add_argument (new CCodeConstant ("0"));
+                               cspec.add_argument (new CCodeConstant ("G_MAXUINT"));
+                               if (prop.default_expression != null) {
+                                       cspec.add_argument ((CCodeExpression) prop.default_expression.ccodenode);
+                               } else {
+                                       cspec.add_argument (new CCodeConstant ("0U"));
+                               }
+                       } else if (st.get_type_id () == "G_TYPE_INT64") {
+                               cspec.call = new CCodeIdentifier ("g_param_spec_int64");
+                               cspec.add_argument (new CCodeConstant ("G_MININT64"));
+                               cspec.add_argument (new CCodeConstant ("G_MAXINT64"));
+                               if (prop.default_expression != null) {
+                                       cspec.add_argument ((CCodeExpression) prop.default_expression.ccodenode);
+                               } else {
+                                       cspec.add_argument (new CCodeConstant ("0"));
+                               }
+                       } else if (st.get_type_id () == "G_TYPE_UINT64") {
+                               cspec.call = new CCodeIdentifier ("g_param_spec_uint64");
+                               cspec.add_argument (new CCodeConstant ("0"));
+                               cspec.add_argument (new CCodeConstant ("G_MAXUINT64"));
+                               if (prop.default_expression != null) {
+                                       cspec.add_argument ((CCodeExpression) prop.default_expression.ccodenode);
+                               } else {
+                                       cspec.add_argument (new CCodeConstant ("0U"));
+                               }
+                       } else if (st.get_type_id () == "G_TYPE_LONG") {
+                               cspec.call = new CCodeIdentifier ("g_param_spec_long");
+                               cspec.add_argument (new CCodeConstant ("G_MINLONG"));
+                               cspec.add_argument (new CCodeConstant ("G_MAXLONG"));
+                               if (prop.default_expression != null) {
+                                       cspec.add_argument ((CCodeExpression) prop.default_expression.ccodenode);
+                               } else {
+                                       cspec.add_argument (new CCodeConstant ("0L"));
+                               }
+                       } else if (st.get_type_id () == "G_TYPE_ULONG") {
+                               cspec.call = new CCodeIdentifier ("g_param_spec_ulong");
+                               cspec.add_argument (new CCodeConstant ("0"));
+                               cspec.add_argument (new CCodeConstant ("G_MAXULONG"));
+                               if (prop.default_expression != null) {
+                                       cspec.add_argument ((CCodeExpression) prop.default_expression.ccodenode);
+                               } else {
+                                       cspec.add_argument (new CCodeConstant ("0UL"));
+                               }
+                       } else if (st.get_type_id () == "G_TYPE_BOOLEAN") {
+                               cspec.call = new CCodeIdentifier ("g_param_spec_boolean");
+                               if (prop.default_expression != null) {
+                                       cspec.add_argument ((CCodeExpression) prop.default_expression.ccodenode);
+                               } else {
+                                       cspec.add_argument (new CCodeConstant ("FALSE"));
+                               }
+                       } else if (st.get_type_id () == "G_TYPE_CHAR") {
+                               cspec.call = new CCodeIdentifier ("g_param_spec_char");
+                               cspec.add_argument (new CCodeConstant ("G_MININT8"));
+                               cspec.add_argument (new CCodeConstant ("G_MAXINT8"));
+                               if (prop.default_expression != null) {
+                                       cspec.add_argument ((CCodeExpression) prop.default_expression.ccodenode);
+                               } else {
+                                       cspec.add_argument (new CCodeConstant ("0"));
+                               }
+                       } else if (st.get_type_id () == "G_TYPE_UCHAR") {
+                               cspec.call = new CCodeIdentifier ("g_param_spec_uchar");
+                               cspec.add_argument (new CCodeConstant ("0"));
+                               cspec.add_argument (new CCodeConstant ("G_MAXUINT8"));
+                               if (prop.default_expression != null) {
+                                       cspec.add_argument ((CCodeExpression) prop.default_expression.ccodenode);
+                               } else {
+                                       cspec.add_argument (new CCodeConstant ("0"));
+                               }
+                       }else if (st.get_type_id () == "G_TYPE_FLOAT") {
+                               cspec.call = new CCodeIdentifier ("g_param_spec_float");
+                               cspec.add_argument (new CCodeConstant ("-G_MAXFLOAT"));
+                               cspec.add_argument (new CCodeConstant ("G_MAXFLOAT"));
+                               if (prop.default_expression != null) {
+                                       cspec.add_argument ((CCodeExpression) prop.default_expression.ccodenode);
+                               } else {
+                                       cspec.add_argument (new CCodeConstant ("0.0F"));
+                               }
+                       } else if (st.get_type_id () == "G_TYPE_DOUBLE") {
+                               cspec.call = new CCodeIdentifier ("g_param_spec_double");
+                               cspec.add_argument (new CCodeConstant ("-G_MAXDOUBLE"));
+                               cspec.add_argument (new CCodeConstant ("G_MAXDOUBLE"));
+                               if (prop.default_expression != null) {
+                                       cspec.add_argument ((CCodeExpression) prop.default_expression.ccodenode);
+                               } else {
+                                       cspec.add_argument (new CCodeConstant ("0.0"));
+                               }
+                       } else if (st.get_type_id () == "G_TYPE_GTYPE") {
+                               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");
+                       }
+               } else {
+                       cspec.call = new CCodeIdentifier ("g_param_spec_pointer");
+               }
+               
+               var pflags = "G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB";
+               if (prop.get_accessor != null) {
+                       pflags = "%s%s".printf (pflags, " | G_PARAM_READABLE");
+               }
+               if (prop.set_accessor != null) {
+                       pflags = "%s%s".printf (pflags, " | G_PARAM_WRITABLE");
+                       if (prop.set_accessor.construction) {
+                               if (prop.set_accessor.writable) {
+                                       pflags = "%s%s".printf (pflags, " | G_PARAM_CONSTRUCT");
+                               } else {
+                                       pflags = "%s%s".printf (pflags, " | G_PARAM_CONSTRUCT_ONLY");
+                               }
+                       }
+               }
+               cspec.add_argument (new CCodeConstant (pflags));
+
+               return cspec;
+       }
 }
 
diff --git a/gobject/valagobjectmodule.vala b/gobject/valagobjectmodule.vala
deleted file mode 100644 (file)
index ec03e4f..0000000
+++ /dev/null
@@ -1,262 +0,0 @@
-/* valagobjectmodule.vala
- *
- * Copyright (C) 2008  Jürg Billeter
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
-
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
- *
- * Author:
- *     Jürg Billeter <j@bitron.ch>
- *     Raffaele Sandrini <raffaele@sandrini.ch>
- */
-
-using GLib;
-
-public class Vala.GObjectModule : CCodeModule {
-       public GObjectModule (CCodeGenerator codegen, CCodeModule? next) {
-               base (codegen, next);
-       }
-
-       public override CCodeFunctionCall get_param_spec (Property prop) {
-               var cspec = new CCodeFunctionCall ();
-               cspec.add_argument (prop.get_canonical_cconstant ());
-               cspec.add_argument (new CCodeConstant ("\"%s\"".printf (prop.nick)));
-               cspec.add_argument (new CCodeConstant ("\"%s\"".printf (prop.blurb)));
-
-
-               if ((prop.property_type.data_type is Class && !(((Class) prop.property_type.data_type).is_compact)) || prop.property_type.data_type is Interface) {
-                       string param_spec_name = prop.property_type.data_type.get_param_spec_function ();
-                       if (param_spec_name == null) {
-                               cspec.call = new CCodeIdentifier ("g_param_spec_pointer");
-                       } else {
-                               cspec.call = new CCodeIdentifier ( param_spec_name );
-                               cspec.add_argument (new CCodeIdentifier (prop.property_type.data_type.get_type_id ()));
-                       }
-               } else if (prop.property_type.data_type == codegen.string_type.data_type) {
-                       cspec.call = new CCodeIdentifier ("g_param_spec_string");
-                       cspec.add_argument (new CCodeConstant ("NULL"));
-               } else if (prop.property_type.data_type is Enum) {
-                       var e = prop.property_type.data_type as Enum;
-                       if (e.has_type_id) {
-                               if (e.is_flags) {
-                                       cspec.call = new CCodeIdentifier ("g_param_spec_flags");
-                               } else {
-                                       cspec.call = new CCodeIdentifier ("g_param_spec_enum");
-                               }
-                               cspec.add_argument (new CCodeIdentifier (e.get_type_id ()));
-                       } else {
-                               if (e.is_flags) {
-                                       cspec.call = new CCodeIdentifier ("g_param_spec_uint");
-                                       cspec.add_argument (new CCodeConstant ("0"));
-                                       cspec.add_argument (new CCodeConstant ("G_MAXUINT"));
-                               } else {
-                                       cspec.call = new CCodeIdentifier ("g_param_spec_int");
-                                       cspec.add_argument (new CCodeConstant ("G_MININT"));
-                                       cspec.add_argument (new CCodeConstant ("G_MAXINT"));
-                               }
-                       }
-
-                       if (prop.default_expression != null) {
-                               cspec.add_argument ((CCodeExpression) prop.default_expression.ccodenode);
-                       } else {
-                               cspec.add_argument (new CCodeConstant (prop.property_type.data_type.get_default_value ()));
-                       }
-               } else if (prop.property_type.data_type is Struct) {
-                       var st = (Struct) prop.property_type.data_type;
-                       if (st.get_type_id () == "G_TYPE_INT") {
-                               cspec.call = new CCodeIdentifier ("g_param_spec_int");
-                               cspec.add_argument (new CCodeConstant ("G_MININT"));
-                               cspec.add_argument (new CCodeConstant ("G_MAXINT"));
-                               if (prop.default_expression != null) {
-                                       cspec.add_argument ((CCodeExpression) prop.default_expression.ccodenode);
-                               } else {
-                                       cspec.add_argument (new CCodeConstant ("0"));
-                               }
-                       } else if (st.get_type_id () == "G_TYPE_UINT") {
-                               cspec.call = new CCodeIdentifier ("g_param_spec_uint");
-                               cspec.add_argument (new CCodeConstant ("0"));
-                               cspec.add_argument (new CCodeConstant ("G_MAXUINT"));
-                               if (prop.default_expression != null) {
-                                       cspec.add_argument ((CCodeExpression) prop.default_expression.ccodenode);
-                               } else {
-                                       cspec.add_argument (new CCodeConstant ("0U"));
-                               }
-                       } else if (st.get_type_id () == "G_TYPE_INT64") {
-                               cspec.call = new CCodeIdentifier ("g_param_spec_int64");
-                               cspec.add_argument (new CCodeConstant ("G_MININT64"));
-                               cspec.add_argument (new CCodeConstant ("G_MAXINT64"));
-                               if (prop.default_expression != null) {
-                                       cspec.add_argument ((CCodeExpression) prop.default_expression.ccodenode);
-                               } else {
-                                       cspec.add_argument (new CCodeConstant ("0"));
-                               }
-                       } else if (st.get_type_id () == "G_TYPE_UINT64") {
-                               cspec.call = new CCodeIdentifier ("g_param_spec_uint64");
-                               cspec.add_argument (new CCodeConstant ("0"));
-                               cspec.add_argument (new CCodeConstant ("G_MAXUINT64"));
-                               if (prop.default_expression != null) {
-                                       cspec.add_argument ((CCodeExpression) prop.default_expression.ccodenode);
-                               } else {
-                                       cspec.add_argument (new CCodeConstant ("0U"));
-                               }
-                       } else if (st.get_type_id () == "G_TYPE_LONG") {
-                               cspec.call = new CCodeIdentifier ("g_param_spec_long");
-                               cspec.add_argument (new CCodeConstant ("G_MINLONG"));
-                               cspec.add_argument (new CCodeConstant ("G_MAXLONG"));
-                               if (prop.default_expression != null) {
-                                       cspec.add_argument ((CCodeExpression) prop.default_expression.ccodenode);
-                               } else {
-                                       cspec.add_argument (new CCodeConstant ("0L"));
-                               }
-                       } else if (st.get_type_id () == "G_TYPE_ULONG") {
-                               cspec.call = new CCodeIdentifier ("g_param_spec_ulong");
-                               cspec.add_argument (new CCodeConstant ("0"));
-                               cspec.add_argument (new CCodeConstant ("G_MAXULONG"));
-                               if (prop.default_expression != null) {
-                                       cspec.add_argument ((CCodeExpression) prop.default_expression.ccodenode);
-                               } else {
-                                       cspec.add_argument (new CCodeConstant ("0UL"));
-                               }
-                       } else if (st.get_type_id () == "G_TYPE_BOOLEAN") {
-                               cspec.call = new CCodeIdentifier ("g_param_spec_boolean");
-                               if (prop.default_expression != null) {
-                                       cspec.add_argument ((CCodeExpression) prop.default_expression.ccodenode);
-                               } else {
-                                       cspec.add_argument (new CCodeConstant ("FALSE"));
-                               }
-                       } else if (st.get_type_id () == "G_TYPE_CHAR") {
-                               cspec.call = new CCodeIdentifier ("g_param_spec_char");
-                               cspec.add_argument (new CCodeConstant ("G_MININT8"));
-                               cspec.add_argument (new CCodeConstant ("G_MAXINT8"));
-                               if (prop.default_expression != null) {
-                                       cspec.add_argument ((CCodeExpression) prop.default_expression.ccodenode);
-                               } else {
-                                       cspec.add_argument (new CCodeConstant ("0"));
-                               }
-                       } else if (st.get_type_id () == "G_TYPE_UCHAR") {
-                               cspec.call = new CCodeIdentifier ("g_param_spec_uchar");
-                               cspec.add_argument (new CCodeConstant ("0"));
-                               cspec.add_argument (new CCodeConstant ("G_MAXUINT8"));
-                               if (prop.default_expression != null) {
-                                       cspec.add_argument ((CCodeExpression) prop.default_expression.ccodenode);
-                               } else {
-                                       cspec.add_argument (new CCodeConstant ("0"));
-                               }
-                       }else if (st.get_type_id () == "G_TYPE_FLOAT") {
-                               cspec.call = new CCodeIdentifier ("g_param_spec_float");
-                               cspec.add_argument (new CCodeConstant ("-G_MAXFLOAT"));
-                               cspec.add_argument (new CCodeConstant ("G_MAXFLOAT"));
-                               if (prop.default_expression != null) {
-                                       cspec.add_argument ((CCodeExpression) prop.default_expression.ccodenode);
-                               } else {
-                                       cspec.add_argument (new CCodeConstant ("0.0F"));
-                               }
-                       } else if (st.get_type_id () == "G_TYPE_DOUBLE") {
-                               cspec.call = new CCodeIdentifier ("g_param_spec_double");
-                               cspec.add_argument (new CCodeConstant ("-G_MAXDOUBLE"));
-                               cspec.add_argument (new CCodeConstant ("G_MAXDOUBLE"));
-                               if (prop.default_expression != null) {
-                                       cspec.add_argument ((CCodeExpression) prop.default_expression.ccodenode);
-                               } else {
-                                       cspec.add_argument (new CCodeConstant ("0.0"));
-                               }
-                       } else if (st.get_type_id () == "G_TYPE_GTYPE") {
-                               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");
-                       }
-               } else {
-                       cspec.call = new CCodeIdentifier ("g_param_spec_pointer");
-               }
-               
-               var pflags = "G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB";
-               if (prop.get_accessor != null) {
-                       pflags = "%s%s".printf (pflags, " | G_PARAM_READABLE");
-               }
-               if (prop.set_accessor != null) {
-                       pflags = "%s%s".printf (pflags, " | G_PARAM_WRITABLE");
-                       if (prop.set_accessor.construction) {
-                               if (prop.set_accessor.writable) {
-                                       pflags = "%s%s".printf (pflags, " | G_PARAM_CONSTRUCT");
-                               } else {
-                                       pflags = "%s%s".printf (pflags, " | G_PARAM_CONSTRUCT_ONLY");
-                               }
-                       }
-               }
-               cspec.add_argument (new CCodeConstant (pflags));
-
-               return cspec;
-       }
-
-       public override CCodeFunctionCall get_signal_creation (Signal sig, TypeSymbol type) {   
-               var csignew = new CCodeFunctionCall (new CCodeIdentifier ("g_signal_new"));
-               csignew.add_argument (new CCodeConstant ("\"%s\"".printf (sig.get_cname ())));
-               csignew.add_argument (new CCodeIdentifier (type.get_type_id ()));
-               csignew.add_argument (new CCodeConstant ("G_SIGNAL_RUN_LAST"));
-               csignew.add_argument (new CCodeConstant ("0"));
-               csignew.add_argument (new CCodeConstant ("NULL"));
-               csignew.add_argument (new CCodeConstant ("NULL"));
-
-               string marshaller = head.get_marshaller_function (sig.get_parameters (), sig.return_type);
-
-               var marshal_arg = new CCodeIdentifier (marshaller);
-               csignew.add_argument (marshal_arg);
-
-               var params = sig.get_parameters ();
-               if (sig.return_type is PointerType || sig.return_type.type_parameter != null) {
-                       csignew.add_argument (new CCodeConstant ("G_TYPE_POINTER"));
-               } else if (sig.return_type is ErrorType) {
-                       csignew.add_argument (new CCodeConstant ("G_TYPE_POINTER"));
-               } else if (sig.return_type.data_type == null) {
-                       csignew.add_argument (new CCodeConstant ("G_TYPE_NONE"));
-               } else {
-                       csignew.add_argument (new CCodeConstant (sig.return_type.data_type.get_type_id ()));
-               }
-
-               int params_len = 0;
-               foreach (FormalParameter param in params) {
-                       params_len++;
-                       if (param.parameter_type.is_array ()) {
-                               params_len++;
-                       }
-               }
-
-               csignew.add_argument (new CCodeConstant ("%d".printf (params_len)));
-               foreach (FormalParameter param in params) {
-                       if (param.parameter_type.is_array ()) {
-                               if (((ArrayType) param.parameter_type).element_type.data_type == codegen.string_type.data_type) {
-                                       csignew.add_argument (new CCodeConstant ("G_TYPE_STRV"));
-                               } else {
-                                       csignew.add_argument (new CCodeConstant ("G_TYPE_POINTER"));
-                               }
-                               csignew.add_argument (new CCodeConstant ("G_TYPE_INT"));
-                       } else if (param.parameter_type is PointerType || param.parameter_type.type_parameter != null || param.direction != ParameterDirection.IN) {
-                               csignew.add_argument (new CCodeConstant ("G_TYPE_POINTER"));
-                       } else if (param.parameter_type is ErrorType) {
-                               csignew.add_argument (new CCodeConstant ("G_TYPE_POINTER"));
-                       } else {
-                               csignew.add_argument (new CCodeConstant (param.parameter_type.data_type.get_type_id ()));
-                       }
-               }
-
-               marshal_arg.name = marshaller;
-
-               return csignew;
-       }
-}
index a39c69be8b7ea81e434b0ca8da29d97c0f0fd56b..a594ff69806700af4330f591c546e1305394e84c 100644 (file)
@@ -322,5 +322,61 @@ public class Vala.GObjectSignalModule : CCodeModule {
                codegen.source_signal_marshaller_definition.append (signal_marshaller);
                codegen.user_marshal_set.add (signature);
        }
+
+       public override CCodeFunctionCall get_signal_creation (Signal sig, TypeSymbol type) {   
+               var csignew = new CCodeFunctionCall (new CCodeIdentifier ("g_signal_new"));
+               csignew.add_argument (new CCodeConstant ("\"%s\"".printf (sig.get_cname ())));
+               csignew.add_argument (new CCodeIdentifier (type.get_type_id ()));
+               csignew.add_argument (new CCodeConstant ("G_SIGNAL_RUN_LAST"));
+               csignew.add_argument (new CCodeConstant ("0"));
+               csignew.add_argument (new CCodeConstant ("NULL"));
+               csignew.add_argument (new CCodeConstant ("NULL"));
+
+               string marshaller = head.get_marshaller_function (sig.get_parameters (), sig.return_type);
+
+               var marshal_arg = new CCodeIdentifier (marshaller);
+               csignew.add_argument (marshal_arg);
+
+               var params = sig.get_parameters ();
+               if (sig.return_type is PointerType || sig.return_type.type_parameter != null) {
+                       csignew.add_argument (new CCodeConstant ("G_TYPE_POINTER"));
+               } else if (sig.return_type is ErrorType) {
+                       csignew.add_argument (new CCodeConstant ("G_TYPE_POINTER"));
+               } else if (sig.return_type.data_type == null) {
+                       csignew.add_argument (new CCodeConstant ("G_TYPE_NONE"));
+               } else {
+                       csignew.add_argument (new CCodeConstant (sig.return_type.data_type.get_type_id ()));
+               }
+
+               int params_len = 0;
+               foreach (FormalParameter param in params) {
+                       params_len++;
+                       if (param.parameter_type.is_array ()) {
+                               params_len++;
+                       }
+               }
+
+               csignew.add_argument (new CCodeConstant ("%d".printf (params_len)));
+               foreach (FormalParameter param in params) {
+                       if (param.parameter_type.is_array ()) {
+                               if (((ArrayType) param.parameter_type).element_type.data_type == codegen.string_type.data_type) {
+                                       csignew.add_argument (new CCodeConstant ("G_TYPE_STRV"));
+                               } else {
+                                       csignew.add_argument (new CCodeConstant ("G_TYPE_POINTER"));
+                               }
+                               csignew.add_argument (new CCodeConstant ("G_TYPE_INT"));
+                       } else if (param.parameter_type is PointerType || param.parameter_type.type_parameter != null || param.direction != ParameterDirection.IN) {
+                               csignew.add_argument (new CCodeConstant ("G_TYPE_POINTER"));
+                       } else if (param.parameter_type is ErrorType) {
+                               csignew.add_argument (new CCodeConstant ("G_TYPE_POINTER"));
+                       } else {
+                               csignew.add_argument (new CCodeConstant (param.parameter_type.data_type.get_type_id ()));
+                       }
+               }
+
+               marshal_arg.name = marshaller;
+
+               return csignew;
+       }
 }