Re: [gtk-list] Re: gtk_widget_set_state() with GNOME generated menus.



Havoc Pennington wrote:

> On Fri, 3 Dec 1999, Chris Phelps wrote:
> > assume this is because most gnome programs use the gnome menu builder,
> > which doesnt exactly co-operate well with finding GtkMenuItem's. In my
>
> Yes it does, you just extract them from your GnomeUIInfo after you create
> the menus. It's not the most convenient thing on earth but it works fine,
> and it isn't awful. In any case it's better than the below:
>
> > (GtkMenuBar *)menu_bar = GTK_MENU_BAR(GNOME_APP(window)->menubar);
> > // "File" is the first menu
> > (GtkMenuItem *)filemenu =
> > GTK_MENU_ITEM(GTK_MENU_BAR(menu_bar)->menu_shell.children->data);
> > // and "Edit" is the second
> > (GtkMenuItem *)editmenu =
> > GTK_MENU_ITEM(GTK_MENU_BAR(menu_bar)->menu_shell.children->next->data);
> > // dont get the very first menu item, because it is the little ---------
> > thing, which we dont want, so skip 1 item
> > (GtkPixmapMenuItem *)edit_menu_change =
> > GTK_PIXMAP_MENU_ITEM(GTK_MENU_SHELL(GTK_MENU_ITEM(editmenu)->submenu)->children->next->data);
> >
>
> This is very likely to break due to GTK changes or changes in your own
> app.
>
> How did you build the menu? If manually, then you already have the
> pointers without doing this. If you used the GtkItemFactory, there are
> functions to extract the widgets.
>
> Havoc
>
> --
> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null

I used gnome_app_create_menus() with all that GNOMEUIInfo crap.

I think I understand what you mean now tho...
The name of the GNOMEUIInfo has pointers to the menu items?

ex:
GNOMEUIInfo menu1 [] =
{
      GNOMEUIINFO_SUBTREE("_File", filemenu),
      GNOMEUIINFO_SUBTREE("_Edit", editmenu),
}

what exactly is menu1[0] pointing to after the menu us built?

Later,
Chicane



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