Re: [gtk-list] More GtkItemFactory questions...
- From: Tim Janik <timj gtk org>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] More GtkItemFactory questions...
- Date: Tue, 28 Jul 1998 03:39:57 +0200 (CEST)
On 26 Jul 1998, Thomas Mailund Jensen wrote:
>
> I have several windows with common menus. One of these windows are
> changed dynamically, and I would like to be able to change all these
> menus together. To do that I write
>
> GtkMenuEntry *entry = g_new (GtkMenuEntry, 1);
> entry->path = g_strconcat ("<SourceBuffer>/Highlight/Select Regexps/",
> pattern_name, NULL);
> entry->accelerator = NULL;
> entry->callback = new_pattern_selected;
> entry->callback_data = NULL;
>
> gtk_item_factory_create_menu_entries (1, entry);
>
> (It adds an entry with title pattern_name to the Select Regexps
> sub-menu).
>
> [Q1] But gtk_item_factory_create_menu_entries is deprecated. So what
> should I do instead? Is it necessary to map through all my factories
> and call gtk_item_factory_create_item?
>
> [Q2] Also, a GtkMenuEntry has a callback_data pointer, while the
> GtkItemFactoryEntry struct has an integer callback_action.
those functions are provided to dupply the programmer with an easy interface
if he converts from the old GtkMenuFactory code. it is not guarranteed that
this interface will exist in 1.2 as well.
you should use the pure item factory functions/structures for this:
GtkItemFactoryEntry *entry = g_new (GtkItemFactoryEntry, 1);
entry->path = ...;
entry->accelerator = NULL;
entry->callback = new_pattern_selected;
entry->callback_action = 42;
entry->item_type = "<Item>";
gtk_item_factory_create_items (ifac, 1, entry, cb_data);
g_free (entry);
the callback will look like this:
void
new_pattern_selected (gpointer cb_data,
guint callback_action /* 42 */,
GtkWidget *widget /* menu item */)
{}
>
> The callbacks are defined as
>
> typedef void (*GtkMenuCallback) (GtkWidget *widget,
> gpointer user_data);
>
> and
>
> typedef void (*GtkItemFactoryCallback) ();
> typedef void (*GtkItemFactoryCallback1) (gpointer callback_data,
> guint callback_action,
> GtkWidget *widget);
> typedef void (*GtkItemFactoryCallback2) (GtkWidget *widget,
> gpointer callback_data,
> guint callback_action);
>
> so what should I expect the callback to be called with?
>
> /mailund
>
> --
> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null
>
>
---
ciaoTJ
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]