]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
D-Bus: Fix use of dbus-glib interfaces in multiple source files
authorJürg Billeter <j@bitron.ch>
Tue, 18 Jan 2011 17:57:28 +0000 (18:57 +0100)
committerJürg Billeter <j@bitron.ch>
Tue, 18 Jan 2011 17:57:28 +0000 (18:57 +0100)
codegen/valaccodestructmodule.vala
codegen/valagtypemodule.vala
codegen/valatyperegisterfunction.vala

index 555ef077eb3ba90ef30e8763898718acba28c8db..0eb0dde1dd701bda9720cb7cb6adc90b17403514 100644 (file)
@@ -53,7 +53,7 @@ public abstract class Vala.CCodeStructModule : CCodeBaseModule {
                                decl_space.add_type_declaration (new CCodeMacroReplacement (st.get_type_id (), macro));
 
                                var type_fun = new StructRegisterFunction (st, context);
-                               type_fun.init_from_type (false);
+                               type_fun.init_from_type (false, true);
                                decl_space.add_type_member_declaration (type_fun.get_declaration ());
                        }
                }
index 10954423789e368c7d74c14d3cb4c0aad09ec814..3c1082d8d0b5cb288f79c3f862ef80651ffbb2f8 100644 (file)
@@ -172,7 +172,7 @@ public class Vala.GTypeModule : GErrorModule {
                        decl_space.add_type_declaration (new CCodeTypeDefinition ("struct _%sClass".printf (cl.get_cname ()), new CCodeVariableDeclarator ("%sClass".printf (cl.get_cname ()))));
 
                        var type_fun = new ClassRegisterFunction (cl, context);
-                       type_fun.init_from_type (in_plugin);
+                       type_fun.init_from_type (in_plugin, true);
                        decl_space.add_type_member_declaration (type_fun.get_declaration ());
                }
        }
@@ -626,7 +626,7 @@ public class Vala.GTypeModule : GErrorModule {
                        }
 
                        var type_fun = new ClassRegisterFunction (cl, context);
-                       type_fun.init_from_type (in_plugin);
+                       type_fun.init_from_type (in_plugin, false);
                        cfile.add_type_member_declaration (type_fun.get_source_declaration ());
                        cfile.add_type_member_definition (type_fun.get_definition ());
 
@@ -1971,7 +1971,7 @@ public class Vala.GTypeModule : GErrorModule {
                decl_space.add_type_definition (type_struct);
 
                var type_fun = new InterfaceRegisterFunction (iface, context);
-               type_fun.init_from_type (in_plugin);
+               type_fun.init_from_type (in_plugin, true);
                decl_space.add_type_member_declaration (type_fun.get_declaration ());
        }
 
@@ -2001,7 +2001,7 @@ public class Vala.GTypeModule : GErrorModule {
                }
 
                var type_fun = new InterfaceRegisterFunction (iface, context);
-               type_fun.init_from_type (in_plugin);
+               type_fun.init_from_type (in_plugin, false);
                cfile.add_type_member_declaration (type_fun.get_source_declaration ());
                cfile.add_type_member_definition (type_fun.get_definition ());
 
@@ -2074,7 +2074,7 @@ public class Vala.GTypeModule : GErrorModule {
 
                if (st.has_type_id) {
                        var type_fun = new StructRegisterFunction (st, context);
-                       type_fun.init_from_type (false);
+                       type_fun.init_from_type (false, false);
                        cfile.add_type_member_definition (type_fun.get_definition ());
                }
        }
@@ -2084,7 +2084,7 @@ public class Vala.GTypeModule : GErrorModule {
 
                if (en.has_type_id) {
                        var type_fun = new EnumRegisterFunction (en, context);
-                       type_fun.init_from_type (false);
+                       type_fun.init_from_type (false, false);
                        cfile.add_type_member_definition (type_fun.get_definition ());
                }
        }
index be0f212b74135e2e44b328f0fd1bfa18c93da709..e3f38ad0f80b43e7651b76c9681a243cbf1f61f7 100644 (file)
@@ -35,7 +35,7 @@ public abstract class Vala.TypeRegisterFunction {
        /**
         * Constructs the C function from the specified type.
         */
-       public void init_from_type (bool plugin) {
+       public void init_from_type (bool plugin, bool declaration_only) {
                bool use_thread_safe = !plugin;
 
                bool fundamental = false;
@@ -222,7 +222,9 @@ public abstract class Vala.TypeRegisterFunction {
                        type_init.add_statement (new CCodeExpressionStatement (add_class_private_call));
                }
 
-               get_type_interface_init_statements (type_init, plugin);
+               if (!declaration_only) {
+                       get_type_interface_init_statements (type_init, plugin);
+               }
 
                if (!plugin) {
                        CCodeExpression condition; // the condition that guards the type initialisation