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