Re: [Vala] Signal connect syntax



On Wed, Apr 15, 2009 at 4:22 PM, pancake <pancake youterm com> wrote:
lambdas can be used with .connect() ?

Just place the full lamba expression in the brackets.

    var button = new Button.with_label ("Click me!");
    button.clicked += (source) => {
        source.label = "Thank you";
    };

becomes:

    var button = new Button.with_label ("Click me!");
    button.clicked.connect ((source) => {
      source.label = "Thank you";
    });

Gr,
Thijs

is there any disconnect_all() or so?

Jürg Billeter wrote:

The syntax for connecting and disconnecting signal handlers using += and
-= has been inherited from the C# syntax. As described in bug 566847
[1], using these operators does not seem appropriate for signals.
Therefore, the syntax has now been deprecated by

   foo.clicked.connect (handler);
   foo.clicked.disconnect (handler);

The old syntax still works and will continue to be supported for the
foreseeable future to not break existing code. A future compiler version
might print a warning when not using --enable-deprecated.

Jürg

[1] http://bugzilla.gnome.org/show_bug.cgi?id=566847

_______________________________________________
Vala-list mailing list
Vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list


_______________________________________________
Vala-list mailing list
Vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]