Re: [Vala] DBus Dictionary Binding? (was: Gee.HashMap<string, int> - uncaught error: No demarshaller registered for type "GeeHashMap")



Hello again,

Gilles Filippini a écrit :
I'm very new to vala, and while trying to use the Gee.HashMap<string,
int> type to handle a DBus dictionary I encountered the following error:

uncaught error: No demarshaller registered for type "GeeHashMap"

How should I proceed to register a demarshaller?


I finally discovered the GLib.HashTable class which should be more
appropriate than Gee.HashMap, but it doesn't help:

 debian-gta02:~# cat dict.vala
 using GLib;
 using DBus;

 public static void main (string [] args) {
   DBus.Connection conn;
   dynamic DBus.Object idleNotifier;
   GLib.HashTable<string, int> timeouts;
   conn = DBus.Bus.get(DBus.BusType.SYSTEM);
   idleNotifier = conn.get_object("org.freesmartphone.frameworkd",
"/org/freesmartphone/Device/IdleNotifier/0",
"org.freesmartphone.Device.IdleNotifier");
   // The GetTimeouts() DBus method returns a DBus Dictionary.
   timeouts = idleNotifier.GetTimeouts();
 }
 debian-gta02:~# valac --pkg dbus-glib-1 --pkg glib-2.0 -o dict dict.vala
 dict.vala:8.10-8.42: warning: unhandled error `DBus.Error'
   conn = DBus.Bus.get(DBus.BusType.SYSTEM);
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 dict.vala:10.14-10.39: warning: unhandled error `GLib.Error'
   timeouts = idleNotifier.GetTimeouts();
              ^^^^^^^^^^^^^^^^^^^^^^^^^^
 Compilation succeeded - 2 warning(s)
 debian-gta02:~# ./dict

 ** (process:3942): WARNING **: No demarshaller registered for type
"gpointer"

 ** (process:3942): CRITICAL **: file dict.c: line 49: uncaught error:
No demarshaller registered for type "gpointer"

If I replace the line:
        timeouts = idleNotifier.GetTimeouts();
with:
        idleNotifier.GetTimeouts();
there is no more run-time error. Hence I guess the problem lies in
binding a DBus Dictionary to a HashTable...

How whould I proceed to correctly handle a DBus Dictionary in Vala?

Thanks in advance,

_Gilles.



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