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




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




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