Re: GtkUIManager questions.
- From: Archit Baweja <bighead users sourceforge net>
- To: "Nils O." SelÃsdal <noselasd frisurf no>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: GtkUIManager questions.
- Date: 28 Jun 2004 12:09:09 -0400
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.
None.
"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"/>
      <separator/>
      <menuitem name="MoveUp" action="MoveUp"/>
      <menuitem name="MoveDown" action="MoveDown"/>
      <separator/>
      <menuitem name="Remove" action="Remove"/>
  </popup>
</ui>
Only the first separator shows, not the second !
Hmm, I don't know why it isn't showing. Is it showing the "Remove" menuitem?
Yes.
It seems to work if I give each separator a diffrent name attribute
though.
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 
"<ui>"
"  <menubar name='MainMenu'>"
"    <menu name='FileMenu' action='FileMenu'>"
"      <menuitem action='New'/>"
"      <placeholder name='FileMenuAdditions'/>"
"      <menuitem action='Exit'/>"
"    </menu>"
"  </menubar>"
"</ui>"
once you create a GtkUIManager etc with it. you can do something like
gtk_ui_manager_add_ui_from_string with a new string
<ui>
  <menubar name='MainMenu'>
    <menu name='FileMenu' action='FileMenu'
    <placeholder name='FileMenuAdditions'/>
      <menuitem action='Save'/>
    </placeholder>
    </menu>
  </menubar>
</ui>
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.
Regards
Archit
-- 
Homepage: http://puggy.symonds.net/~bighead/
Projects:
        http://peacock.sourceforge.net/
        http://ore.rubyforge.net/
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]