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



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(
    "<ui>"
    " <menubar name='MenuBar'>"
    " <menu action="">
    " <menuitem action="" />"
    " </menu>"
    " </menubar>"
    "</ui>");

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.


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