Using Introspection to listen to a set of signals unknown at compile time [dbus-glib]

Ed Martin lists at edman007.com
Thu Oct 22 18:39:35 PDT 2009


Hi,
     I'm having a pretty hard time with this problem, I have checked the 
documentation, the headers, and the source and I still can't figure it 
out. Basically I want to write an application that can listen to signals 
determined at runtime (loaded from a config file). I was told that for 
an application written in C dbus-glib is the way to go (and it is going 
to stay in C because it will eventually become a plugin to a larger 
application written in C).

     Since I do not know the signals at compile time I can't know their 
types, that makes dbus_g_proxy_add_signal() completely useless. 
According to the docs, thats ok as long as the application supports 
introspection. However when I try to actually do something like this:

DBusGProxy *sess_proxy = dbus_g_proxy_new_for_name(sessconn, service, 
path, interface);
dbus_g_proxy_connect_signal(sess_proxy, name, 
G_CALLBACK(lcd_sig_received), "lol", NULL);

I am told that I need to use the *_add_signal() function mentioned in 
the docs. So i searched the docs for using introspection, almost nothing 
on using the introspection data. I have been grepping the source of 
dbus-glib and I see plenty of functions using introspection data but I 
do not see anything that takes input XML and fills out data in the 
private proxy object.

So how do I listen for the signal? Is this something completely missing 
from the dbus-glib bindings? I find that hard to believe, the 
documentation seems to imply it is done for me somewhere, and I know of 
many applications using many different bindings that are able to read 
signals unknown at compile time (like dbus-monitor and d-feet).

     Thanks.

Ed Martin


More information about the dbus mailing list