[Vala] Some more troubles with GValues



I managed how to handle a DBus dict of {string, variant} in Vala, but now I have some troubles with GValue type as C compiler returns me some errors:
Maybe it depends on how my code is written, as I'm new to Vala and GLib types, but I really can't figure out where the problem is.

I have to extract a string value from an HashTable<string,Value> obtained with a DBus call and store it in a variable.

First try:
(1)            HashTable<string,Value> properties = server.GetProperties();
(2)            string address = properties.lookup("Address").get_string();
Vala compilation is successful, but C compilation fails with "incompatible types in assignment" on C instruction derived from line 2.
I tried using dup_string too, but the result is the same.

Second try: breaking up instructions
(1)            HashTable<string,Value> properties = server.GetProperties();
(2)            Value v = Value(typeof(string));
(3)            v = properties.lookup("Address");
(4)            string address = v.get_string();
Vala compilation is successful, but C compilation fails with "lvalue required as unary '&' operand" on C instruction derived from line 3.

Could someone help me to find where the problem is or with a code example? Tell me if you need some more details.

Thanks in advance

Daniele Benucci

--
Grabel's Law:
2 is not equal to 3 -- not even for large values of 2.


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