Re: [Vala] dbus question




On Wed, 2008-04-02 at 13:01 +0200, Juerg Billeter wrote:
On Sat, March 29, 2008 10:34, Zsombor wrote:
I'm trying to call some dbus methods, but I'm confused with the syntax
little bit. One of the dbus method returns an array of string, the other
returns an array of string tuples, the dbus types are : 'as' and 'a(ss)'.
How can I call this methods? If I wrote :
  string[] result = object.SimpleQuery(....);
Then valac throws the following error:
 error: Assignment: Cannot convert from `string[]' to `string[]?'

And the same happens for the other method, where i've created a 'struct
response  {   string key;  string value;}'.

The D-Bus support in Vala is still pretty experimental. We should already
support string arrays to some extent but I don't remember right now what
limits we have in that area at the moment. The plan is to add full-fledged
D-Bus client and service support to Vala in the future, however, nobody is
working on that right now.

Is this support (especially the server support) waiting on anything in
particular, or just a general lack of manpower in favor of more
important parts?

Regarding the first question; that error is from the fact that you're
dealing with an array of string arrays, rather than an array of strings
(and the two can't be converted between, hence the error). I don't think
Vala currently supports the latter. One way to work around this might be
to use GLib.Lists instead, or something from libgee, but it doesn't look
like Vala's DBus support will currently allow for things like that.

If you have control over how SimpleQuery returns things, you might be
able to work around it for now (albeit extremely wastefully) by having
SimpleQuery return an array of unique string identifiers for the Query's
results, and then having a separate method that takes said identifier
and gives you the original string array. That means a lot of DBus round
trips, though, which are pretty expensive.

- Ethan




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