[Vala] GLib.Variant parmeter containing several types



Hello
I'm trying to build some Variant parameter for the dbus
"PropertiesChanged" signal in "org.freedesktop.DBus.Properties"
interface.
The signature says it has to be "(sa{sv}as)". That means I have to put a
string, a HashTable and an array of string into a GLib.Variant.
Packing a single simple type into Variant works smooth in vala (very
convenient)

    int i = 4;
    Variant v = i; 

But how to put several values into a Variant?

I tried
    HashTable<string,Variant> hashtable = new
HashTable<string,Variant>(str_has, str_equal);
    Variant v = new Variant("(sa{sv}as)", "some string", hashtable ,
null);

but no luck. This will compile, but crash at runtime.

How to setup such a Variant?
Hints appreciated

Jörn
 





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