|
|
| Author |
Message |
|
|
TriKri Familiar Face
Joined: 19 Mar 2008 Posts: 14
|
Posted: Thu Mar 20, 2008 1:02 pm Post subject: Difference between g_signal_connect and gtk_signal_connect? |
|
|
Hi!
I have bumped into two different function which seems to do the same thing. I use them both in my program but I now want to use only one of them. So I wonder, what is the difference between g_signal_connect and gtk_signal_connect? I also noticed that the function that was given as a parameter to be called when the event occured, was given differently to the functions as well. In the case with g_signal_connect, the funktion was given as G_CALLBACK(function), while in the other case it was given as GtkSiglanFunc(function). Which one is right to use and which function should I use? Which one is best? |
|
| Back to top |
|
 |
Wolfgang Familiar Face
Joined: 05 Feb 2008 Posts: 37
|
Posted: Thu Mar 20, 2008 3:09 pm Post subject: |
|
|
GTK+ Reference: The GTK+ signal system merely proxies the GLib signal system now. For future usage, direct use of the GSignal API is recommended, this avoids significant performance hits where GtkArg structures have to be converted into GValues.
So, g_signal_connect() is the best choice. |
|
| Back to top |
|
 |
TriKri Familiar Face
Joined: 19 Mar 2008 Posts: 14
|
Posted: Thu Mar 20, 2008 5:07 pm Post subject: |
|
|
| Okay, thanks! I have realized that G_CALLBACK must be some kind of a macro, does it maybe transform it to a GtkSignalFunc? |
|
| Back to top |
|
 |
Micah Carrick Never Seen the Sunlight
Joined: 21 Sep 2005 Posts: 413 Location: Portland, OR USA
|
Posted: Tue Mar 25, 2008 2:51 pm Post subject: |
|
|
G_CALLBACK is a casting macro. It will cast to a (*GCallback)...
However, I believe that the GCallback is similar to or the same as GtkSignalFunc and simply the "new" way of doing is since gtk_signal_connect and friends and deprecated and no longer used.
In short, stick to using g_signal_connect and G_CALLBACK. |
|
| Back to top |
|
 |
TriKri Familiar Face
Joined: 19 Mar 2008 Posts: 14
|
Posted: Tue Mar 25, 2008 5:49 pm Post subject: |
|
|
| Thanks. |
|
| Back to top |
|
 |
|