Re: GtkUIManager questions.



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"/>
      <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?


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.

4. Wouldn't a 
GtkActionGroup gtk_ui_manager_get_action_by_name(GtkUIManager *self,
                                             const gchar *name);
  be nice ?

I think ur looking.

GtkAction*  gtk_ui_manager_get_action       (GtkUIManager *self,
                                             const gchar *path);

Further info, read docs.
http://developer.gnome.org/doc/API/2.0/gtk/Actions.html

HTH
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]