Re: [Vala] Dbus, connecting a signal to an async method...



Il giorno dom, 05/12/2010 alle 21.10 +0100, Jan Hudec ha scritto:
On Sat, Dec 04, 2010 at 12:35:26 +0100, Marco Trevisan (Treviño) wrote:
Il giorno ven, 03/12/2010 alle 17.18 +0100, Abderrahim Kitouni ha
scritto:
session_proxy.name_acquired.connect (this.name_acquired);
What I would have done is:

session_proxy.name_acquired.connect ((name) => this.name_acquired.begin(name));

Ok, cool this works thanks. However in this case the lambda should be
(p, name) => this.nameacquired.begin(p, name); ;-)

However I guess that this is just a workaround, the related bug should
be fixed!

It's not a bug. The 'async' is part of the function signature, so the
function signatures don't match and it can't be converted.

It might be a missing feature, but I think it's preferable to explicitly
require the .begin.

Yes, this is right indeed. The signature is not the same, so why don't
allow to define async signals?


You can also try to pass the begin method directly (but I'm not sure it
works).

No, I tried that, but it didn't work, I got an error since the begin
return value was considered just like a void.

Hm, the begin function returns a void, but that's what the signal expects
anyway, so it seems like that one should work. That would be a bug than.

It doesn't work to me:

marco tricky:/tmp$ valac --pkg dbus-glib-1 --pkg gio-2.0
dbus-connect-async.vala 
warning: D-Bus GLib is deprecated, use GDBus
dbus-connect-async.vala:38.15-38.39: error: invocation of void method
not allowed as expression
                if (name in sender.list_names.begin())
                            ^^^^^^^^^^^^^^^^^^^^^^^^^
Compilation failed: 1 error(s), 1 warning(s)

Is this a bug?






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