Re: visibility problems



Am Fre, 2003-09-19 um 23.17 schrieb Owen Taylor:
> On Fri, 2003-09-19 at 15:43, Matthias Clasen wrote:
> > I met a minor annoyance with the action-based menus. The constructed
> > menus do regularly contain invisible items (unused tearoff menu items,
> > proxies of actions whose visible property is set to FALSE, or smart
> > separators which have gone invisible). Therefore code like the following
> > 
> >  gtk_ui_manager_add_ui_from_file (ui, "ui.xml", NULL);
> >  gtk_box_pack_start (GTK_BOX (vbox),
> > 		      gtk_ui_manager_get_widget (merge, "/menubar"),
> > 		      FALSE, FALSE, 0);
> > 
> >  gtk_container_add (GTK_CONTAINER (window), vbox);
> >  gtk_widget_show_all (window);
> > 
> > doesn't quite work as intended: It makes all the invisible menu items
> > visible. 
> > 
> > I see two options to improve the situation:
> > 
> > a) Make all constructed menuitems compound children of their menus. This
> > should make gtk_widget_show_all() keep out of the constructed hierarchy,
> > but also prevents the use of gtk_container_foreach() on the constructed
> > menus.
> > 
> > b) Document this trap and live with it.
> 
> I don't like leaving this trap. Reusing the compound-child mechanism
> seems a little peculiar to me. Might it be best to simply add new
> API:
>  
>  gtk_menu_item_set_no_show_all()
> 
> and implement a custom show_all for gtkmenushell to handle that?
> 

> (We could make that gtk_widget_set_no_show_all(), but then custom 
> show_all implementations wouldn't get it right, so it wouldn't really
> work universally.)

We also need it for toolbars though, since constructed toolbars are
affected as well, thus I would prefer gtk_widget_set_no_show_all().

There are only 6 show_all implementations in gtk+ currently, so we can
certainly update all those. Or are you concerned about third-party
widgets ? 

Matthias





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