Re: UIManager and dynamic menus



On Wed, 2007-04-04 at 19:37 +0200, Frank Naumann wrote:
> Hello!
> 
> > For me, I'll be using this from within a plugin context, so each
> > plugin will get handed a UIManagerMerge object, and add what it needs
> > to the ui.  Then when the plugin goes away, all of its menu stuff goes
> > away cleanly as well.  The only thing I can't get around is the path
> > issue.  As it is, I'd have to make each of my plugins 'know' the path
> > through the ui stuff.  I did think about making it so that the
> > UIManagerMerge object could get constructed with a base path, so that
> > all additions get put below a certain path, but that ixnay's the
> > ability to add to multiple menus in the UI.
> >
> > I'll work on fleshing this out a bit more, if anyone else has some
> > insights, feel free to shout out.  I'll post some code when I get to
> > that point.
> 
> I use add_ui_from_string() and remove_ui() and for me it's very easy. I 
> use it for a recent file submenu (e.g. File -> Recent Files -> 1: ..., 
> 2:...).

It might also be worth looking at the new recent files code in GTK+'s
trunk branch (2.13). It now has code to have changeable inline menu
items for the recent files. I have not looked at it yet.

> I pass the path head and tail to the object that manage the recent files. 
> On merge it construct then the ui string dynamically. So it can be used at 
> any place in the ui.

-- 
Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com




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