[Vala] sending structs containing lists over dbus

Let's say I've a method available over DBus which takes a list of
structs, where each struct contains an integer and a list of strings,
somehow I'm unable to even define such interface in vala, valac fails
with error:

markus markus-lucid-vbox:~/vala_playground$ valac --version
Vala 0.7.9
markus markus-lucid-vbox:~/vala_playground$ valac --pkg dbus-glib-1 client.vala
[...some "never used"- warnings here ...]
/home/markus/vala_playground/client.vala.c: In function ‘_dbus_test_TestMethod’:
/home/markus/vala_playground/client.vala.c:271: error: invalid type
argument of ‘->’ (have ‘Data’)
/home/markus/vala_playground/client.vala.c: In function
/home/markus/vala_playground/client.vala.c:539: error: invalid type
argument of ‘->’ (have ‘Data’)
error: cc exited with status 256
Compilation failed: 1 error(s), 5 warning(s)

For me it looks like sending some nested datastructures with a client
written in vala is not (yet) possible, is this correct?

Thanks for your help,


struct Data {
    public int id;
    public string[] data;

[DBus (name = "org.example.Test")]
interface Test : Object {
    public abstract int TestMethod (Data[] x) throws DBus.Error;

void main () {
    var conn = DBus.Bus.get (DBus.BusType.SESSION);
    var test = (Test) conn.get_object ("org.example.Test", "/org/example/test");

And a test service written in python


import gobject

import dbus
import dbus.service
import dbus.mainloop.glib

class SomeObject(dbus.service.Object):

    @dbus.service.method("org.example.Test", in_signature="a(ias)",
    def TestMethod(self, i):
        print i
        return 1000

if __name__ == '__main__':

    session_bus = dbus.SessionBus()
    name = dbus.service.BusName("org.example.Test", session_bus)
    object = SomeObject(session_bus, '/org/example/test')

    mainloop = gobject.MainLoop()

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