On 11/09/2013 03:30 PM, Marcel Pfeiffer wrote:

I'm new to gtkD and for learning purposes I try to translate this code to D:

gtkforums.com - link

Now I'm stuck at this line in main:

 g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL);

My guess was this:

 window.addOnDestroy(&Main.quit);

In gtkc.gobjecttypes I found gsignalconnect as a TODO but without a hint, how it is replaced.

But this doesn' work. Can someone please hint me to how these signals are handled in gtkD.

It probably doesn't work because the signature of Main.quit doesn't
match what addOnDestroy is expecting.

You will need to wrap it in a delegate literal.

window.addOnDestroy(delegate void(Widget w){ Main.quit(); });

If you do want to use gsignalconnect, try
gobject.Signals.Signals.connectData and set connectData and connectFlags
to null.

gsignalconnect isn't wrapped because it's a macro, so it will need to
be reimplemented in D.
in GObject gsignalconnect is there for convenience it calls
gsignalconnectdata with connectdata and connect_flags set to null.