Re: GtkUIManager questions.

Hey Nils

"Nils O." SelÃsdal <noselasd frisurf no> writes:

On Thu, 2004-06-24 at 19:41, Archit Baweja wrote:
Hey Nils,

I'm guessing you didn't have previous experience with libbonoboui menus.
"Nils O." SelÃsdal <noselasd frisurf no> writes:

I have a few GtkUIManager questions, first, is there
some nice tutorials/guides anywhere ?
1 With the following:
<ui><popup name="ProjectPopup>
       <menuitem name="Build" action="Build"/>
      <menuitem name="Execute" action="Execute"/>
      <menuitem name="MoveUp" action="MoveUp"/>
      <menuitem name="MoveDown" action="MoveDown"/>
      <menuitem name="Remove" action="Remove"/>
Only the first separator shows, not the second !

Hmm, I don't know why it isn't showing. Is it showing the "Remove" menuitem?
It seems to work if I give each separator a diffrent name attribute

Yeah, someone else replied regarding that. It should work without that though.
It should be in bugzilla.

2. What's the <placeholder> for ?

placeholder is for menu merging. For example if you have 

"  <menubar name='MainMenu'>"
"    <menu name='FileMenu' action='FileMenu'>"
"      <menuitem action='New'/>"
"      <placeholder name='FileMenuAdditions'/>"
"      <menuitem action='Exit'/>"
"    </menu>"
"  </menubar>"

once you create a GtkUIManager etc with it. you can do something like

gtk_ui_manager_add_ui_from_string with a new string

  <menubar name='MainMenu'>
    <menu name='FileMenu' action='FileMenu'
    <placeholder name='FileMenuAdditions'/>
      <menuitem action='Save'/>

So the Save menuitem will show up after 'New' and before 'Exit' menuitem.

3. Constructing a menubar, how can I replace (and later
   reenable) an entire menu, say I want to replace
   a top "File" menu at a time, and later put it back.

after constructing GtkUIManager etc, you can do something like

GtkWidget *foo;
foo = gtk_ui_manager_get_widget (ui_manager, "/MainMenu/FileMenu");
gtk_widget_hide (foo);

to hide the menu.
Ok, and now I can just add another menu where the "FileMenu" was ?

Well if you have a <placeholder thrown in there somewhere, it's easy.
Otherwise all new menus will be added at the end.



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