The GDBus documentation never really tells how to use composed types like a{sv}
Submitted by Steve Dodier
Assigned to David Zeuthen
Link to original bug (#727681)
Description
I have a project for which I'm implementing a DBus server with GDBus, and that server needs to receive a list of string:int tuples. I've tried various methods around the GDBus API server-side and gdbus-call client-side, including:
- an array of struct{gchar *; int} (don't ask me how that'd have worked, I don't know myself :) )
- two separate arrays of gchar * and int
- an array of GVariant containing a gchar* and another GVariant, itself containing an int
The last method is quite complicated and this is what I used because.... this is the only one for which I could find examples. The gdbus-call syntax is simply put described nowhere at all. I found one link on a stackexchange forum where people used a{sv} after reading... the GDBus implementation!
I myself found the server-side code by googling the GNOME commit MLs, and finding https://mail.gnome.org/archives/commits-list/2010-May/msg03097.html
It may be that there is a documentation out there. In which case it should be linked to the man pages of gdbus, and the online doc of GDBus's CLI and the C API. Otherwise, very frankly having a more accurate documentation on how to receive composite types in C (not just how to send them), and how to send them with gdbus-call would be really, really useful!
Thanks.