[vala] GType: Connect default signal handlers in interfaces



commit 22f4d905e9fb9a78e4f73d01de55350f8b9b7726
Author: Luca Bruno <lucabru src gnome org>
Date:   Mon May 16 16:08:41 2011 +0200

    GType: Connect default signal handlers in interfaces

 codegen/valagtypemodule.vala |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/codegen/valagtypemodule.vala b/codegen/valagtypemodule.vala
index e5eb298..73a1259 100644
--- a/codegen/valagtypemodule.vala
+++ b/codegen/valagtypemodule.vala
@@ -2004,6 +2004,17 @@ public class Vala.GTypeModule : GErrorModule {
 			}
 		}
 
+		var ciface = new CCodeIdentifier ("iface");
+
+		/* connect default signal handlers */
+		foreach (Signal sig in iface.get_signals ()) {
+			if (sig.default_handler == null) {
+				continue;
+			}
+			var cname = sig.default_handler.get_real_cname ();
+			ccode.add_assignment (new CCodeMemberAccess.pointer (ciface, sig.default_handler.vfunc_name), new CCodeIdentifier (cname));
+		}
+
 		/* create signals */
 		foreach (Signal sig in iface.get_signals ()) {
 			if (sig.comment != null) {
@@ -2015,7 +2026,6 @@ public class Vala.GTypeModule : GErrorModule {
 		// connect default implementations
 		foreach (Method m in iface.get_methods ()) {
 			if (m.is_virtual) {
-				var ciface = new CCodeIdentifier ("iface");
 				var cname = m.get_real_cname ();
 				ccode.add_assignment (new CCodeMemberAccess.pointer (ciface, m.vfunc_name), new CCodeIdentifier (cname));
 			}



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