GTK+ Forums Forum Index GTK+ Forums
Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Difference between g_signal_connect and gtk_signal_connect?

 
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming
Author Message
TriKri
Familiar Face


Joined: 19 Mar 2008
Posts: 14

PostPosted: Thu Mar 20, 2008 1:02 pm    Post subject: Difference between g_signal_connect and gtk_signal_connect? Reply with quote

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

PostPosted: Thu Mar 20, 2008 3:09 pm    Post subject: Reply with quote

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

PostPosted: Thu Mar 20, 2008 5:07 pm    Post subject: Reply with quote

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

PostPosted: Tue Mar 25, 2008 2:51 pm    Post subject: Reply with quote

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

PostPosted: Tue Mar 25, 2008 5:49 pm    Post subject: Reply with quote

Thanks.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming All times are GMT
Page 1 of 1

 


Powered by phpBB © 2001, 2005 phpBB Group
CodeBB 1.0 Beta 2
Protected by Anti-Spam ACP