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(
"<ui>"
"<menubar name='MenuBar'>"
"<menu action='TestMenu'>"
"<menuitem action='TestMenuEntry' />"
"</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.
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():
https://git.gnome.org/browse/gtk+/tree/tests/testactions.c
https://git.gnome.org/browse/gtk+/tree/tests/testmerge.c
These files are used by testmerge.c:
https://git.gnome.org/browse/gtk+/tree/tests/merge-1.ui
https://git.gnome.org/browse/gtk+/tree/tests/merge-2.ui
https://git.gnome.org/browse/gtk+/tree/tests/merge-3.ui
Hope this code can give you some hints how to use add_ui().
Kjell
_______________________________________________
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list