"destroy" signal handler sample code for Glib bindings

g4-lisz at tonarchiv.ch g4-lisz at tonarchiv.ch
Sun Mar 29 17:33:13 PDT 2009


g4-lisz at tonarchiv.ch wrote:
> Hello
>
> Can someone please guide me to some sample code on how to catch a 
> "destroy" signal from a DBusGProxy created with new_for_name_owner()?
>
> I'm new to GLib and i have no idea how such signals are caught and 
> handled...
>
> I'd like to avoid proxy calls when it had been destroyed:
>
> CRITICAL **: dbus_g_proxy_call: assertion `!DBUS_G_PROXY_DESTROYED 
> (proxy)' failed
>
>
>   
OK i found the solution:

static void destroy_signal(GObject *sender, gpointer data) {
    g_debug("'destroy' signal triggered");
}

main() {
    [...]
    g_signal_connect (G_OBJECT (proxy), 
"destroy",G_CALLBACK(destroy_signal), NULL);
}

I hope this will do the trick.

TW

> Any help would be much appreciated!
>
> TW
> _______________________________________________
> dbus mailing list
> dbus at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dbus
>   



More information about the dbus mailing list