public override CCodeFunctionCall get_signal_creation (Signal sig, TypeSymbol type) {
var csignew = new CCodeFunctionCall (new CCodeIdentifier ("g_signal_new"));
- var cl = sig.parent_symbol as Class;
csignew.add_argument (new CCodeConstant ("\"%s\"".printf (sig.get_cname ())));
csignew.add_argument (new CCodeIdentifier (type.get_type_id ()));
string[] flags = new string[0];
csignew.add_argument (new CCodeConstant ("0"));
} else {
var struct_offset = new CCodeFunctionCall (new CCodeIdentifier ("G_STRUCT_OFFSET"));
- struct_offset.add_argument (new CCodeIdentifier ("%sClass".printf (cl.get_cname ())));
+ if (type is Class) {
+ struct_offset.add_argument (new CCodeIdentifier ("%sClass".printf (type.get_cname ())));
+ } else {
+ // interface
+ struct_offset.add_argument (new CCodeIdentifier (((Interface) type).get_type_cname ()));
+ }
struct_offset.add_argument (new CCodeIdentifier (sig.default_handler.vfunc_name));
csignew.add_argument (struct_offset);
}
generate_virtual_method_declaration (m, decl_space, type_struct);
}
+ foreach (Signal sig in iface.get_signals ()) {
+ if (sig.default_handler != null) {
+ generate_virtual_method_declaration (sig.default_handler, decl_space, type_struct);
+ }
+ }
+
foreach (Property prop in iface.get_properties ()) {
if (!prop.is_abstract && !prop.is_virtual) {
continue;
--- /dev/null
+interface Foo : Object {
+ public virtual signal void virtual_signal () { }
+}
+
+class Bar : Object, Foo {
+}
+
+void main () {
+ var bar = new Bar ();
+ bar.virtual_signal ();
+}