After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 746708 - Source type only recognized in lambda using deprecated signal handler, not using connect
Source type only recognized in lambda using deprecated signal handler, not us...
Status: RESOLVED OBSOLETE
Product: vala
Classification: Core
Component: Semantic Analyzer
unspecified
Other All
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2015-03-24 21:30 UTC by nieka
Modified: 2018-05-22 15:22 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description nieka 2015-03-24 21:30:12 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;
}
Comment 1 GNOME Infrastructure Team 2018-05-22 15:22:27 UTC
-- 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.