Hello am trying to write a program using gtkmm and ran into some problem, the was following the online tutorial on the gnome website. Although my program compiles and executes the menu bar is not being displayed, also shortcut key doesn’t work.
But I get a warning on the terminal Gtk-WARNING **: File: missing action File
Any pointers will helpful. Thank you
And this is the code for creating menu
mActionGroup = Gtk::ActionGroup::create();
mActionGroup->add(Gtk::Action::create("File", "_File"));
mActionGroup->add(
Gtk::Action::create( "Open", Gtk::Stock::OPEN, "_Open", "Open a file" ),
Gtk::AccelKey( "<control>o" ),
sigc::mem_fun( *this, &myWindow::onFileOpen ) );
std::string menuInfo =
std::string("<ui>")+
" <menubar name='MenuBar'>"+
" <menu action='File'>"+
" <menuitem action='Open'/>"+
" </menu>"+
" </menubar>"+
"</ui>";
mUIManager = Gtk::UIManager::create();
add_accel_group(mUIManager->get_accel_group());
try
{
mUIManager->add_ui_from_string( menuInfo );
}
catch( const Glib::Error &ex )
{
ERROR( "Could not create menu" << ex.what() )
}
Gtk::Widget *pMenu = mUIManager->get_widget( "/MenuBar" );
mBox.pack_start( *pMenu, Gtk::PACK_SHRINK );
show_all_children();
this is the Gtkmm package installed libgtkmm-3.0-dev:amd64
and I compile using pkg-config --libs gtkmm-3.0
this gives these libraries
-lgtkmm-3.0 -latkmm-1.6 -lgdkmm-3.0 -lgiomm-2.4 -lpangomm-1.4 -lgtk-3 -lglibmm-2.4
-lcairomm-1.0 -lgdk-3 -latk-1.0 -lgio-2.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo-gobject
-lpango-1.0 -lcairo -lsigc-2.0 -lgobject-2.0 -lglib-2.0
EDIT:
not sure how to check my gtkmm version but i searched the package name and got this marked as superseded [https://launchpad.net/ubuntu/saucy/amd64/libgtkmm-3.0-dev/3.6.0-0ubuntu1] so i think the version is 3.6