How to connect() an anonymous handler to an event in Genie?

32 views Asked by At

Guides and samples seem to tell you to use the += operator to add handlers to GObject events. E.g. "A brief guide" and Gtk tutorials.

f.my_event += def (t, a)
    print "event was detected with value %d", a

The compiler complains about this:

$ valac events.gs
events.gs:8.5-12.5: warning: deprecated syntax, use `connect' method instead
Compilation succeeded - 1 warning(s)

If += is deprecated, is there a way to do this with connect inline without creating a named method and using connect with that? Was this ever intended to work or is the warning just a style tip in the wrong place?

Google does turn up a few mailing list postings with no apparent answers.

0

There are 0 answers