[vala] D-Bus: Fix use of dbus-glib interfaces in multiple source files



commit 955a6b84b088602e0af354b461b84dd4cdccad24
Author: Jürg Billeter <j bitron ch>
Date:   Tue Jan 18 18:57:28 2011 +0100

    D-Bus: Fix use of dbus-glib interfaces in multiple source files

 codegen/valaccodestructmodule.vala    |    2 +-
 codegen/valagtypemodule.vala          |   12 ++++++------
 codegen/valatyperegisterfunction.vala |    6 ++++--
 3 files changed, 11 insertions(+), 9 deletions(-)
---
diff --git a/codegen/valaccodestructmodule.vala b/codegen/valaccodestructmodule.vala
index 555ef07..0eb0dde 100644
--- a/codegen/valaccodestructmodule.vala
+++ b/codegen/valaccodestructmodule.vala
@@ -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 ());
 			}
 		}
diff --git a/codegen/valagtypemodule.vala b/codegen/valagtypemodule.vala
index 1095442..3c1082d 100644
--- a/codegen/valagtypemodule.vala
+++ b/codegen/valagtypemodule.vala
@@ -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 ());
 		}
 	}
diff --git a/codegen/valatyperegisterfunction.vala b/codegen/valatyperegisterfunction.vala
index be0f212..e3f38ad 100644
--- a/codegen/valatyperegisterfunction.vala
+++ b/codegen/valatyperegisterfunction.vala
@@ -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



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]