Re: connecting callbacks to signals


Peter Jay Salzman <p dirac org> writes:

> i never quite got the hang of this...
> can someone explain the difference between gtk_signal_connect and
> gtk_signal_connect_object?

they swap the arguments that are passed to the signal handler. It's
sometimes useful if you have code that would fit well as a signal
callback but has the arguments swapped (i.e. you want the user_data
first and the emitting object last). Instead of writing a wrapper to
get a matching signal handler, you use gtk_signal_connect_object().

The GObject-2.0 API has it much cleaner:

  gtk_signal_connect()              <->  g_signal_connect()
  gtk_signal_connect_object()       <->  g_signal_connect_swapped()
  gtk_signal_connect_while_alive()  <->  g_signal_connect_object()

This is confusing if you used to work with GTK+-1.2, but the function
names are IMHO much better choosen.

Salut, Sven

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]