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

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.

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.



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