]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Fix GTypeModule-based plugins
authorJürg Billeter <j@bitron.ch>
Wed, 8 Jul 2009 10:40:04 +0000 (11:40 +0100)
committerJürg Billeter <j@bitron.ch>
Wed, 8 Jul 2009 10:40:04 +0000 (11:40 +0100)
codegen/valagtypemodule.vala
codegen/valatyperegisterfunction.vala

index a38954cf884d6c6f666e87e680db15ce4663e1af..7ac0ed2d9bbcf9a7d38ea9ffa40027a2012a3265 100644 (file)
@@ -529,6 +529,7 @@ internal class Vala.GTypeModule : GErrorModule {
 
                        var type_fun = new ClassRegisterFunction (cl, context);
                        type_fun.init_from_type (in_plugin);
+                       source_declarations.add_type_member_declaration (type_fun.get_source_declaration ());
                        source_type_member_definition.append (type_fun.get_definition ());
                        
                        if (in_plugin) {
index 85dfcc01b03eff11c87e78162ccc8432076824aa..736883fabc4cb70dcf00a4624f7e0b03714a07ab 100644 (file)
@@ -1,6 +1,6 @@
 /* valatyperegisterfunction.vala
  *
- * Copyright (C) 2006-2008  Jürg Billeter
+ * Copyright (C) 2006-2009  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
@@ -26,9 +26,9 @@ using GLib;
  * C function to register a type at runtime.
  */
 public abstract class Vala.TypeRegisterFunction {
-       private CCodeFragment declaration_fragment = new CCodeFragment ();
-
-       private CCodeFragment definition_fragment = new CCodeFragment ();
+       CCodeFragment source_declaration_fragment = new CCodeFragment ();
+       CCodeFragment declaration_fragment = new CCodeFragment ();
+       CCodeFragment definition_fragment = new CCodeFragment ();
 
        public CodeContext context { get; set; }
 
@@ -62,7 +62,7 @@ public abstract class Vala.TypeRegisterFunction {
                if (!plugin) {
                        type_block.add_statement (cdecl);
                } else {
-                       definition_fragment.append (cdecl);
+                       source_declaration_fragment.append (cdecl);
                }
 
                CCodeFunction fun;
@@ -366,6 +366,10 @@ public abstract class Vala.TypeRegisterFunction {
         */
        public abstract CCodeFragment get_type_interface_init_statements ();
        
+       public CCodeFragment get_source_declaration () {
+               return source_declaration_fragment;
+       }
+
        /**
         * Returns the declaration for this type register function in C code.
         *