Re: Gtk::UIManager::add_ui - how to use this function

2014-01-30 16:44, Szőke Szabolcs skrev:
Hi list, I want to add standalone menuitems and remove them one by one later if needed. I want to use the add_ui function, but I cant translate my xml to match the add_ui's function parameters.

Here is my code snippet:

this->m_refActionGroup->add(Gtk::Action::create("TestMenu", "Test"));
this->m_refActionGroup->add(Gtk::Action::create("TestMenuEntry", Gtk::Stock::NEW, "Test"));
this->id = this->m_refUIManager->add_ui_from_string(
    " <menubar name='MenuBar'>"
    " <menu action=''>"
    " <menuitem action='' />"
    " </menu>"
    " </menubar>"

It works, but when I switch to add_ui function, it doesn't happen anything.

this->id = this->m_refUIManager->new_merge_id();
this->m_refUIManager->add_ui(this->id, "/ui/MenuBar", "TestMenu", "TestMenuEntry");

I can't find any good tutorial or documentation, so somebody could help me? Thanks.

I haven't used Gtk::UIManager::add_ui(), and I don't know of any examples, but I found these gtk+ tests that use gtk_ui_manager_add_ui():

These files are used by testmerge.c:

Hope this code can give you some hints how to use add_ui().


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