Support type narrowing of sender object on signal connect
Submitted by nie..@..dsv.nl
Link to original bug (#746708)
Description
Only the deprecated syntax allows for direct access to source members in the callback. Using the connect syntax only give access to the base members and gives a compile error:
error: The name `label' does not exist in the context of `Gtk.Widget'
source.label = "bar";
using Gtk;
int main (string[] args) {
Gtk.init (ref args);
var window = new Window ();
window.destroy.connect (Gtk.main_quit);
var button = new Button.with_label ("foo");
button.map.connect ((source) => {
stderr.printf("sourcetype: %s\n", source.get_type().name()); // prints GtkButton
source.label = "bar"; // compile error
});
window.add (button);
window.show_all ();
Gtk.main ();
return 0;
}
Edited by Rico Tzschichholz