Re: Replacing a menu item from a component



On Wed, Mar 01, 2000 at 11:39:45AM -0800, John Sullivan wrote:
> I'm trying to replace a disabled menu item with a component-specific
> active one. I've discovered that the caller must specify the menu item
> index for the new menu item; there isn't any call that automatically
> replaces the pre-existing menu item with the same path (though the
> pre-existing one is removed). This seems extremely awkward, since in
> every practical case I can think of, you'd want the menu item to be in
> the same position as the one it replaces. But it's not too bad, because
> I can use bonobo_ui_handler_menu_get_pos on the path to find the
> existing location (and then add one to that to put the new one in the
> same spot).
> 
> But here's a nasty: When I later remove the component's merged menu
> items, either explicity with bonobo_ui_handler_menu_remove or implicitly
> with bonobo_ui_handler_unset_container, the item that had been
> temporarily replaced reappears in the wrong place. It reappears one spot
> earlier than it had been originally.
> 
> This seems like a simple bug in Bonobo that would have been noticed and
> fixed already, which makes me think I'm doing something wrong. But maybe
> nobody has tried replacing specific menu items before? Maybe there's
> some other way to do this that I don't know about?
> 
> If anyone has succeeded in replacing an existing menu item with one from
> a component, please let me know.

I think it works if you specify -1 as the position. When I started using
the menu code, I used the parse-from-uiinfo functions, which don't let
you specify any position. It was unwanted for me, but they replaced the
items that were already there just fine.


Martijn



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