Re: How to pass data to GtkItemFactory callback?
- From: MALHERBE <malherbe hugues wanadoo fr>
- To: David Topper <topper virginia edu>
- Cc: gtk-list <gtk-list gnome org>
- Subject: Re: How to pass data to GtkItemFactory callback?
- Date: Sat, 03 May 2003 10:42:34 +0200
The way to pass data to your GtkItemFactory callbacks is done thru the
fonction
void gtk_item_factory_create_items( GtkItemFactory *ifactory,
guint n_entries,
GtkItemFactoryEntry *entries,
gpointer callback_data)
*ifactory a pointer to the above created item factory.
n_entries is the number of entries in the GtkItemFactoryEntry array.
*entries is a pointer to the GtkItemFactoryEntry array.
callback_data is what gets passed to all the callback functions for all
the entries with callback_action != 0.
In your array of GtkItemFactoryEntry (perl_file_select_menu), you must
set the 4th parameter (called callback_action) to a value different from 0.
And the prototype of each GtkItemFactory callback is :
void callback( gpointer callback_data,
guint callback_action,
GtkWidget *widget )
You can refer to the tutorial at the following links :
http://www.gtk.org/tutorial/sec-usingitemfactory.html
http://www.gtk.org/tutorial/sec-itemfactoryexample.html
I hope it can help you.
Hugues.
David Topper wrote:
Hi folks,
I'd like to pass some data to my callbacks, but can't seem to do so
with gtk_item_factory(). Here's the basic gist:
GtkItemFactoryEntry perl_file_select_menu[] = {
{ "/New", NULL, create_new_perl_fs, 0, NULL },
{ "/Open", NULL, create_open_perl_fs, 0, NULL },
{ "/Save", NULL, create_save_perl_fs, 0, NULL },
{ "/Save As", NULL, create_save_as_perl_fs, 0, NULL }
};
but I'd like to be able to pass those functions a struct from w/i my
program. Can't seem to make it work. Anyone have a suggestion? Should
I go about making my "file select" window a different way?
Thanks,
DT
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]