adding menu items dynamically



Hi all,

I'm working on bonobo-izing vim, and I'm currently working on the
menubars.

I'm familiar with bonobo_ui_util_set_ui() for setting an entire UI from
an XML file, and I've also played around with bonobo_ui_component_set()
to set an XML fragment into the UI tree.

What I'd like to do is be able to add a menu item dynamically, without
replacing that menu's current items.  If I have:

    bonobo_ui_component_set(ui_component, "/menu", 
    "<submenu name=\"File\" _label=\"_File\">
      <menuitem name=\"FileNew\" verb=\"FileNew\"/>
    </submenu>", NULL );

and I do

    bonobo_ui_component_set(ui_component, "/menu/File", 
	"<menuitem name=\"FileOpen\" verb=\"FileOpen\"/>", NULL );

then the FileNew item is replaced by the FileOpen item (understandably
so).

Is there a way to simply _add_ a menu item, short of
generating/concatenating the XML fragments together and then calling
bonobo_ui_component_set() on the whole menu?  

Since the menus are user-defined in vim there are not fixed and must be
generated programmatically.  Is there are better way to do this than the
above strategy?

-- 
Jason D. Hildebrand
jason peaceworks ca




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