GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Fri Aug 01, 2014 7:48 am

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: How To send mutiple data while using g_signal_connect() ?
PostPosted: Thu Jan 16, 2014 1:14 pm 
Offline
Familiar Face

Joined: Fri Jan 10, 2014 2:29 pm
Posts: 21
How do i sent multiple widgets as data to g_signal_connect ();
Code:
g_signal_connect_after(instance, detailed_signal, c_handler, data)


Top
 Profile  
 
 Post subject: Re: How To send mutiple data while using g_signal_connect()
PostPosted: Fri Jan 17, 2014 8:41 am 
Offline

Joined: Sat Dec 21, 2013 10:04 am
Posts: 4
you can create a struct containing the widgets you want to send to g_signal_connect()

For example:

Code:
struct MyData {
    GtkWidget w1;
    GtkWidget w2;
    GtkWidget w3;
};

MyData* d = new MyData;
d->w1 = some_window;
d->w2 = some_widget;
d->w3 = some_button;

g_signal_connect(instance, detailed_signal, c_handler, d);


Top
 Profile  
 
 Post subject: Re: How To send mutiple data while using g_signal_connect()
PostPosted: Fri Jan 17, 2014 11:51 pm 
Offline
GTK+ Guru

Joined: Fri Mar 25, 2011 5:16 pm
Posts: 177
Location: USA
new is a C++ language keyword. C language uses malloc, realloc, calloc along with free.
But GTK has it's own versions of the C language functions which are part of GLib, (one of the dependencies of GTK.) they are: g_slice_new, g_slice_alloc, etc.
https://developer.gnome.org/glib/stable/glib-Memory-Slices.html#g-slice-new

Here are some examples:
http://www.gtkforums.com/viewtopic.php?f=3&t=988&p=196157=Changing+menubar+content%2C+by+selecting+a+notebook+tab#p196157

http://www.gtkbook.com/tutorial.php?page=keyfile


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 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:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group