Re: [Vala] Vala/DBus with dict object



Hi,

the siganture a(sv) is an array of structs with a string and a value,
not a Dict/HashTable. A hashtable has the signature a{av}.

Regards, Frederik

Am Donnerstag, den 19.02.2009, 00:32 -0300 schrieb Marcelo Boveto Shima:
Hello!

I am trying to invoke some ConsoleKit methods and I succeed on
almost every method, but not OpenSessionWithParameters.
It has the signature a(sv) (1). I donĀ“t know what I am doing wrong.
I created a method with the same signature and it worked.

It works with python/dbus.

The code is:
using GLib;

public class Sessiondb.Main : Object {
    private const string CK_NAME = "org.freedesktop.ConsoleKit";
    private const string CK_PATH = "/org/freedesktop/ConsoleKit";
    private const string CK_INTERFACE = "org.freedesktop.ConsoleKit";
    private const string CK_MANAGER_PATH =
"/org/freedesktop/ConsoleKit/Manager";
    private const string CK_MANAGER_INTERFACE =
"org.freedesktop.ConsoleKit.Manager";
    private const string CK_SEAT_INTERFACE =
"org.freedesktop.ConsoleKit.Seat";
    private const string CK_SESSION_INTERFACE =
"org.freedesktop.ConsoleKit.Session";

    private dynamic DBus.Object ckmanager;

    public Main () {
    }
    public void run () {
        try {
            var conn = DBus.Bus.get (DBus.BusType.SYSTEM);

            this.ckmanager = conn.get_object
("org.freedesktop.ConsoleKit", "/org/freedesktop/ConsoleKit/Manager",
"org.freedesktop.ConsoleKit.Manager");

            HashTable<string,Value?> parameters = new
HashTable<string,Value?>(str_hash,str_equal);

            Value sessiontype = Value (typeof(string));
            sessiontype.set_string ("sessiondb");
            parameters.insert("session-type" , sessiontype);

            string cookie = ckmanager.OpenSessionWithParameters
(parameters);

            stderr.printf ("finished: %s \n", cookie);

        } catch (Error e) {
            stderr.printf ("Oops: %s\n", e.message);
        }
    }
    static int main (string[] args) {
        var main = new Main ();
        main.run ();
        return 0;
    }
}


The error is Method "OpenSessionWithParameters" with signature "a{sv}"
on interface "org.freedesktop.ConsoleKit.Manager" doesn't exist.

Thanks
Shima.

(1)
http://people.freedesktop.org/~mccann/doc/ConsoleKit/ConsoleKit.html#Manager.OpenSessionWithParameters
_______________________________________________
Vala-list mailing list
Vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil



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