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 

using a struct as an argument to g_signal_connect

 
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming
Author Message
aleph1trickpony



Joined: 05 May 2008
Posts: 3

PostPosted: Thu May 08, 2008 6:55 pm    Post subject: using a struct as an argument to g_signal_connect Reply with quote

Is there a way to send a struct (in my case a collection of GtkWidgets) to the g_signal_connect function as user_data? I'm trying to write a callback whose actions depend on multiple widgets, which is why I need to do this.
Back to top
Micah Carrick
Never Seen the Sunlight


Joined: 21 Sep 2005
Posts: 428
Location: Portland, OR USA

PostPosted: Thu May 08, 2008 7:45 pm    Post subject: Reply with quote

Why yes, that is the way we typically do it. You can use g_slice_new to allocate space for your struct.

Here is a small example which does just that. Check it out: http://www.gtkforums.com/about906.html
Back to top
aleph1trickpony



Joined: 05 May 2008
Posts: 3

PostPosted: Thu May 08, 2008 11:34 pm    Post subject: Reply with quote

thanks! that works beautifully.
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