GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Thu Nov 27, 2014 5:30 am

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Difference between g_signal_connect and gtk_signal_connect?
PostPosted: Thu Mar 20, 2008 1:02 pm 
Offline
Familiar Face

Joined: Wed Mar 19, 2008 3:23 pm
Posts: 19
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?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 20, 2008 3:09 pm 
Offline
GTK+ Guru

Joined: Tue Feb 05, 2008 8:39 am
Posts: 130
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.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 20, 2008 5:07 pm 
Offline
Familiar Face

Joined: Wed Mar 19, 2008 3:23 pm
Posts: 19
Okay, thanks! I have realized that G_CALLBACK must be some kind of a macro, does it maybe transform it to a GtkSignalFunc?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 25, 2008 2:51 pm 
Offline
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 12:07 am
Posts: 563
Location: Portland, OR USA
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.

_________________
Micah Carrick - Forum Administrator
http://www.micahcarrick.com


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 25, 2008 5:49 pm 
Offline
Familiar Face

Joined: Wed Mar 19, 2008 3:23 pm
Posts: 19
Thanks.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group