[Vala] DBus signals and non-static methods

2008-05-24 Thread Hannes Matuschek
It looks like there is a problem connecting non-static methods to DBus
signals.

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
g_signal_connect_closure_by_id().

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);
}


construct{
conn= DBus.Bus.get(DBus.BusType.SYSTEM);
manager = conn.get_object(org.freedesktop.Hal,
  /org/freedesktop/Hal/Manager,
  org.freedesktop.Hal.Manager);

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

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

loop.run();

return 0;
}
}




smime.p7s
Description: S/MIME Cryptographic Signature
___
Vala-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] DBus signals and non-static methods

2008-05-24 Thread Jürg Billeter
Hi Hannes,

On Sat, 2008-05-24 at 12:15 +0200, Hannes Matuschek wrote:
 It looks like there is a problem connecting non-static methods to DBus
 signals.

This is probably bug 532290[1], which has been fixed an hour ago.

Juerg

[1]http://bugzilla.gnome.org/show_bug.cgi?id=532290

___
Vala-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list