GNOME Bugzilla – Bug 746708
Source type only recognized in lambda using deprecated signal handler, not using connect
Last modified: 2018-05-22 15:22:27 UTC
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 += (source) => { stderr.printf("sourcetype: %s\n", source.get_type().name()); // prints GtkButton source.label = "bar"; // compiles ok }; 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; }
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/vala/issues/494.