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



Hello, I've a situation like the one in the example that I've attached
here, where I need to make an asynchronous call to a method from a dbus
signal callback function; to perform that I need to use the yield
modifier, and so I need the callback function method should be async.

Now, when I connect the async method to the dbus interface with
somethink like:

session_proxy = (FreeDesktopDBus) connection.get_object
                        (FreeDesktopDBus.UNIQUE_NAME,
                         FreeDesktopDBus.OBJECT_PATH,
                         FreeDesktopDBus.INTERFACE_NAME);

session_proxy.name_acquired.connect (this.name_acquired);

Where name_acquired is defined as:

private async void name_acquired(FreeDesktopDBus sender, string name) {
}

I get an error:
        Cannot convert from `Test.name_acquired' to `FreeDesktopDBus.name_acquired

As a workaround I added two sync signal methods to the dbus interface,
but not using async calls is not a good think here...

Other ways? Thanks!

Bye.

PS: I'm using dbus-glib since the project I'm working on, uses it and I
can't change that.

Attachment: dbus-connect-async.vala
Description: Text Data



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