[Vala] Register object in SYSTEM bus



Hi all:

I'm trying to register an object in dbus'SYSTEM bus, but I'm unable to
do so. I try with:


[DBus (name = "com.rastersoft.gamed")]

public class dbus_class: Object {

    public void set_priority(int new_priority) {

        k.do_check(new_priority);

    }

}

void on_bus_aquired (DBusConnection conn) {

    

    GLib.stdout.printf ("Registering bus\n");

    try {

        var l=conn.register_object<dbus_class> ("/com/rastersoft/gamed", new dbus_class());

        GLib.stdout.printf ("Registered bus %d\n",(int)l);

    } catch (IOError e) {

        GLib.stderr.printf ("Could not register service\n");

        Posix.exit(-1);

    }

}

    

Bus.own_name (BusType.SYSTEM, "com.rastersoft.gamed", BusNameOwnerFlags.NONE, on_bus_aquired , () => {

        GLib.stdout.printf ("Catched bus\n");

    }, () => {

        GLib.stderr.printf ("Bus lost\n");

        Posix.exit(-1);

    });



But always get "Bus lost". If I replace BusType.SYSTEM with
BusType.SESSION, it works fine. What am I doing incorrect?

Thanks!

-- 
Nos leemos
                         RASTER    (Linux user #228804)
raster rastersoft com              http://www.rastersoft.com




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