Re: [Vala] Closure problem in Gtk.AccelGroup



On Fri, 2010-06-11 at 21:13 +0200, Luca Bruno wrote:
On Fri, Jun 11, 2010 at 11:21:14AM -0700, jezra lickter wrote:
Hello,
basing my work on the documentation found at
http://valadoc.org/gtk+-2.0/Gtk.AccelGroup.connect.html
I am trying to connect an acclegroup to a Closure
code:
AccelGroup accel = new AccelGroup();
accel.connect('q', Gdk.ModifierType.CONTROL_MASK,
    Gtk.AccelFlags.VISIBLE,
    ()=> { 
            stdout.printf("quit"); 
    } );

When I compile my application, I get the following error in regards to
the closure
"error: lambda expression not allowed in this context"

Can someone please tell me what I am doing wrong or point me to a
working example of using AccelGroup.connect()?

Good point. You can't. There's no binding for Closure/CClosure currently.

I'd suggest to add "new Closure.for_callback (owned CCallback callback);"
Defining a new CCallback like Callback but with has_target=true (apparently
inconsistent in glib). The ClosureNotify can be gracefully casted to
DestroyNotify. Evan?

Yes, that makes sense. Feel free to file a bug--I should have some time
late next week, so if nobody submits a patch first I'll try and get to
it then.


-Evan




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