Re: [gtk-list] Passing data to callback via item factory



"Scott A. Barron" wrote:
> 
> Hello all,
> 
> I'm looking through the tutorial and testgtk.c and missing one crucial point
> regarding item factory created menus.  How do I pass my data to the call back I
> connect to an item?  I understand how to specify the callback, and I'm not too
> sure what the call back actions paramter is.  Can someone shed some light on
> this for me?  I'd like to convert my normal menu code to item factory code, but
> this is holding me up.  Thanks for any tips.
> 
> -Scott
> 
> --
> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null

I ran into the same problem and the only way around it was to use an
array with data matching the menus and looping through
gtk_item_factory_create_item() manually. I don't know if there is a
reason not to do this, it seems that it would have been very easy to
implement in the first place and left out on purpose looking at the
source.

for (i = 0; i < nmenu_items; i++) {
    menu_entry = menu_items + i;
    
    gtk_item_factory_create_item (item_factory, menu_entry,
				  *(callback_data + i), 2 );
}
-- 
		Stephen



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