Re: gnome menubar w/ toggle or radio items




On Fri, 12 Feb 1999, Andy Kahn wrote:
> 
> well, the menubar itself doesn't appear to be of GnomeUIInfo type.
> e.g., here are the calls i'm making:
> 
> 	gnome_app_create_menus(GNOME_APP(w->toplev), main_menu);
> 	gnome_app_install_menu_hints(GNOME_APP(w->toplev), main_menu);
> 
> where "main_menu" is an array of GnomeUIInfo structures.  however, this
> is a global variable, and is used for menu definitions more than once
> in the application.  i suppose i could make another copy of this, but
> the majority of the information in this menu is the same (such as
> the menu text, callbacks, etc.), so it's rather wasteful.
> 

Just copy the widget part. i.e. make a place to put pointers to your
radio/toggle items; then copy whatever_menu[whatever_index].widget 
to that place. main_menu[index].widget will have menu items for the
submenus, that probably isn't what you want.

There are lots of ways to do it; you could have an array of GtkWidget*
corresponding to the menu and indexed by enum, or you could have a
separate named GtkWidget* for each menu item, or whatever.

I'll mail you an example from gnome-apt privately.

> one of the things that's variable is the widgets from the menu items
> (the toggle buttons, radio buttons, whatever).  i was hoping that:
> 
> 	GNOME_APP(w->toplev)->menubar
> 
> could be used to get to the specific toggle/radio button widgets.
> is this possible?  or am i misunderstanding how this is supposed
> to work?  certainly, a gnome app could have more than one menubar...
> 

It would be some monstrosity like
g_list_nth(gtk_container_children(g_list_nth(gtk_container_children(GNOME_APP(w->toplev)->menubar->menu),
                      index_of_toplevel_menu))->menuitem

That isn't right at all but the scale is accurate. Trust me pulling the
widgets out of the UIInfo is easier. 

Havoc




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