passing data to a callback



I'm rewriting a game I'm working on from only GTK, GDK and GLIB to
some Gnome functions as well and I got a little problem with the
menu bar...
Before I used the ItemFactory to create a gtk menubar
and I could just say
"gtk_item_factory_create_items(item_factory,nmenu_items,menu_items,<MY
POINTER TO DATA>);"
and I could pass data to all the menu items... I got a big struct that
contains all the data I need in the game, and I want some of the menu
items to be able to print data from that struct... 
{
	GNOME_APP_UI_ITEM,
	N_("Print Cycle Counter"), N_("Prints the CYCLE_CNT variable"),
	print_cycle_cnt, <MY POINTER TO DATA>, NULL,
	GNOME_APP_PIXMAP_FILENAME, "./images/menu_cyclecnt.xpm",
	NULL, (GdkModifierType)0, NULL
},
and now that I try to
construct something similar with Gnome it doesn't work,
because it tells me the user_data field isn't constant...
how do I solve this problem?

(I don't want to make the data static, I think that's ugly,
 I want to pass it to all the functions that need it.)

Willem

-- 
wrvh@xs4all.nl      | http://www.xs4all.nl/~wrvh
wrvhage@wins.uva.nl | http://gene.wins.uva.nl/~wrvhage



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]