The Vala Tutorial has an example about DBus using anonymous methods.
Bus.own_name (BusType.SESSION, "org.example.DemoService", /* name to register */
BusNameOwnerFlags.NONE, /* flags */
on_bus_aquired, /* callback function on registration succeeded */
() => {}, /* callback on name register succeeded */
() => stderr.printf ("Could not acquire name\n")); /* callback on name lost */
I am trying to rewrite this code in Genie, but could not manage to convert the two last lines. The Genie Tutorial only has an example on how to use a closure to define an event handler.
f.my_event += def (t, a)
print "event was detected with value %d", a
How do I use anonymous method definitions in a method call with Genie?