[Vala] DBus signals and non-static methods

It looks like there is a problem connecting non-static methods to DBus

The attached code compiles well but produce critical warnings on DBus
events. The static handler works well, but the instance-method-handler
produce following warning:

** (process:15681): CRITICAL **: test_method_handler: assertion `IS_TEST (self)' failed

The instance-method-handler has following signature (in C):
static void test_method_handler (Test* self, DBusGProxy* sender, const char* id);
But will be called as test_method_handler(DBusGProxy* sender, const
char* id, Test* self)

I have no idea of dbus but in my opinion there is a function missing in
the dbus-glib. dbus-glib only provides the function
"dbus_g_proxy_connect_signal()" which simply calls

In my opinion DBusGProxy also needs
"dbus_g_proxy_connect_signal_object()" to connect to non-static-methods
of objects.

Any ideas?!?

using GLib;

class Test: Object
    private DBus.Connection     conn;        
    private dynamic DBus.Object manager;         

    public static void static_handler(dynamic DBus.Object sender, string id){
        message("static-handler: %s", id);

    public void method_handler(dynamic DBus.Object sender, string id){
        message("method-handler: %s", id);

        conn    = DBus.Bus.get(DBus.BusType.SYSTEM);
        manager = conn.get_object("org.freedesktop.Hal",

        manager.DeviceAdded += static_handler;
        manager.DeviceAdded += method_handler;

    public static int main(string[] args)
        MainLoop            loop  = new MainLoop(null, false);
        var                 my_obj = new Test(); 


        return 0;

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

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