For signals without parameters use the generic SignalHandler instead of defining a lot of empty types

This commit is contained in:
Sebastian Dröge 2009-06-09 10:27:49 +02:00
parent 0d98c86ad6
commit cd3bf3502c

View file

@ -334,6 +334,7 @@ public class ElementGen {
foreach (SignalInfo si in ei.signals) {
string managed_name = (si.managed_name != null) ? si.managed_name : PropToCamelCase (si.name);
if (si.parameters.Count > 0) {
writer.WriteLine ("\t\tpublic delegate void " + managed_name + "Handler (object o, " + managed_name + "Args args);\n");
writer.WriteLine ("\t\tpublic class " + managed_name + "Args : GLib.SignalArgs {");
@ -345,11 +346,14 @@ public class ElementGen {
writer.WriteLine ("\t\t\t\t\treturn (" + managed_type + ") Args[" + i + "];");
writer.WriteLine ("\t\t\t\t}");
writer.WriteLine ("\t\t\t}\n");
}
writer.WriteLine ("\t\t}\n");
writer.WriteLine ("\t\tpublic event " + managed_name + "Handler " + managed_name + " {");
} else {
writer.WriteLine ("\t\tpublic event SignalHandler " + managed_name + " {");
}
writer.WriteLine ("\t\t\tadd {");
writer.WriteLine ("\t\t\t\tDynamicSignal.Connect (this, \"" + si.name + "\", value);");
writer.WriteLine ("\t\t\t}\n");