Re: [gtk-list] ItemFactory anyone?



On Wed, Jan 13, 1999 at 05:04:43PM -0800, Brandon Long wrote:

> For instance, what is a callback action?  We no longer have a space in
> the entry for the callback data..

Looking at the header file, it's just an integer that can be used as an
index.

struct _GtkItemFactoryEntry
{
  gchar *path;
  gchar *accelerator;

  GtkItemFactoryCallback callback;
  guint			 callback_action;
  gchar		 *item_type;
};

void	gtk_item_factory_create_items	(GtkItemFactory		*ifactory,
					 guint			 n_entries,
					 GtkItemFactoryEntry	*entries,
					 gpointer		 callback_data);
					 

So I suppose if you have some data you want to associate with a menu item
you can pass in an array or gslist as the callback_data.  Then in your
callback function retrieve the data item you want by indexing into the array
or gslist using the passed in callback_action integer.

If you already know what the menu items are going to be and they won't
change at runtime you can just use a case statement in your callback.

Dave Cook





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