[glom/gmenu] gmenu: More conversion to Gio::Menu



commit c4a8b22f92ff61c88b9bb923cd86e87fe4d687fa
Author: Murray Cumming <murrayc murrayc com>
Date:   Sat Sep 14 11:33:19 2013 +0200

    gmenu: More conversion to Gio::Menu
    
    Convert the main menu, and some of the context menus.

 glom/appwindow.cc                                  |  899 +++++++++++---------
 glom/appwindow.h                                   |   46 +-
 glom/frame_glom.cc                                 |  157 ++--
 glom/frame_glom.h                                  |    7 +-
 glom/mode_data/box_data_calendar_related.cc        |   62 +-
 glom/mode_data/box_data_calendar_related.h         |   10 +-
 glom/mode_data/datawidget/checkbutton.cc           |    3 +-
 glom/mode_data/datawidget/combo.cc                 |    2 +-
 .../mode_data/datawidget/combo_as_radio_buttons.cc |    2 +-
 glom/mode_data/datawidget/datawidget.cc            |    3 +-
 glom/mode_data/datawidget/entry.cc                 |   13 +-
 glom/mode_data/datawidget/textview.cc              |    2 +-
 glom/mode_data/db_adddel/db_adddel.cc              |  107 ++-
 glom/mode_data/db_adddel/db_adddel.h               |   12 +-
 glom/mode_data/db_adddel/db_adddel_withbuttons.cc  |    2 +-
 .../print_layouts/window_print_layout_edit.cc      |    2 +-
 .../dialog_relationships_overview.cc               |    4 +-
 glom/print_layout/canvas_print_layout.cc           |    2 +-
 glom/utility_widgets/adddel/adddel.cc              |    6 +-
 glom/utility_widgets/adddel/adddel.h               |    2 +-
 glom/utility_widgets/adddel/adddel_withbuttons.cc  |    2 +-
 .../utility_widgets/canvas/test_canvas_editable.cc |    2 +-
 glom/utility_widgets/imageglom.cc                  |    4 +-
 glom/utility_widgets/layoutwidgetmenu.cc           |  142 ++-
 glom/utility_widgets/layoutwidgetmenu.h            |   22 +-
 glom/utility_widgets/layoutwidgetutils.cc          |    2 +-
 glom/utility_widgets/notebookglom.cc               |   14 +-
 glom/utility_widgets/notebooklabelglom.cc          |    6 +-
 glom/utility_widgets/notebooklabelglom.h           |    3 +-
 29 files changed, 833 insertions(+), 707 deletions(-)
---
diff --git a/glom/appwindow.cc b/glom/appwindow.cc
index 9b15f86..15a5234 100644
--- a/glom/appwindow.cc
+++ b/glom/appwindow.cc
@@ -38,8 +38,8 @@
 #include <glom/python_embed/python_ui_callbacks.h>
 #include <glom/python_embed/glom_python.h>
 #include <libglom/spawn_with_feedback.h>
+#include <giomm/menu.h>
 
-#include <gtkmm/radioaction.h>
 #include <gtkmm/main.h>
 
 #include <cstdio>
@@ -77,6 +77,7 @@ const bool AppWindow::glade_developer(false);
 AppWindow::AppWindow(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& builder)
 : GlomBakery::AppWindow_WithDoc("Glom"),
   Gtk::ApplicationWindow(cobject), 
+  m_menubar(0),
   m_pVBox(0),
   m_VBox_PlaceHolder(Gtk::ORIENTATION_VERTICAL),
   m_pBoxTop(0),
@@ -86,9 +87,6 @@ AppWindow::AppWindow(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>&
 #ifndef GLOM_ENABLE_CLIENT_ONLY
   m_window_translations(0),
 #endif // !GLOM_ENABLE_CLIENT_ONLY
-  m_menu_tables_ui_merge_id(0),
-  m_menu_reports_ui_merge_id(0),
-  m_menu_print_layouts_ui_merge_id(0),
 #ifndef GLOM_ENABLE_CLIENT_ONLY
   m_ui_save_extra_showextras(false),
   m_ui_save_extra_newdb_hosting_mode(Document::HOSTING_MODE_DEFAULT),
@@ -228,14 +226,10 @@ void AppWindow::set_stop_auto_server_shutdown(bool val)
 
 void AppWindow::init_layout()
 {
-  //We override this method so that we can put everything in the vbox from the glade file, instead of the 
vbox from AppWindow_Gtk.
-
   //Add menu bar at the top:
-  //These were defined in init_uimanager().
-  Gtk::MenuBar* pMenuBar = static_cast<Gtk::MenuBar*>(m_refUIManager->get_widget("/Bakery_MainMenu"));
-  m_pBoxTop->pack_start(*pMenuBar, Gtk::PACK_SHRINK);
+  m_pBoxTop->pack_start(*m_menubar, Gtk::PACK_SHRINK);
 
-  add_accel_group(m_refUIManager->get_accel_group());
+  //TODO? add_accel_group(m_builder_menu->get_accel_group());
 
   //Add placeholder, to be used by add():
   //m_pBoxTop->pack_start(m_VBox_PlaceHolder);
@@ -247,323 +241,436 @@ void AppWindow::init_menus_file()
   // File menu
 
   //Build actions:
-  m_refFileActionGroup = Gtk::ActionGroup::create("BakeryFileActions");
-
-  m_refFileActionGroup->add(Gtk::Action::create("BakeryAction_Menu_File", _("_File")));
+  m_refFileActionGroup = Gio::SimpleActionGroup::create();
 
   //File actions
-  m_refFileActionGroup->add(Gtk::Action::create("BakeryAction_File_New", _("_New")),
-                        sigc::mem_fun((AppWindow&)*this, &AppWindow::on_menu_file_new));
-  m_refFileActionGroup->add(Gtk::Action::create("BakeryAction_File_Open", _("_Open")),
-                        sigc::mem_fun((GlomBakery::AppWindow_WithDoc&)*this, 
&GlomBakery::AppWindow_WithDoc::on_menu_file_open));
-
-  Glib::RefPtr<Gtk::Action> action = Gtk::Action::create("BakeryAction_File_SaveAsExample", _("_Save as 
Example"));
-  m_listDeveloperActions.push_back(action);
+  m_refFileActionGroup->add_action("new",
+    sigc::mem_fun((AppWindow&)*this, &AppWindow::on_menu_file_new));
+  m_refFileActionGroup->add_action("open",
+    sigc::mem_fun((GlomBakery::AppWindow_WithDoc&)*this, &GlomBakery::AppWindow_WithDoc::on_menu_file_open));
 
+  Glib::RefPtr<Gio::SimpleAction> action;
 #ifndef GLOM_ENABLE_CLIENT_ONLY
-  m_refFileActionGroup->add(action,
-                        sigc::mem_fun((AppWindow&)*this, &AppWindow::on_menu_file_save_as_example));
+  action = m_refFileActionGroup->add_action("save-as-example",
+    sigc::mem_fun((AppWindow&)*this, &AppWindow::on_menu_file_save_as_example));
+  add_developer_action(action);
 
-  action = Gtk::Action::create("BakeryAction_Menu_File_Export", _("_Export"));
-  m_refFileActionGroup->add(action, sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_file_export));
+  action = m_refFileActionGroup->add_action("export",
+    sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_file_export));
   m_listTableSensitiveActions.push_back(action);
 
-  action = Gtk::Action::create("BakeryAction_Menu_File_Import", _("I_mport"));
-  m_refFileActionGroup->add(action, sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_file_import));
+  action = m_refFileActionGroup->add_action("import",
+    sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_file_import));
   m_listTableSensitiveActions.push_back(action);
-#endif // !GLOM_ENABLE_CLIENT_ONLY
 
-  m_toggleaction_network_shared = Gtk::ToggleAction::create("BakeryAction_Menu_File_Share", _("S_hared on 
Network"));
-  m_refFileActionGroup->add(m_toggleaction_network_shared);
+  m_toggleaction_network_shared = m_refFileActionGroup->add_action_bool("share",
+    sigc::mem_fun(*this, &AppWindow::on_menu_file_toggle_share) );
   m_listTableSensitiveActions.push_back(m_toggleaction_network_shared);
-
-#ifndef GLOM_ENABLE_CLIENT_ONLY
-  m_connection_toggleaction_network_shared =
-    m_toggleaction_network_shared->signal_toggled().connect(
-      sigc::mem_fun(*this, &AppWindow::on_menu_file_toggle_share) );
-  m_listDeveloperActions.push_back(m_toggleaction_network_shared);
 #endif //!GLOM_ENABLE_CLIENT_ONLY
 
-  action = Gtk::Action::create("GlomAction_Menu_File_Print", _("_Print"));
-  m_refFileActionGroup->add(action);
+  action = m_refFileActionGroup->add_action("print",
+    sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_file_print) );
   m_listTableSensitiveActions.push_back(action);
-  m_refFileActionGroup->add(Gtk::Action::create("GlomAction_File_Print", _("_Standard")),
-                        sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_file_print) );
+
 
 #ifndef GLOM_ENABLE_CLIENT_ONLY
-  Glib::RefPtr<Gtk::Action> action_print_edit = Gtk::Action::create("GlomAction_File_PrintEdit", _("_Edit 
Print Layouts"));
-  m_refFileActionGroup->add(action_print_edit, sigc::mem_fun(*m_pFrame, 
&Frame_Glom::on_menu_file_print_edit_layouts));
+  Glib::RefPtr<Gio::SimpleAction> action_print_edit =
+    m_refFileActionGroup->add_action("edit-print-layouts",
+      sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_file_print_edit_layouts));
   m_listDeveloperActions.push_back(action_print_edit);
 #endif // !GLOM_ENABLE_CLIENT_ONLY
 
-  m_refFileActionGroup->add(Gtk::Action::create("BakeryAction_File_Close", _("_Close")),
-                        sigc::mem_fun((GlomBakery::AppWindow_WithDoc&)*this, 
&GlomBakery::AppWindow_WithDoc::on_menu_file_close));
+  m_refFileActionGroup->add_action("close",
+    sigc::mem_fun((GlomBakery::AppWindow_WithDoc&)*this, 
&GlomBakery::AppWindow_WithDoc::on_menu_file_close));
 
-  m_refUIManager->insert_action_group(m_refFileActionGroup);
+  insert_action_group("file", m_refFileActionGroup);
 }
 
 void AppWindow::init_menus()
 {
-  m_refUIManager = Gtk::UIManager::create();
+  m_builder_menu = Gtk::Builder::create();
 
   init_menus_file();
   init_menus_edit();
 
 
   //Build actions:
-  m_refActionGroup_Others = Gtk::ActionGroup::create("GlomOthersActions");
-
-  //"Tables" menu:
-  m_refActionGroup_Others->add( Gtk::Action::create("Glom_Menu_Tables", _("_Tables")) );
-
-//  Glib::RefPtr<Gtk::Action> action = Gtk::Action::create("GlomAction_Menu_Navigate_Database", 
_("_Database"));
-//  m_listDeveloperActions.push_back(action);
-//  m_refActionGroup_Others->add(action,
-//                        sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_Navigate_Database) );
+  m_refActionGroup_Tables = Gio::SimpleActionGroup::create();
 
-  Glib::RefPtr<Gtk::Action> action;
+  Glib::RefPtr<Gio::SimpleAction> action;
 
 #ifndef GLOM_ENABLE_CLIENT_ONLY
-  action = Gtk::Action::create("GlomAction_Menu_EditTables", _("_Edit Tables"));
-  m_refActionGroup_Others->add(action,
-                        sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_Tables_EditTables) );
+  action = m_refActionGroup_Tables->add_action("edit-tables",
+    sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_Tables_EditTables) );
   m_listDeveloperActions.push_back(action);
 
 /* Commented out because it is useful but confusing to new users:
-  action = Gtk::Action::create("GlomAction_Menu_AddRelatedTable", _("Add _Related Table"));
-  m_refActionGroup_Others->add(action,
-                        sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_Tables_AddRelatedTable) );
+  action = m_refActionGroup_Tables->add_action("GlomAction_Menu_AddRelatedTable", //_("Add _Related Table"));
+    sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_Tables_AddRelatedTable) );
   m_listDeveloperActions.push_back(action);
 */
 #endif // !GLOM_ENABLE_CLIENT_ONLY
 
+  insert_action_group("tables", m_refActionGroup_Tables);
+
+
   //"Reports" menu:
-  m_refActionGroup_Others->add( Gtk::Action::create("Glom_Menu_Reports", _("_Reports")) );
+  m_refActionGroup_Reports = Gio::SimpleActionGroup::create();
 
 #ifndef GLOM_ENABLE_CLIENT_ONLY
-  action = Gtk::Action::create("GlomAction_Menu_EditReports", _("_Edit Reports"));
-  m_refActionGroup_Others->add(action,
-                        sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_Reports_EditReports) );
+  m_refActionGroup_Reports->add_action("GlomAction_Menu_EditReports",
+    sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_Reports_EditReports) );
   m_listDeveloperActions.push_back(action);
   m_listTableSensitiveActions.push_back(action);
 #endif
 
-  //We remember this action, so that it can be explicitly activated later.
-  m_action_mode_find = Gtk::ToggleAction::create("GlomAction_Menu_Edit_Find", _("_Find"), "", false);
-  m_refActionGroup_Others->add(m_action_mode_find,  Gtk::AccelKey("<control>F"),
-                        sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_Edit_Find) );
-  m_listTableSensitiveActions.push_back(m_action_mode_find);
+  insert_action_group("reports", m_refActionGroup_Developer);
 
-#ifndef GLOM_ENABLE_CLIENT_ONLY
-  action = Gtk::Action::create("Glom_Menu_Developer", C_("Developer menu title", "_Developer"));
-  m_refActionGroup_Others->add(action);
 
+  //Edit menu:
+  m_refActionGroup_Edit = Gio::SimpleActionGroup::create();
 
-  Gtk::RadioAction::Group group_userlevel;
+  //We remember this action, so that it can be explicitly activated later.
+  m_action_mode_find = m_refActionGroup_Edit->add_action("GlomAction_Menu_Edit_Find", //TODO: 
Gtk::AccelKey("<control>F"),
+    sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_Edit_Find) );
+  m_listTableSensitiveActions.push_back(m_action_mode_find);
 
-  m_action_menu_developer_developer = Gtk::RadioAction::create(group_userlevel, 
"GlomAction_Menu_Developer_Developer", _("_Developer Mode"));
-  m_refActionGroup_Others->add(m_action_menu_developer_developer,
-                        sigc::mem_fun(*this, &AppWindow::on_menu_developer_developer) );
+  insert_action_group("edit", m_refActionGroup_Developer);
 
-  m_action_menu_developer_operator =  Gtk::RadioAction::create(group_userlevel, 
"GlomAction_Menu_Developer_Operator", _("_Operator Mode"));
-  m_refActionGroup_Others->add(m_action_menu_developer_operator,
-                          sigc::mem_fun(*this, &AppWindow::on_menu_developer_operator) );
 
+  //Developer menu:
+  m_refActionGroup_Developer = Gio::SimpleActionGroup::create();
 
-  action = Gtk::Action::create("GlomAction_Menu_Developer_Database_Preferences", _("_Database Preferences"));
-  m_listDeveloperActions.push_back(action);
-  m_refActionGroup_Others->add(action, sigc::mem_fun(*m_pFrame, 
&Frame_Glom::on_menu_developer_database_preferences) );
+#ifndef GLOM_ENABLE_CLIENT_ONLY
+  m_action_menu_developer_usermode =
+    m_refActionGroup_Developer->add_action_radio_integer("usermode",
+      sigc::mem_fun(*this, &AppWindow::on_menu_developer_usermode),
+      AppState::USERLEVEL_OPERATOR );
 
+  action = m_refActionGroup_Developer->add_action("database-preferences",
+    sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_developer_database_preferences) );
+  m_listDeveloperActions.push_back(action);
 
-  action = Gtk::Action::create("GlomAction_Menu_Developer_Fields", _("_Fields"));
+  action = m_refActionGroup_Developer->add_action("fields",
+   sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_developer_fields) );
   m_listDeveloperActions.push_back(action);
   m_listTableSensitiveActions.push_back(action);
-  m_refActionGroup_Others->add(action, sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_developer_fields) );
 
-  action = Gtk::Action::create("GlomAction_Menu_Developer_RelationshipsOverview", _("Relationships 
_Overview"));
+  action = m_refActionGroup_Developer->add_action("relationships-overview",
+    sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_developer_relationships_overview) );
   m_listDeveloperActions.push_back(action);
   m_listTableSensitiveActions.push_back(action);
-  m_refActionGroup_Others->add(action, sigc::mem_fun(*m_pFrame, 
&Frame_Glom::on_menu_developer_relationships_overview) );
 
-  action = Gtk::Action::create("GlomAction_Menu_Developer_Relationships", _("_Relationships for this 
Table"));
+  action = m_refActionGroup_Developer->add_action("relationships",
+    sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_developer_relationships) );
   m_listDeveloperActions.push_back(action);
   m_listTableSensitiveActions.push_back(action);
-  m_refActionGroup_Others->add(action, sigc::mem_fun(*m_pFrame, 
&Frame_Glom::on_menu_developer_relationships) );
 
-  m_action_developer_users = Gtk::Action::create("GlomAction_Menu_Developer_Users", _("_Users"));
+  m_action_developer_users = m_refActionGroup_Developer->add_action("users",
+    sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_developer_users));
   m_listDeveloperActions.push_back(m_action_developer_users);
-  m_refActionGroup_Others->add(m_action_developer_users, sigc::mem_fun(*m_pFrame, 
&Frame_Glom::on_menu_developer_users));
 
-  action = Gtk::Action::create("GlomAction_Menu_Developer_PrintLayouts", _("_Print Layouts")); //TODO: 
Rename? This looks like an action rather than a noun. It won't actually start printing.
+  action = m_refActionGroup_Developer->add_action("print-layouts",
+    sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_developer_print_layouts));
   m_listDeveloperActions.push_back(action);
   m_listTableSensitiveActions.push_back(action);
-  m_refActionGroup_Others->add(action, sigc::mem_fun(*m_pFrame, 
&Frame_Glom::on_menu_developer_print_layouts));
 
-  action = Gtk::Action::create("GlomAction_Menu_Developer_Reports", _("R_eports"));
+  action = m_refActionGroup_Developer->add_action("reports",
+    sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_developer_reports));
   m_listDeveloperActions.push_back(action);
   m_listTableSensitiveActions.push_back(action);
-  m_refActionGroup_Others->add(action, sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_developer_reports));
 
-  action = Gtk::Action::create("GlomAction_Menu_Developer_Script_Library", _("Script _Library"));
+  action = m_refActionGroup_Developer->add_action("script-library",
+    sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_developer_script_library));
   m_listDeveloperActions.push_back(action);
-  m_refActionGroup_Others->add(action, sigc::mem_fun(*m_pFrame, 
&Frame_Glom::on_menu_developer_script_library));
-
 
-  action = Gtk::Action::create("GlomAction_Menu_Developer_Layout", _("_Layout"));
+  action = m_refActionGroup_Developer->add_action("layout",
+    sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_developer_layout));
   m_listDeveloperActions.push_back(action);
   m_listTableSensitiveActions.push_back(action);
-  m_refActionGroup_Others->add(action, sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_developer_layout));
 
-  action = Gtk::Action::create("GlomAction_Menu_Developer_ChangeLanguage", _("Test Tra_nslation"));
+  action = m_refActionGroup_Developer->add_action("change-language",
+    sigc::mem_fun(*this, &AppWindow::on_menu_developer_changelanguage));
   m_listDeveloperActions.push_back(action);
-  m_refActionGroup_Others->add(action, sigc::mem_fun(*this, &AppWindow::on_menu_developer_changelanguage));
 
-  action = Gtk::Action::create("GlomAction_Menu_Developer_Translations", _("_Translations"));
+  action = m_refActionGroup_Developer->add_action("translations",
+    sigc::mem_fun(*this, &AppWindow::on_menu_developer_translations));
   m_listDeveloperActions.push_back(action);
-  m_refActionGroup_Others->add(action, sigc::mem_fun(*this, &AppWindow::on_menu_developer_translations));
-
 
   //"Active Platform" menu:
-  action =  Gtk::Action::create("Glom_Menu_Developer_ActivePlatform", _("_Active Platform"));
-  m_listDeveloperActions.push_back(action);
-  m_refActionGroup_Others->add(action);
-  Gtk::RadioAction::Group group_active_platform;
-
-  action = Gtk::RadioAction::create(group_active_platform, "GlomAction_Menu_Developer_ActivePlatform_Normal",
-    _("_Normal"), _("The layout to use for normal desktop environments."));
+  action = m_refActionGroup_Developer->add_action_radio_integer("active-platform",
+    sigc::mem_fun(*this, &AppWindow::on_menu_developer_active_platform),
+    0); //TODO: No magic number
   m_listDeveloperActions.push_back(action);
-  m_refActionGroup_Others->add(action, sigc::mem_fun(*this, 
&AppWindow::on_menu_developer_active_platform_normal));
 
-  action = Gtk::RadioAction::create(group_active_platform, "GlomAction_Menu_Developer_ActivePlatform_Maemo",
-    _("_Maemo"), _("The layout to use for Maemo devices."));
+  action = m_refActionGroup_Developer->add_action("export-backup",
+    sigc::mem_fun(*this, &AppWindow::on_menu_developer_export_backup));
   m_listDeveloperActions.push_back(action);
-  m_refActionGroup_Others->add(action, sigc::mem_fun(*this, 
&AppWindow::on_menu_developer_active_platform_maemo));
 
-
-  action = Gtk::Action::create("GlomAction_Menu_Developer_ExportBackup", _("_Export Backup"));
-  m_listDeveloperActions.push_back(action);
-  m_refActionGroup_Others->add(action, sigc::mem_fun(*this, &AppWindow::on_menu_developer_export_backup));
-
-  action = Gtk::Action::create("GlomAction_Menu_Developer_RestoreBackup", _("_Restore Backup"));
+  action = m_refActionGroup_Developer->add_action("restore-backup",
+    sigc::mem_fun(*this, &AppWindow::on_menu_developer_restore_backup));
   m_listDeveloperActions.push_back(action);
-  m_refActionGroup_Others->add(action, sigc::mem_fun(*this, &AppWindow::on_menu_developer_restore_backup));
 
   //TODO: Think of a better name for this menu item,
   //though it mostly only exists because it is not quite ready to be on by default:
   //Note to translators: Drag and Drop is part of the name, not a verb or action:
-  m_action_enable_layout_drag_and_drop = 
Gtk::ToggleAction::create("GlomAction_Menu_Developer_EnableLayoutDragAndDrop", _("_Drag and Drop Layout"));
+  m_action_enable_layout_drag_and_drop =
+    m_refActionGroup_Developer->add_action_bool("drag-and-drop-layout",
+      sigc::mem_fun(*this, &AppWindow::on_menu_developer_enable_layout_drag_and_drop));
   m_listDeveloperActions.push_back(m_action_enable_layout_drag_and_drop);
-  m_refActionGroup_Others->add(m_action_enable_layout_drag_and_drop, sigc::mem_fun(*this, 
&AppWindow::on_menu_developer_enable_layout_drag_and_drop));
 
 #endif // !GLOM_ENABLE_CLIENT_ONLY
 
-  m_refUIManager->insert_action_group(m_refActionGroup_Others);
-  
-  action = Gtk::Action::create("Glom_Menu_Help", C_("Help menu title", "_Help"));
-  m_refActionGroup_Others->add(action);
-  
-  m_refHelpActionGroup = Gtk::ActionGroup::create("GlomHelpActions");
-  m_refHelpActionGroup->add(Gtk::Action::create("GlomAction_Menu_Help", _("_Help")));
+  insert_action_group("developer", m_refActionGroup_Developer);
+
   
-  m_refHelpActionGroup->add( Gtk::Action::create("GlomAction_Menu_Help_About",
-                        _("_About"), _("About the application")),
-                        sigc::mem_fun(*this, &AppWindow::on_menu_help_about) );
-  m_refHelpActionGroup->add( Gtk::Action::create("GlomAction_Menu_Help_Contents",
-                        _("_Contents"), _("Help with the application")),
-                        sigc::mem_fun(*this, &AppWindow::on_menu_help_contents) );
-  m_refUIManager->insert_action_group(m_refHelpActionGroup);                       
-
-
-  //This is just a skeleton structure.
-  //The placeholders allow us to merge the menus and toolbars in later,
-  //by adding a us string with one of the placeholders, but with menu items underneath it.
+  m_refHelpActionGroup = Gio::SimpleActionGroup::create();
+ 
+  m_refHelpActionGroup->add_action("about",
+    sigc::mem_fun(*this, &AppWindow::on_menu_help_about) );
+  m_refHelpActionGroup->add_action("contents",
+    sigc::mem_fun(*this, &AppWindow::on_menu_help_contents) );
+  insert_action_group("help", m_refHelpActionGroup);                       
+
+
+  //The placeholders allow us to merge menu items in later:
   static const Glib::ustring ui_description =
-    "<ui>"
-    "  <menubar name='Bakery_MainMenu'>"
-    "    <menu action='BakeryAction_Menu_File'>"
-    "      <menuitem action='BakeryAction_File_New' />"
-    "      <menuitem action='BakeryAction_File_Open' />"
+    "<interface>"
+    "  <menu id='mainmenu'>"
+    "    <submenu>"
+    "      <attribute name='label' translatable='yes'>_File</attribute>"
+    "      <section>"
+    "        <item>"
+    "          <attribute name='label' translatable='yes'>_New</attribute>"
+    "          <attribute name='action'>file.new</attribute>"
+    "        </item>"
+    "        <item>"
+    "          <attribute name='label' translatable='yes'>_Open</attribute>"
+    "          <attribute name='action'>file.open</attribute>"
+    "        </item>"
 #ifndef GLOM_ENABLE_CLIENT_ONLY
-    "      <menuitem action='BakeryAction_File_SaveAsExample' />"
-    "      <separator/>"
-    "      <menuitem action='BakeryAction_Menu_File_Export' />"
-    "      <menuitem action='BakeryAction_Menu_File_Import' />"
-    "      <menuitem action='BakeryAction_Menu_File_Share' />"
-#endif // !GLOM_ENABLE_CLIENT_ONLY
-    "      <separator/>"
-    "      <menu action='GlomAction_Menu_File_Print'>"
-    "        <menuitem action='GlomAction_File_Print' />"
-    "        <placeholder name='Menu_PrintLayouts_Dynamic' />"
+    "        <item>"
+    "          <attribute name='label' translatable='yes'>_Save as Example</attribute>"
+    "          <attribute name='action'>file.save-as-example</attribute>"
+    "        </item>"
+#endif // GLOM_ENABLE_CLIENT_ONLY
+    "      </section>"
+#ifndef GLOM_ENABLE_CLIENT_ONLY
+    "      <section>"
+    "        <item>"
+    "          <attribute name='label' translatable='yes'>_Export</attribute>"
+    "          <attribute name='action'>file.export</attribute>"
+    "        </item>"
+    "        <item>"
+    "          <attribute name='label' translatable='yes'>I_mport</attribute>"
+    "          <attribute name='action'>file.import</attribute>"
+    "        </item>"
+    "        <item>"
+    "          <attribute name='label' translatable='yes'>S_hared on Network</attribute>"
+    "          <attribute name='action'>file.share</attribute>"
+    "        </item>"
+    "      </section>"
+#endif // GLOM_ENABLE_CLIENT_ONLY
+    "      <submenu>"
+    "        <attribute name='label' translatable='yes'>_Print</attribute>"
+    "        <section id='print-layouts-list'/>"
 #ifndef GLOM_ENABLE_CLIENT_ONLY
-    "        <menuitem action='GlomAction_File_PrintEdit' />"
+    "        <section>"
+    "          <item>"
+    "            <attribute name='label' translatable='yes'>_Edit Print Layouts</attribute>"
+    "            <attribute name='action'>file.edit-print-layouts</attribute>"
+    "          </item>"
+    "        </section>"
 #endif //GLOM_ENABLE_CLIENT_ONLY
-    "      </menu>"
-    "      <separator/>"
-    "      <menuitem action='BakeryAction_File_Close' />"
-    "    </menu>"
-   "     <menu action='BakeryAction_Menu_Edit'>"
-    "      <menuitem action='BakeryAction_Edit_Cut' />"
-    "      <menuitem action='BakeryAction_Edit_Copy' />"
-    "      <menuitem action='BakeryAction_Edit_Paste' />"
-    "      <menuitem action='BakeryAction_Edit_Clear' />"
-    "      <separator />"
-    "      <menuitem action='GlomAction_Menu_Edit_Find' />"
-    "    </menu>"
-    "    <menu action='Glom_Menu_Tables'>"
-    "      <placeholder name='Menu_Tables_Dynamic' />"
-    "      <separator />"
+    "      </submenu>"
+    "      <section>"
+    "        <item>"
+    "          <attribute name='label' translatable='yes'>_Close</attribute>"
+    "          <attribute name='action'>file.close</attribute>"
+    "        </item>"
+    "      </section>"
+    "    </submenu>"
+    "    <submenu>"
+    "      <attribute name='label' translatable='yes'>_Edit</attribute>"
+    "      <section>"
+    "        <item>"
+    "          <attribute name='label' translatable='yes'>Cu_t</attribute>"
+    "          <attribute name='action'>edit.cut</attribute>"
+    "        </item>"
+    "        <item>"
+    "          <attribute name='label' translatable='yes'>_Copy</attribute>"
+    "          <attribute name='action'>edit.copy</attribute>"
+    "        </item>"
+    "        <item>"
+    "          <attribute name='label' translatable='yes'>_Paste</attribute>"
+    "          <attribute name='action'>edit.paste</attribute>"
+    "        </item>"
+    "        <item>"
+    "          <attribute name='label' translatable='yes'>_Clear</attribute>"
+    "          <attribute name='action'>edit.clear</attribute>"
+    "        </item>"
+    "      </section>"
+    "      <section>"
+    "        <item>"
+    "          <attribute name='label' translatable='yes'>_Find</attribute>"
+    "          <attribute name='action'>edit.find</attribute>"
+    "        </item>"
+    "      </section>"
+    "    </submenu>"
+    "    <submenu id='tables'>"
+    "      <attribute name='label' translatable='yes'>_Tables</attribute>"
+    "      <section id='tables-list'/>"
 #ifndef GLOM_ENABLE_CLIENT_ONLY
-    "      <menuitem action='GlomAction_Menu_EditTables' />"
-/* Commented out because it is useful but confusing to new users:
-    "      <menuitem action='GlomAction_Menu_AddRelatedTable' />"
-*/
-#endif // !GLOM_ENABLE_CLIENT_ONLY
-    "   </menu>"
-    "   <menu action='Glom_Menu_Reports'>"
-    "      <placeholder name='Menu_Reports_Dynamic' />"
+    "      <section>"
+    "        <item>"
+    "          <attribute name='label' translatable='yes'>_Edit Tables</attribute>"
+    "          <attribute name='action'>tables.edit-tables</attribute>"
+    "        </item>"
+    "      </section>"
+#endif //GLOM_ENABLE_CLIENT_ONLY
+    "    </submenu>"
+    "    <submenu>"
+    "      <attribute name='label' translatable='yes'>R_eports</attribute>"
+    "      <section id='reports-list'/>"
 #ifndef GLOM_ENABLE_CLIENT_ONLY
-    "      <separator />"
-    "      <menuitem action='GlomAction_Menu_EditReports' />"
-#endif // !GLOM_ENABLE_CLIENT_ONLY
-    "   </menu>"
+    "      <section>"
+    "        <item>"
+    "          <attribute name='label' translatable='yes'>_Edit Reports</attribute>"
+    "          <attribute name='action'>reports.edit-reports</attribute>"
+    "        </item>"
+    "      </section>"
+#endif //GLOM_ENABLE_CLIENT_ONLY
+    "    </submenu>"
 #ifndef GLOM_ENABLE_CLIENT_ONLY
-    "    <menu action='Glom_Menu_Developer'>"
-    "      <menuitem action='GlomAction_Menu_Developer_Operator' />"
-    "      <menuitem action='GlomAction_Menu_Developer_Developer' />"
-    "      <separator />"
-    "      <menuitem action='GlomAction_Menu_Developer_Fields' />"
-    "      <menuitem action='GlomAction_Menu_Developer_Relationships' />"
-    "      <menuitem action='GlomAction_Menu_Developer_RelationshipsOverview' />"
-    "      <menuitem action='GlomAction_Menu_Developer_Layout' />"
-    "      <menuitem action='GlomAction_Menu_Developer_PrintLayouts' />"
-    "      <menuitem action='GlomAction_Menu_Developer_Reports' />"
-    "      <separator />"
-    "      <menuitem action='GlomAction_Menu_Developer_Database_Preferences' />"
-    "      <menuitem action='GlomAction_Menu_Developer_Users' />"
-    "      <menuitem action='GlomAction_Menu_Developer_Script_Library' />"
-    "      <separator />"
-    "      <menuitem action='GlomAction_Menu_Developer_Translations' />"
-    "      <menuitem action='GlomAction_Menu_Developer_ChangeLanguage' />"
-    "      <separator />"
-    "      <menu action='Glom_Menu_Developer_ActivePlatform'>"
-    "        <menuitem action='GlomAction_Menu_Developer_ActivePlatform_Normal' />"
-    "        <menuitem action='GlomAction_Menu_Developer_ActivePlatform_Maemo' />"
-    "      </menu>"
-    "      <menuitem action='GlomAction_Menu_Developer_EnableLayoutDragAndDrop' />"
-    "      <separator />"
-    "      <menuitem action='GlomAction_Menu_Developer_ExportBackup' />"
-    "      <menuitem action='GlomAction_Menu_Developer_RestoreBackup' />"
-    "    </menu>"
+    "    <submenu>"
+    "      <attribute name='label' translatable='yes'>_Developer</attribute>"
+    "      <section>"
+    "        <item>"
+    "          <attribute name='label' translatable='yes'>_Operator</attribute>"
+    "          <attribute name='action'>developer.usermode</attribute>"
+    "          <attribute name='target' type='i'>0</attribute>"
+    "        </item>"
+    "        <item>"
+    "          <attribute name='label' translatable='yes'>_Developer</attribute>"
+    "          <attribute name='action'>developer.usermode</attribute>"
+    "          <attribute name='target' type='i'>1</attribute>"
+    "        </item>"
+    "      </section>"
+    "      <section>"
+    "        <item>"
+    "          <attribute name='label' translatable='yes'>_Fields</attribute>"
+    "          <attribute name='action'>developer.fields</attribute>"
+    "        </item>"
+    "        <item>"
+    "          <attribute name='label' translatable='yes'>_Relationships</attribute>"
+    "          <attribute name='action'>developer.relationships</attribute>"
+    "        </item>"
+    "        <item>"
+    "          <attribute name='label' translatable='yes'>Relationships _Overview</attribute>"
+    "          <attribute name='action'>developer.relationships-overview</attribute>"
+    "        </item>"
+    "        <item>"
+    "          <attribute name='label' translatable='yes'>_Layout</attribute>"
+    "          <attribute name='action'>developer.layout</attribute>"
+    "        </item>"
+    "        <item>"
+    "          <attribute name='label' translatable='yes'>_Print Layouts</attribute>"
+    "          <attribute name='action'>developer.print-layouts</attribute>"
+    "        </item>"
+    "        <item>"
+    "          <attribute name='label' translatable='yes'>_Reports</attribute>"
+    "          <attribute name='action'>developer.reports</attribute>"
+    "        </item>"
+    "      </section>"
+    "      <section>"
+    "        <item>"
+    "          <attribute name='label' translatable='yes'>_Database Preferences</attribute>"
+    "          <attribute name='action'>developer.database-preferences</attribute>"
+    "        </item>"
+    "        <item>"
+    "          <attribute name='label' translatable='yes'>_Users</attribute>"
+    "          <attribute name='action'>developer.users</attribute>"
+    "        </item>"
+    "        <item>"
+    "          <attribute name='label' translatable='yes'>Script _Library</attribute>"
+    "          <attribute name='action'>developer.script-library</attribute>"
+    "        </item>"
+    "      </section>"
+    "      <section>"
+    "        <item>"
+    "          <attribute name='label' translatable='yes'>_Translations</attribute>"
+    "          <attribute name='action'>developer.translations</attribute>"
+    "        </item>"
+    "        <item>"
+    "          <attribute name='label' translatable='yes'>Test Tra_nslation</attribute>"
+    "          <attribute name='action'>developer.change-language</attribute>"
+    "        </item>"
+    "      </section>"
+    "      <section>"
+    "      <submenu>"
+    "        <attribute name='label' translatable='yes'>Active Platform</attribute>"
+    "        <item>"
+    "         <attribute name='label' translatable='yes'>_Normal</attribute>" //TODO: _("The layout to use 
for normal desktop environments."));
+    "          <attribute name='action'>developer.active-platform</attribute>"
+    "          <attribute name='target' type='i'>0</attribute>"
+    "        </item>"
+    "        <item>"
+    "          <attribute name='label' translatable='yes'>_Maemo</attribute>" //TODO: This is obsolete 
//TODO: _("The layout to use for Maemo devices."));
+    "          <attribute name='action'>developer.active-platform</attribute>"
+    "          <attribute name='target' type='i'>1</attribute>"
+    "        </item>"
+    "      </submenu>"
+    "      <item>"
+    "        <attribute name='label' translatable='yes'>_Drag and Drop Layout</attribute>" //TODO: This is 
obsolete
+    "        <attribute name='action'>developer.drag-and-drop-layout</attribute>"
+    "      </item>"
+    "      </section>"
+    "      <section>"
+    "        <item>"
+    "          <attribute name='label' translatable='yes'>_Export Backup</attribute>"
+    "          <attribute name='action'>developer.export-backup</attribute>"
+    "        </item>"
+    "        <item>"
+    "          <attribute name='label' translatable='yes'>_Restore Backup</attribute>"
+    "          <attribute name='action'>developer.restore-backup</attribute>"
+    "        </item>"
+    "      </section>"
+    "    </submenu>"
 #endif // !GLOM_ENABLE_CLIENT_ONLY
-    "    <menu action='Glom_Menu_Help'>"
-    "      <menuitem action='GlomAction_Menu_Help_About' />"
-    "      <menuitem action='GlomAction_Menu_Help_Contents' />"
-    "    </menu>"
-    "  </menubar>"
-    "</ui>";
+    "    <submenu>"
+    "      <attribute name='label' translatable='yes'>_Help</attribute>"
+    "      <section>"
+    "        <item>"
+    "          <attribute name='label' translatable='yes'>_About</attribute>" //TODO: _("About the 
application")),
+    "          <attribute name='action'>help.about</attribute>"
+    "        </item>"
+    "        <item>"
+    "          <attribute name='label' translatable='yes'>_Contents</attribute>" //TODO: "Help with the 
application")
+    "          <attribute name='action'>help.contents</attribute>"
+    "        </item>"
+    "      </section>"
+    "    </submenu>"
+    "  </menu>"
+    "</interface>";
   
-  add_ui_from_string(ui_description);
+   try
+  {
+    m_builder_menu->add_from_string(ui_description);
+  }
+  catch(const Glib::Error& ex)
+  {
+    std::cerr << G_STRFUNC << ": building menus failed: " <<  ex.what() << std::endl;
+  }
+
+  Glib::RefPtr<Glib::Object> object =
+    m_builder_menu->get_object("mainmenu");
+  Glib::RefPtr<Gio::Menu> gmenu =
+    Glib::RefPtr<Gio::Menu>::cast_dynamic(object);
+  if(!gmenu)
+    g_warning("GMenu not found");
 
+  m_menubar = new Gtk::MenuBar(gmenu);
+  m_menubar->show();
 
 
   update_table_sensitive_ui();
@@ -624,25 +731,34 @@ void AppWindow::on_menu_file_toggle_share()
   if(!m_pFrame)
     return;
 
-  m_pFrame->on_menu_file_toggle_share(m_toggleaction_network_shared);
+  //The state is not changed automatically:
+  bool active = false;
+  m_toggleaction_network_shared->get_state(active);
+
+  const bool changed = m_pFrame->attempt_toggle_shared(!active);
+
+  if(changed)
+    m_toggleaction_network_shared->change_state(!active);
 }
 
-void AppWindow::on_menu_developer_developer()
+void AppWindow::on_menu_developer_usermode(int parameter)
 {
   if(!m_pFrame)
     return;
 
-  m_pFrame->on_menu_developer_developer(m_action_menu_developer_developer, m_action_menu_developer_operator);
-  m_pFrame->set_enable_layout_drag_and_drop(m_action_enable_layout_drag_and_drop->get_active());
-}
+  const bool developer = parameter == AppState::USERLEVEL_DEVELOPER;
 
-void AppWindow::on_menu_developer_operator()
-{
-  if(m_pFrame)
-  {
-    m_pFrame->on_menu_developer_operator(m_action_menu_developer_operator);
-    m_pFrame->set_enable_layout_drag_and_drop(false);
-  }
+  bool changed = false;
+  if(developer)
+    changed = m_pFrame->attempt_change_usermode_to_developer();
+  else
+    changed = m_pFrame->attempt_change_usermode_to_operator();
+
+  //Change the menu's state:
+  if(changed)
+    m_action_menu_developer_usermode->change_state(parameter);
+
+  m_pFrame->set_enable_layout_drag_and_drop(false);
 }
 #endif // !GLOM_ENABLE_CLIENT_ONLY
 
@@ -826,7 +942,6 @@ void AppWindow::open_browsed_document(const EpcServiceInfo* server, const Glib::
 #endif // !G_OS_WIN32
 
 #ifndef GLOM_ENABLE_CLIENT_ONLY
-//Copied from bakery:
 static bool uri_is_writable(const Glib::RefPtr<const Gio::File>& uri)
 {
   if(!uri)
@@ -1299,14 +1414,14 @@ void AppWindow::update_network_shared_ui()
   const bool shared = document->get_network_shared();
   //TODO: Our use of block() does not seem to work. The signal actually seems to be emitted some time later 
instead.
   m_connection_toggleaction_network_shared.block(); //Prevent signal handling.
-  m_toggleaction_network_shared->set_active(shared);
+  m_toggleaction_network_shared->change_state(shared);
 
   //Do not allow impossible changes:
   const Document::HostingMode hosting_mode = document->get_hosting_mode();
   if( (hosting_mode == Document::HOSTING_MODE_POSTGRES_CENTRAL) //Central hosting means that it must be 
shared on the network.
     || (hosting_mode == Document::HOSTING_MODE_SQLITE) ) //sqlite does not allow network sharing.
   {
-    m_toggleaction_network_shared->set_sensitive(false);
+    m_toggleaction_network_shared->set_enabled(false);
   }
 
   m_connection_toggleaction_network_shared.unblock();
@@ -1329,7 +1444,7 @@ void AppWindow::update_table_sensitive_ui()
 
   for(type_listActions::iterator iter = m_listTableSensitiveActions.begin(); iter != 
m_listTableSensitiveActions.end(); ++iter)
   {
-    Glib::RefPtr<Gtk::Action> action = *iter;
+    Glib::RefPtr<Gio::SimpleAction> action = *iter;
  
     bool sensitive = has_table;
 
@@ -1338,7 +1453,7 @@ void AppWindow::update_table_sensitive_ui()
     if(is_developer_item)
       sensitive = sensitive && (userlevel == AppState::USERLEVEL_DEVELOPER);
 
-    action->set_sensitive(sensitive);
+    action->set_enabled(sensitive);
   }
 }
 
@@ -1349,8 +1464,8 @@ void AppWindow::update_userlevel_ui()
   //Disable/Enable developer actions:
   for(type_listActions::iterator iter = m_listDeveloperActions.begin(); iter != 
m_listDeveloperActions.end(); ++iter)
   {
-    Glib::RefPtr<Gtk::Action> action = *iter;
-     action->set_sensitive( userlevel == AppState::USERLEVEL_DEVELOPER );
+    Glib::RefPtr<Gio::SimpleAction> action = *iter;
+     action->set_enabled( userlevel == AppState::USERLEVEL_DEVELOPER );
   }
 
   //Ensure table sensitive menus stay disabled if necessary.
@@ -1364,12 +1479,14 @@ void AppWindow::update_userlevel_ui()
     {
       sharedptr<SharedConnection> connection = ConnectionPool::get_and_connect();
       if(connection && 
!connection->get_gda_connection()->supports_feature(Gnome::Gda::CONNECTION_FEATURE_USERS))
-        m_action_developer_users->set_sensitive(false);
+        m_action_developer_users->set_enabled(false);
     }
   }
 
   //Make sure that the correct radio menu item is activated (the userlevel might have been set 
programmatically):
   //We only need to set/unset one, because the others are in the same radio group.
+  //TODO:
+  /*
   if(userlevel == AppState::USERLEVEL_DEVELOPER)
   {
     if(!m_action_menu_developer_developer->get_active())
@@ -1381,6 +1498,8 @@ void AppWindow::update_userlevel_ui()
       m_action_menu_developer_operator->set_active();
     // Remove the drag layout toolbar
   }
+  */
+  
 }
 #endif // !GLOM_ENABLE_CLIENT_ONLY
 
@@ -1549,7 +1668,7 @@ void AppWindow::set_mode_data()
     return;
 
   if (m_pFrame->m_Mode == Frame_Glom::MODE_Find)
-    m_action_mode_find->activate();
+    m_action_mode_find->change_state(true);
 }
 
 void AppWindow::set_mode_find()
@@ -1558,7 +1677,7 @@ void AppWindow::set_mode_find()
     return;
 
   if (m_pFrame->m_Mode == Frame_Glom::MODE_Data)
-    m_action_mode_find->activate();
+    m_action_mode_find->change_state(true);
 }
 
 void AppWindow::on_menu_help_contents()
@@ -1922,7 +2041,8 @@ AppState::userlevels AppWindow::get_userlevel() const
 }
 
 #ifndef GLOM_ENABLE_CLIENT_ONLY
-void AppWindow::add_developer_action(const Glib::RefPtr<Gtk::Action>& refAction)
+
+void AppWindow::add_developer_action(const Glib::RefPtr<Gio::SimpleAction>& refAction)
 {
   //Prevent it from being added twice:
   remove_developer_action(refAction);
@@ -1930,7 +2050,7 @@ void AppWindow::add_developer_action(const Glib::RefPtr<Gtk::Action>& refAction)
   m_listDeveloperActions.push_back(refAction);
 }
 
-void AppWindow::remove_developer_action(const Glib::RefPtr<Gtk::Action>& refAction)
+void AppWindow::remove_developer_action(const Glib::RefPtr<Gio::SimpleAction>& refAction)
 {
   for(type_listActions::iterator iter = m_listDeveloperActions.begin(); iter != 
m_listDeveloperActions.end(); ++iter)
   {
@@ -1941,29 +2061,39 @@ void AppWindow::remove_developer_action(const Glib::RefPtr<Gtk::Action>& refActi
     }
   }
 }
+
 #endif // !GLOM_ENABLE_CLIENT_ONLY
 
 void AppWindow::fill_menu_tables()
 {
-  //TODO: There must be a better way than building a ui_string like this:
-
   m_listNavTableActions.clear();
-  if(m_menu_tables_ui_merge_id)
-    m_refUIManager->remove_ui(m_menu_tables_ui_merge_id);
+  //TODO: Clear existing items
 
   if(m_refNavTablesActionGroup)
   {
-    m_refUIManager->remove_action_group(m_refNavTablesActionGroup);
+    //TODO? m_builder_menu->remove_action_group(m_refNavTablesActionGroup);
     m_refNavTablesActionGroup.reset();
   }
 
-  m_refNavTablesActionGroup = Gtk::ActionGroup::create("NavTablesActions");
+  m_refNavTablesActionGroup = Gio::SimpleActionGroup::create();
 
-  Glib::ustring ui_description =
-    "<ui>"
-    "  <menubar name='Bakery_MainMenu'>"
-    "    <menu action='Glom_Menu_Tables'>"
-    "      <placeholder name='Menu_Tables_Dynamic'>";
+  Glib::RefPtr<Glib::Object> object =
+    m_builder_menu->get_object("tables-list");
+  Glib::RefPtr<Gio::Menu> menu =
+    Glib::RefPtr<Gio::Menu>::cast_dynamic(object);
+  if(!menu)
+  {
+    std::cerr << G_STRFUNC << ": GMenu not found" << std::endl;
+    return;
+  }
+
+  //TODO: Add API for this?
+  while(menu->get_n_items())
+  {
+    menu->remove(0);
+  }
+
+  const Glib::ustring action_group_name = "tables-list";
 
   Document* document = dynamic_cast<Document*>(get_document());
   const Document::type_listTableInfo tables = document->get_tables();
@@ -1972,62 +2102,50 @@ void AppWindow::fill_menu_tables()
     sharedptr<const TableInfo> table_info = *iter;
     if(!table_info->get_hidden())
     {
-      const Glib::ustring action_name = "NavTableAction_" + table_info->get_name();
-
-      ui_description += "<menuitem action='" + action_name + "' />";
+      const Glib::ustring title = Utils::string_escape_underscores(item_get_title_or_name(table_info));
+      const Glib::ustring action_name = table_info->get_name();
+  
+      menu->append(title, action_group_name + "." + action_name);
 
-      Glib::RefPtr<Gtk::Action> refAction = Gtk::Action::create(action_name, 
Utils::string_escape_underscores(item_get_title_or_name(table_info)));
-      m_refNavTablesActionGroup->add(refAction,
+      Glib::RefPtr<Gio::SimpleAction> action = m_refNavTablesActionGroup->add_action(action_name,
         sigc::bind( sigc::mem_fun(*m_pFrame, &Frame_Glom::on_box_tables_selected), table_info->get_name()) );
-
-      m_listNavTableActions.push_back(refAction);
-
-      //m_refUIManager->add_ui(merge_id, path, table_info->m_title, refAction, UI_MANAGER_MENUITEM);
+      m_listNavTableActions.push_back(action);
     }
   }
 
-  m_refUIManager->insert_action_group(m_refNavTablesActionGroup);
-
+  insert_action_group(action_group_name, m_refNavTablesActionGroup);
+}
 
-  ui_description +=
-    "     </placeholder>"
-    "    </menu>"
-    "  </menubar>"
-    "</ui>";
+void AppWindow::fill_menu_reports(const Glib::ustring& table_name)
+{
+  m_listNavReportActions.clear();
 
-  //Add menus:
-  try
+  //Remove existing items.
+  Glib::RefPtr<Glib::Object> object =
+    m_builder_menu->get_object("reports-list");
+  Glib::RefPtr<Gio::Menu> menu =
+    Glib::RefPtr<Gio::Menu>::cast_dynamic(object);
+  if(!menu)
   {
-    m_menu_tables_ui_merge_id = m_refUIManager->add_ui_from_string(ui_description);
+    std::cerr << G_STRFUNC << ": GMenu not found" << std::endl;
+    return;
   }
-  catch(const Glib::Error& ex)
+
+  //TODO: Add API for this?
+  while(menu->get_n_items())
   {
-    std::cerr << G_STRFUNC << ": building menus failed: " <<  ex.what() << std::endl;
-    std::cerr << "   The ui_description was: " <<  ui_description << std::endl;
+    menu->remove(0);
   }
-}
 
-void AppWindow::fill_menu_reports(const Glib::ustring& table_name)
-{
-  //TODO: There must be a better way than building a ui_string like this:
-
-  m_listNavReportActions.clear();
-  if(m_menu_reports_ui_merge_id)
-    m_refUIManager->remove_ui(m_menu_reports_ui_merge_id);
+  const Glib::ustring action_group_name = "reports-list";
 
   if(m_refNavReportsActionGroup)
   {
-    m_refUIManager->remove_action_group(m_refNavReportsActionGroup);
+    //TODO? m_builder_menu->remove_action_group(m_refNavReportsActionGroup);
     m_refNavReportsActionGroup.reset();
   }
 
-  m_refNavReportsActionGroup = Gtk::ActionGroup::create("NavReportsActions");
-
-  Glib::ustring ui_description =
-    "<ui>"
-    "  <menubar name='Bakery_MainMenu'>"
-    "   <menu action='Glom_Menu_Reports'>"
-    "     <placeholder name='Menu_Reports_Dynamic'>";
+  m_refNavReportsActionGroup = Gio::SimpleActionGroup::create();
 
   Document* document = dynamic_cast<Document*>(get_document());
   const std::vector<Glib::ustring> reports = document->get_report_names(table_name);
@@ -2039,71 +2157,76 @@ void AppWindow::fill_menu_reports(const Glib::ustring& table_name)
       const Glib::ustring report_name = report->get_name();
       if(!report_name.empty())
       {
-        const Glib::ustring action_name = "NavReportAction_" + report_name;
-
-        ui_description += "<menuitem action='" + action_name + "' />";
+        const Glib::ustring title = Utils::string_escape_underscores(item_get_title_or_name(report));
+        const Glib::ustring action_name = report_name;
+  
+        menu->append(title, action_group_name + "." + report_name);
 
-        Glib::RefPtr<Gtk::Action> refAction = Gtk::Action::create( action_name, 
Utils::string_escape_underscores(item_get_title_or_name(report)) );
-        m_refNavReportsActionGroup->add(refAction,
+        Glib::RefPtr<Gio::SimpleAction> action = m_refNavReportsActionGroup->add_action(action_name,
           sigc::bind( sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_report_selected), report->get_name()) );
-
-        m_listNavReportActions.push_back(refAction);
-
-        //m_refUIManager->add_ui(merge_id, path, table_info->m_title, refAction, UI_MANAGER_MENUITEM);
-      }
+        m_listNavReportActions.push_back(action);
+     }
     }
   }
 
-  m_refUIManager->insert_action_group(m_refNavReportsActionGroup);
+  insert_action_group(action_group_name, m_refNavReportsActionGroup);
+}
 
+void AppWindow::enable_menu_print_layouts_details(bool enable)
+{
+  if(!m_refNavPrintLayoutsActionGroup)
+    return;
 
-  ui_description +=
-    "     </placeholder>"
-    "    </menu>"
-    "  </menubar>"
-    "</ui>";
+  //TODO: See https://bugzilla.gnome.org/show_bug.cgi?id=708149 about having this API in GSimpleActionGroup:
+  //m_refNavPrintLayoutsActionGroup->set_enabled(enable);
 
-  //Add menus:
-  try
+  //Enable/Disable each action in the group:
+  //TODO: Suggest a simpler get_actions() method?
+  typedef std::vector<Glib::ustring> type_vec_action_names;
+  type_vec_action_names actions = m_refNavPrintLayoutsActionGroup->list_actions();
+  for(type_vec_action_names::const_iterator iter = actions.begin(); iter != actions.end(); ++iter)
   {
-    m_menu_reports_ui_merge_id = m_refUIManager->add_ui_from_string(ui_description);
+    const Glib::ustring name = *iter;
+    Glib::RefPtr<Gio::SimpleAction> action = 
+      Glib::RefPtr<Gio::SimpleAction>::cast_dynamic(m_refNavPrintLayoutsActionGroup->lookup_action(name));
+    if(action)
+      action->set_enabled(enable);
   }
-  catch(const Glib::Error& ex)
-  {
-    std::cerr << G_STRFUNC << ": building menus failed: " <<  ex.what();
-  }
-}
-
-void AppWindow::enable_menu_print_layouts_details(bool enable)
-{
- if(m_refNavPrintLayoutsActionGroup)
-    m_refNavPrintLayoutsActionGroup->set_sensitive(enable);
 }
 
 void AppWindow::fill_menu_print_layouts(const Glib::ustring& table_name)
 {
-  //TODO: This is copy/pasted from fill_menu_print_reports. Can we generalize it?
-
-  //TODO: There must be a better way than building a ui_string like this:
+  //TODO: This is copy/pasted from fill_menu_reports(). Can we generalize it?
 
   m_listNavPrintLayoutActions.clear();
-  if(m_menu_print_layouts_ui_merge_id)
-    m_refUIManager->remove_ui(m_menu_print_layouts_ui_merge_id);
+
+  //Remove existing items.
+  Glib::RefPtr<Glib::Object> object =
+    m_builder_menu->get_object("print-layouts-list");
+  Glib::RefPtr<Gio::Menu> menu =
+    Glib::RefPtr<Gio::Menu>::cast_dynamic(object);
+  if(!menu)
+  {
+    std::cerr << G_STRFUNC << ": GMenu not found" << std::endl;
+    return;
+  }
+
+  //TODO: Add API for this?
+  while(menu->get_n_items())
+  {
+    menu->remove(0);
+  }
+
+  const Glib::ustring action_group_name = "print-layouts-list";
 
   if(m_refNavPrintLayoutsActionGroup)
   {
-    m_refUIManager->remove_action_group(m_refNavPrintLayoutsActionGroup);
+    //TODO: See   //TODO: See https://bugzilla.gnome.org/show_bug.cgi?id=708150 about adding this API:
+    //m_builder_menu->remove_action_group(m_refNavPrintLayoutsActionGroup);
     m_refNavPrintLayoutsActionGroup.reset();
   }
 
-  m_refNavPrintLayoutsActionGroup = Gtk::ActionGroup::create("NavPrintLayoutsActions");
-
-  Glib::ustring ui_description =
-    "<ui>"
-    "  <menubar name='Bakery_MainMenu'>"
-    "    <menu action='BakeryAction_Menu_File'>"
-    "      <menu action='GlomAction_Menu_File_Print'>"
-    "        <placeholder name='Menu_PrintLayouts_Dynamic'>";
+  m_refNavPrintLayoutsActionGroup = Gio::SimpleActionGroup::create();
 
   Document* document = dynamic_cast<Document*>(get_document());
   const std::vector<Glib::ustring> tables = document->get_print_layout_names(table_name);
@@ -2119,41 +2242,21 @@ void AppWindow::fill_menu_print_layouts(const Glib::ustring& table_name)
       const Glib::ustring name = print_layout->get_name();
       if(!name.empty())
       {
-        const Glib::ustring action_name = "NavPrintLayoutAction_" + name;
-
-        ui_description += "<menuitem action='" + action_name + "' />";
+        const Glib::ustring title = Utils::string_escape_underscores(item_get_title(print_layout));
+        const Glib::ustring action_name = name;
 
-        Glib::RefPtr<Gtk::Action> refAction = Gtk::Action::create( action_name, 
Utils::string_escape_underscores(item_get_title(print_layout)) );
-        m_refNavPrintLayoutsActionGroup->add(refAction,
-          sigc::bind( sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_print_layout_selected), 
print_layout->get_name()) );
+        menu->append(title, action_group_name + "." + action_name);
 
-        m_listNavPrintLayoutActions.push_back(refAction);
+        Glib::RefPtr<Gio::SimpleAction> action = m_refNavPrintLayoutsActionGroup->add_action(action_name,
+          sigc::bind( sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_print_layout_selected), name) );
 
-        //m_refUIManager->add_ui(merge_id, path, table_info->m_title, refAction, UI_MANAGER_MENUITEM);
+        m_listNavPrintLayoutActions.push_back(action);
       }
     }
   }
 #endif
 
-  m_refUIManager->insert_action_group(m_refNavPrintLayoutsActionGroup);
-
-
-  ui_description +=
-    "       </placeholder>"
-    "      </menu>"
-    "    </menu>"
-    "  </menubar>"
-    "</ui>";
-
-  //Add menus:
-  try
-  {
-    m_menu_print_layouts_ui_merge_id = m_refUIManager->add_ui_from_string(ui_description);
-  }
-  catch(const Glib::Error& ex)
-  {
-    std::cerr << G_STRFUNC << ": building menus failed: " <<  ex.what();
-  }
+  insert_action_group(action_group_name, m_refNavPrintLayoutsActionGroup);
 }
 
 #ifndef GLOM_ENABLE_CLIENT_ONLY
@@ -2528,8 +2631,9 @@ void AppWindow::on_menu_developer_translations()
   }
 }
 
-void AppWindow::on_menu_developer_active_platform_normal()
+void AppWindow::on_menu_developer_active_platform(int parameter)
 {
+  //TODO:
   Document* document = dynamic_cast<Document*>(get_document());
   if(document)
    document->set_active_layout_platform("");
@@ -2537,15 +2641,6 @@ void AppWindow::on_menu_developer_active_platform_normal()
   m_pFrame->show_table_refresh();
 }
 
-void AppWindow::on_menu_developer_active_platform_maemo()
-{
-  Document* document = dynamic_cast<Document*>(get_document());
-  if(document)
-   document->set_active_layout_platform("maemo");
-
-  m_pFrame->show_table_refresh();
-}
-
 void AppWindow::on_menu_developer_export_backup()
 {
   Document* document = dynamic_cast<Document*>(get_document());
@@ -2648,7 +2743,10 @@ bool AppWindow::do_restore_backup(const Glib::ustring& backup_uri)
 
 void AppWindow::on_menu_developer_enable_layout_drag_and_drop()
 {
-  m_pFrame->set_enable_layout_drag_and_drop(m_action_enable_layout_drag_and_drop->get_active());
+  bool state = false;
+  m_action_enable_layout_drag_and_drop->get_state(state);
+
+  m_pFrame->set_enable_layout_drag_and_drop(state); //TODO: Change the menu's state.
 }
 
 
@@ -2807,9 +2905,9 @@ void AppWindow::set_progress_message(const Glib::ustring& message)
   m_infobar_progress->pulse();
   
   //Block interaction with the rest of the UI.
-  Gtk::MenuBar* pMenuBar = static_cast<Gtk::MenuBar*>(m_refUIManager->get_widget("/Bakery_MainMenu"));
-  if(pMenuBar)
-    pMenuBar->set_sensitive(false);
+  if(m_menubar)
+    m_menubar->set_sensitive(false);
+
   m_pFrame->set_sensitive(false);
 }
 
@@ -2823,9 +2921,9 @@ void AppWindow::clear_progress_message()
   m_progress_collate_key.clear();
   m_infobar_progress->hide();
 
-  Gtk::MenuBar* pMenuBar = static_cast<Gtk::MenuBar*>(m_refUIManager->get_widget("/Bakery_MainMenu"));
-  if(pMenuBar)
-    pMenuBar->set_sensitive();
+  if(m_menubar)
+    m_menubar->set_sensitive();
+
   m_pFrame->set_sensitive();
 }
 
@@ -2915,36 +3013,23 @@ void AppWindow::ui_bring_to_front()
   get_window()->raise();
 }
 
-void AppWindow::add_ui_from_string(const Glib::ustring& ui_description)
-{
-  try
-  {
-    m_refUIManager->add_ui_from_string(ui_description);
-  }
-  catch(const Glib::Error& ex)
-  {
-    std::cerr << "building menus failed: " <<  ex.what();
-  }
-}
-
 void AppWindow::init_menus_edit()
 {
-  using namespace Gtk;
   //Edit menu
   
   //Build actions:
-  m_refEditActionGroup = Gtk::ActionGroup::create("BakeryEditActions");
-  m_refEditActionGroup->add(Action::create("BakeryAction_Menu_Edit", _("_Edit")));
-  
-  m_refEditActionGroup->add(Action::create("BakeryAction_Edit_Cut", _("Cu_t")),
-                        sigc::mem_fun((AppWindow&)*this, &AppWindow::on_menu_edit_cut_activate));
-  m_refEditActionGroup->add(Action::create("BakeryAction_Edit_Copy", _("_Copy")),
-                        sigc::mem_fun((AppWindow&)*this, &AppWindow::on_menu_edit_copy_activate));
-  m_refEditActionGroup->add(Action::create("BakeryAction_Edit_Paste", _("_Paste")),
-                        sigc::mem_fun((AppWindow&)*this, &AppWindow::on_menu_edit_paste_activate));
-  m_refEditActionGroup->add(Action::create("BakeryAction_Edit_Clear", _("_Clear")));
+  m_refEditActionGroup = Gio::SimpleActionGroup::create();
+
+  m_refEditActionGroup->add_action("cut",
+    sigc::mem_fun((AppWindow&)*this, &AppWindow::on_menu_edit_cut_activate));
+  m_refEditActionGroup->add_action("copy",
+    sigc::mem_fun((AppWindow&)*this, &AppWindow::on_menu_edit_copy_activate));
+  m_refEditActionGroup->add_action("paste",
+    sigc::mem_fun((AppWindow&)*this, &AppWindow::on_menu_edit_paste_activate));
+  m_refEditActionGroup->add_action("clear");
+    //TODO? sigc::mem_fun((AppWindow&)*this, &AppWindow::on_menu_edit_clear_activate));
 
-  m_refUIManager->insert_action_group(m_refEditActionGroup);
+  insert_action_group("edit", m_refEditActionGroup);
 }
 
 void AppWindow::add(Gtk::Widget& child)
@@ -3013,10 +3098,10 @@ void AppWindow::ui_show_modification_status()
 
   //Enable Save and SaveAs menu items:
   if(m_action_save)
-    m_action_save->set_sensitive(modified);
+    m_action_save->set_enabled(modified);
 
   if(m_action_saveas)
-    m_action_saveas->set_sensitive(modified);
+    m_action_saveas->set_enabled(modified);
 }
 
 AppWindow::enumSaveChanges AppWindow::ui_offer_to_save_changes()
diff --git a/glom/appwindow.h b/glom/appwindow.h
index e7342cb..be2b171 100644
--- a/glom/appwindow.h
+++ b/glom/appwindow.h
@@ -35,7 +35,6 @@
 #include <gtkmm/menu.h>
 #include <gtkmm/toolbar.h>
 #include <gtkmm/handlebox.h>
-#include <gtkmm/uimanager.h>
 #include <gtkmm/builder.h>
 #include <gtkmm/applicationwindow.h>
 
@@ -86,8 +85,8 @@ public:
   void update_network_shared_ui();
 
 #ifndef GLOM_ENABLE_CLIENT_ONLY
-  void add_developer_action(const Glib::RefPtr<Gtk::Action>& refAction);
-  void remove_developer_action(const Glib::RefPtr<Gtk::Action>& refAction);
+  void add_developer_action(const Glib::RefPtr<Gio::SimpleAction>& refAction);
+  void remove_developer_action(const Glib::RefPtr<Gio::SimpleAction>& refAction);
 
   /** Show in the UI whether the document is in developer or operator mode.
    */
@@ -174,8 +173,6 @@ protected:
   virtual void init_menus_file(); //Call this from init_menus() to add the standard file menu.
   virtual void init_menus_edit(); //Call this from init_menus() to add the standard edit menu
 
-  void add_ui_from_string(const Glib::ustring& ui_description); //Convenience function
-
   virtual void on_hide(); //override.
 
   //Overrides from AppWindow_WithDoc:
@@ -204,17 +201,18 @@ protected:
   void on_menu_edit_paste_activate();
   void on_recent_files_activate(Gtk::RecentChooser& recent_chooser);
 
-  //UIManager and Actions
-  Glib::RefPtr<Gtk::UIManager> m_refUIManager;
-  Glib::RefPtr<Gtk::ActionGroup> m_refFileActionGroup;
-  Glib::RefPtr<Gtk::ActionGroup> m_refEditActionGroup;
+  //Menu Builder and Actions
+  Gtk::MenuBar* m_menubar;
+  Glib::RefPtr<Gtk::Builder> m_builder_menu;
+  Glib::RefPtr<Gio::SimpleActionGroup> m_refFileActionGroup;
+  Glib::RefPtr<Gio::SimpleActionGroup> m_refEditActionGroup;
 
   //Member widgets:
   Gtk::Box* m_pVBox;
   Gtk::Box m_VBox_PlaceHolder;
 
   //Menu stuff:
-  Glib::RefPtr<Gtk::Action> m_action_save, m_action_saveas;
+  Glib::RefPtr<Gio::SimpleAction> m_action_save, m_action_saveas;
 
 protected:
   virtual void ui_warning_load_failed(int failure_code = 0); //Override.
@@ -237,16 +235,14 @@ private:
   void existing_or_new_new();
 
   void on_menu_file_toggle_share();
-  void on_menu_developer_developer();
-  void on_menu_developer_operator();
+  void on_menu_developer_usermode(int parameter);
   void on_menu_file_save_as_example();
   void on_menu_developer_changelanguage();
   void on_menu_developer_translations();
-  void on_menu_developer_active_platform_normal();
-  void on_menu_developer_active_platform_maemo();
+  void on_menu_developer_active_platform(int state);
   void on_menu_developer_export_backup();
   void on_menu_developer_restore_backup();
-  void on_menu_developer_enable_layout_drag_and_drop ();
+  void on_menu_developer_enable_layout_drag_and_drop();
 
   void on_window_translations_hide();
 
@@ -289,19 +285,20 @@ private:
 
   //Widgets:
 
-  Glib::RefPtr<Gtk::ActionGroup> m_refActionGroup_Others;
+  Glib::RefPtr<Gio::SimpleActionGroup> m_refActionGroup_Tables,
+    m_refActionGroup_Edit, m_refActionGroup_Developer, m_refActionGroup_Reports;
 
-  typedef std::list< Glib::RefPtr<Gtk::Action> > type_listActions;
+  typedef std::list< Glib::RefPtr<Gio::SimpleAction> > type_listActions;
   type_listActions m_listDeveloperActions; //Only enabled when in developer mode.
   type_listActions m_listTableSensitiveActions; // Only enabled when a table is loaded.
-  Glib::RefPtr<Gtk::Action> m_action_mode_find;
+  Glib::RefPtr<Gio::SimpleAction> m_action_mode_find;
 #ifndef GLOM_ENABLE_CLIENT_ONLY
-  Glib::RefPtr<Gtk::Action> m_action_developer_users;
-  Glib::RefPtr<Gtk::RadioAction> m_action_menu_developer_developer, m_action_menu_developer_operator;
-  Glib::RefPtr<Gtk::ToggleAction> m_action_enable_layout_drag_and_drop ;
+  Glib::RefPtr<Gio::SimpleAction> m_action_developer_users;
+  Glib::RefPtr<Gio::SimpleAction> m_action_menu_developer_usermode;
+  Glib::RefPtr<Gio::SimpleAction> m_action_enable_layout_drag_and_drop ;
 #endif // !GLOM_ENABLE_CLIENT_ONLY
 
-  Glib::RefPtr<Gtk::ToggleAction> m_toggleaction_network_shared;
+  Glib::RefPtr<Gio::SimpleAction> m_toggleaction_network_shared;
   sigc::connection m_connection_toggleaction_network_shared;
 
   Gtk::Box* m_pBoxTop;
@@ -318,10 +315,9 @@ private:
 
 #endif // !GLOM_ENABLE_CLIENT_ONLY
 
-  Glib::RefPtr<Gtk::ActionGroup> m_refHelpActionGroup;
-  Glib::RefPtr<Gtk::ActionGroup> m_refNavTablesActionGroup, m_refNavReportsActionGroup, 
m_refNavPrintLayoutsActionGroup;
+  Glib::RefPtr<Gio::SimpleActionGroup> m_refHelpActionGroup;
+  Glib::RefPtr<Gio::SimpleActionGroup> m_refNavTablesActionGroup, m_refNavReportsActionGroup, 
m_refNavPrintLayoutsActionGroup;
   type_listActions m_listNavTableActions, m_listNavReportActions, m_listNavPrintLayoutActions;
-  Gtk::UIManager::ui_merge_id m_menu_tables_ui_merge_id, m_menu_reports_ui_merge_id, 
m_menu_print_layouts_ui_merge_id;
 
 #ifndef GLOM_ENABLE_CLIENT_ONLY
   //Set these before calling offer_saveas() (which uses ui_file_select_save()), and clear it afterwards.
diff --git a/glom/frame_glom.cc b/glom/frame_glom.cc
index 11588ce..07a732a 100644
--- a/glom/frame_glom.cc
+++ b/glom/frame_glom.cc
@@ -62,7 +62,6 @@
 #include <glom/print_layout/print_layout_utils.h>
 
 #include <glom/filechooser_export.h>
-#include <gtkmm/radioaction.h>
 #include <libglom/privs.h>
 #include <libglom/db_utils.h>
 #include <sstream> //For stringstream.
@@ -452,95 +451,81 @@ void Frame_Glom::show_no_table()
 }
 
 #ifndef GLOM_ENABLE_CLIENT_ONLY
-void Frame_Glom::on_menu_developer_developer(const Glib::RefPtr<Gtk::RadioAction>& action, const 
Glib::RefPtr<Gtk::RadioAction>& operator_action)
+bool Frame_Glom::attempt_change_usermode_to_developer()
 {
-  if(action && action->get_active())
-  {
-    Document* document = dynamic_cast<Document*>(get_document());
-    if(document)
-    {
-      //Check whether the current user has developer privileges:
-      ConnectionPool* connection_pool = ConnectionPool::get_instance();
-      sharedptr<SharedConnection> sharedconnection = connection_pool->connect();
-
-      // Default to true; if we don't support users, we always have
-      // priviliges to change things in developer mode.
-      bool test = true;
+  Document* document = dynamic_cast<Document*>(get_document());
+  if(!document)
+    return false;
 
-      if(sharedconnection && 
sharedconnection->get_gda_connection()->supports_feature(Gnome::Gda::CONNECTION_FEATURE_USERS))
-      {
-        test = Privs::get_user_is_in_group(connection_pool->get_user(), GLOM_STANDARD_GROUP_NAME_DEVELOPER);
-      }
+  //Check whether the current user has developer privileges:
+  ConnectionPool* connection_pool = ConnectionPool::get_instance();
+  sharedptr<SharedConnection> sharedconnection = connection_pool->connect();
 
-      if(test)
-      {
-        std::cout << "DEBUG: User=" << connection_pool->get_user() << " _is_ in the developer group on the 
server." << std::endl;
-        //Avoid double signals:
-        //if(document->get_userlevel() != AppState::USERLEVEL_DEVELOPER)
-        test = document->set_userlevel(AppState::USERLEVEL_DEVELOPER);
-        if(!test)
-          std::cout << "  DEBUG: But document->set_userlevel(AppState::USERLEVEL_DEVELOPER) failed." << 
std::endl;
-      }
-      else
-      {
-        std::cout << "DEBUG: User=" << connection_pool->get_user() << " is _not_ in the developer group on 
the server." << std::endl;
-      }
+  // Default to true; if we don't support users, we always have
+  // priviliges to change things in developer mode.
+  bool test = true;
 
-      //If this was not possible then revert the menu:
-      if(!test)
-      {
-        if(document->get_opened_from_browse())
-        {
-          //TODO: Obviously this could be possible but it would require a network protocol and some work:
-          Gtk::MessageDialog dialog(Utils::bold_message(_("Developer mode not available.")), true, 
Gtk::MESSAGE_WARNING);
-          dialog.set_secondary_text(_("Developer mode is not available because the file was opened over the 
network from a running Glom. Only the original file may be edited."));
-          dialog.set_transient_for(*get_app_window());
-          dialog.run();
-        }
-        else
-        {
-          Gtk::MessageDialog dialog(Utils::bold_message(_("Developer mode not available")), true, 
Gtk::MESSAGE_WARNING);
-          dialog.set_secondary_text(_("Developer mode is not available. Check that you have sufficient 
database access rights and that the glom file is not read-only."));
-          dialog.set_transient_for(*get_app_window());
-          dialog.run();
-        }
-      }
-      else if(document->get_document_format_version() < Document::get_latest_known_document_format_version())
-      {
-        Gtk::MessageDialog dialog(Utils::bold_message(_("Saving in new document format")), true, 
Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_NONE);
-        dialog.set_secondary_text(_("The document was created by an earlier version of the application. 
Making changes to the document will mean that the document cannot be opened by some earlier versions of the 
application."));
-        dialog.set_transient_for(*get_app_window());
-        dialog.add_button(_("_Cancel"), Gtk::RESPONSE_CANCEL);
-        dialog.add_button(_("Continue"), Gtk::RESPONSE_OK);
-        const int response = dialog.run();
-        test = (response == Gtk::RESPONSE_OK);
-      }
-
-      if(!test)
-      {
-        //Abort the change of user level:
+  if(sharedconnection && 
sharedconnection->get_gda_connection()->supports_feature(Gnome::Gda::CONNECTION_FEATURE_USERS))
+  {
+    test = Privs::get_user_is_in_group(connection_pool->get_user(), GLOM_STANDARD_GROUP_NAME_DEVELOPER);
+  }
 
-        //This causes an endless loop, but it is not recursive so we can't block it.
-        //TODO: Submit GTK+ bug.
-        //action->set_active(false);
-        operator_action->set_active();
-      }
-    }
+  if(test)
+  {
+    std::cout << "DEBUG: User=" << connection_pool->get_user() << " _is_ in the developer group on the 
server." << std::endl;
+    //Avoid double signals:
+    //if(document->get_userlevel() != AppState::USERLEVEL_DEVELOPER)
+    test = document->set_userlevel(AppState::USERLEVEL_DEVELOPER);
+    if(!test)
+      std::cout << "  DEBUG: But document->set_userlevel(AppState::USERLEVEL_DEVELOPER) failed." << 
std::endl;
+  }
+  else
+  {
+    std::cout << "DEBUG: User=" << connection_pool->get_user() << " is _not_ in the developer group on the 
server." << std::endl;
   }
-}
 
-void Frame_Glom::on_menu_developer_operator(const Glib::RefPtr<Gtk::RadioAction>& action)
-{
-  if(action &&  action->get_active())
+  //If this was not possible then revert the menu:
+  if(!test)
   {
-    Document* document = dynamic_cast<Document*>(get_document());
-    if(document)
+    if(document->get_opened_from_browse())
+    {
+      //TODO: Obviously this could be possible but it would require a network protocol and some work:
+      Gtk::MessageDialog dialog(Utils::bold_message(_("Developer mode not available.")), true, 
Gtk::MESSAGE_WARNING);
+      dialog.set_secondary_text(_("Developer mode is not available because the file was opened over the 
network from a running Glom. Only the original file may be edited."));
+      dialog.set_transient_for(*get_app_window());
+      dialog.run();
+    }
+    else
     {
-      //Avoid double signals:
-      //if(document->get_userlevel() != AppState::USERLEVEL_OPERATOR)
-        document->set_userlevel(AppState::USERLEVEL_OPERATOR);
+      Gtk::MessageDialog dialog(Utils::bold_message(_("Developer mode not available")), true, 
Gtk::MESSAGE_WARNING);
+      dialog.set_secondary_text(_("Developer mode is not available. Check that you have sufficient database 
access rights and that the glom file is not read-only."));
+      dialog.set_transient_for(*get_app_window());
+      dialog.run();
     }
   }
+  else if(document->get_document_format_version() < Document::get_latest_known_document_format_version())
+  {
+    Gtk::MessageDialog dialog(Utils::bold_message(_("Saving in new document format")), true, 
Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_NONE);
+    dialog.set_secondary_text(_("The document was created by an earlier version of the application. Making 
changes to the document will mean that the document cannot be opened by some earlier versions of the 
application."));
+    dialog.set_transient_for(*get_app_window());
+    dialog.add_button(_("_Cancel"), Gtk::RESPONSE_CANCEL);
+    dialog.add_button(_("Continue"), Gtk::RESPONSE_OK);
+    const int response = dialog.run();
+    test = (response == Gtk::RESPONSE_OK);
+  }
+
+  return test;
+}
+
+bool Frame_Glom::attempt_change_usermode_to_operator()
+{
+  Document* document = dynamic_cast<Document*>(get_document());
+  if(!document)
+    return false;
+    
+  document->set_userlevel(AppState::USERLEVEL_OPERATOR);
+
+  return true;
 }
 
 void Frame_Glom::on_menu_file_export()
@@ -801,26 +786,20 @@ void Frame_Glom::on_menu_file_import()
   }
 }
 
-void Frame_Glom::on_menu_file_toggle_share(const Glib::RefPtr<Gtk::ToggleAction>& action)
+bool Frame_Glom::attempt_toggle_shared(bool shared)
 {
-  if(!action)
-  {
-    std::cerr << G_STRFUNC << ": action was null." << std::endl;
-  }
-
   //Prevent this change if not in developer mode,
   //though the menu item should be disabled then anyway.
   Document* document = dynamic_cast<Document*>(get_document());
   if(!document || document->get_userlevel() != AppState::USERLEVEL_DEVELOPER)
-    return;
+    return false;
 
-  bool shared = action->get_active(); //Whether it should be shared.
   if(shared == document->get_network_shared())
   {
     //Do nothing, because things are already as requested.
     //This is probably just an extra signal emitted when we set the toggle in the UI.
     //So we avoid the endless loop:
-    return;
+    return false;
   }
 
   bool change = true;
@@ -1009,6 +988,8 @@ void Frame_Glom::on_menu_file_toggle_share(const Glib::RefPtr<Gtk::ToggleAction>
   {
     pApp->update_network_shared_ui();
   }
+
+  return true;
 }
 #endif // !GLOM_ENABLE_CLIENT_ONLY
 
diff --git a/glom/frame_glom.h b/glom/frame_glom.h
index 99f6aca..e491dab 100644
--- a/glom/frame_glom.h
+++ b/glom/frame_glom.h
@@ -26,7 +26,6 @@
 #include "window_boxholder.h"
 
 #include <gtkmm/frame.h>
-#include <gtkmm/toggleaction.h>
 #include <libglom/document/bakery/view/view_composite.h>
 #include <libglom/document/document.h>
 
@@ -76,15 +75,15 @@ public:
   void on_box_reports_selected(const Glib::ustring& strName);
   void on_box_print_layouts_selected(const Glib::ustring& strName);
 
-  void on_menu_developer_developer(const Glib::RefPtr<Gtk::RadioAction>& action, const 
Glib::RefPtr<Gtk::RadioAction>& operator_action);
-  void on_menu_developer_operator(const Glib::RefPtr<Gtk::RadioAction>& action);
+  bool attempt_change_usermode_to_developer();
+  bool attempt_change_usermode_to_operator();
 
   void on_menu_file_export();
   void on_menu_file_import();
   void on_menu_file_print_edit_layouts();
 #endif // !GLOM_ENABLE_CLIENT_ONLY
 
-  void on_menu_file_toggle_share(const Glib::RefPtr<Gtk::ToggleAction>& action);
+  bool attempt_toggle_shared(bool shared);
   void on_menu_file_print();
 
   void on_menu_Edit_Find();
diff --git a/glom/mode_data/box_data_calendar_related.cc b/glom/mode_data/box_data_calendar_related.cc
index e3307ba..b6983aa 100644
--- a/glom/mode_data/box_data_calendar_related.cc
+++ b/glom/mode_data/box_data_calendar_related.cc
@@ -26,6 +26,7 @@
 #include <libglom/db_utils.h>
 #include <glom/frame_glom.h> //For show_ok_dialog()
 #include <glom/glade_utils.h>
+#include <giomm/menu.h>
 #include <glibmm/i18n.h>
 
 namespace Glom
@@ -49,7 +50,7 @@ Box_Data_Calendar_Related::Box_Data_Calendar_Related()
 
   m_calendar.signal_month_changed().connect( sigc::mem_fun(*this, 
&Box_Data_Calendar_Related::on_calendar_month_changed) );
 
-  setup_menu();
+  setup_menu(this);
   //m_calendar.add_events(Gdk::BUTTON_PRESS_MASK); //Allow us to catch button_press_event and 
button_release_event
   m_calendar.signal_button_press_event().connect_notify( sigc::mem_fun(*this, 
&Box_Data_Calendar_Related::on_calendar_button_press_event) );
 
@@ -496,22 +497,17 @@ Glib::ustring Box_Data_Calendar_Related::on_calendar_details(guint year, guint m
   return result;
 }
 
-void Box_Data_Calendar_Related::setup_menu()
+void Box_Data_Calendar_Related::setup_menu(Gtk::Widget* /* this */)
 {
-  m_refActionGroup = Gtk::ActionGroup::create();
+  m_refActionGroup = Gio::SimpleActionGroup::create();
 
-  m_refActionGroup->add(Gtk::Action::create("ContextMenu", "Context Menu") );
-
-  m_refContextEdit =  Gtk::Action::create("ContextEdit", _("_Edit"));
-
-  m_refActionGroup->add(m_refContextEdit,
+  m_refContextEdit = m_refActionGroup->add_action("edit",
     sigc::mem_fun(*this, &Box_Data_Calendar_Related::on_MenuPopup_activate_Edit) );
 
 #ifndef GLOM_ENABLE_CLIENT_ONLY
   // Don't add ContextLayout in client only mode because it would never
   // be sensitive anyway
-  m_refContextLayout =  Gtk::Action::create("ContextLayout", _("Layout"));
-  m_refActionGroup->add(m_refContextLayout,
+  m_refContextLayout =  m_refActionGroup->add_action("layout",
     sigc::mem_fun(*this, &Box_Data_Calendar_Related::on_MenuPopup_activate_layout) );
 
   //TODO: This does not work until this widget is in a container in the window:
@@ -523,40 +519,50 @@ void Box_Data_Calendar_Related::setup_menu()
   }
 #endif // !GLOM_ENABLE_CLIENT_ONLY
 
-  m_refUIManager = Gtk::UIManager::create();
+  Glib::RefPtr<Gtk::Builder> builder = Gtk::Builder::create();
 
-  m_refUIManager->insert_action_group(m_refActionGroup);
+  insert_action_group("context", m_refActionGroup);
 
   //TODO: add_accel_group(m_refUIManager->get_accel_group());
 
+  const Glib::ustring ui_info =
+    "<interface>"
+    "  <menu id='ContextMenu'>"
+    "    <section>"
+    "      <item>"
+    "        <attribute name='label' translatable='yes'>_Edit</attribute>"
+    "        <attribute name='action'>context.edit</attribute>"
+    "      </item>"
+    "      <item>"
+    "        <attribute name='label' translatable='yes'>_Layout</attribute>"
+    "        <attribute name='action'>context.layout</attribute>"
+    "      </item>"
+    "    </section>"
+    "  </menu>"
+    "</interface>";
+
   try
   {
-    Glib::ustring ui_info =
-        "<ui>"
-        "  <popup name='ContextMenu'>"
-        "    <menuitem action='ContextEdit'/>"
-#ifndef GLOM_ENABLE_CLIENT_ONLY
-        "    <menuitem action='ContextLayout'/>"
-#endif
-        "  </popup>"
-        "</ui>";
-
-    m_refUIManager->add_ui_from_string(ui_info);
+    builder->add_from_string(ui_info);
   }
   catch(const Glib::Error& ex)
   {
-    std::cerr << "building menus failed: " <<  ex.what();
+    std::cerr << G_STRFUNC << ": building menus failed: " <<  ex.what();
   }
 
   //Get the menu:
-  m_pMenuPopup = dynamic_cast<Gtk::Menu*>( m_refUIManager->get_widget("/ContextMenu") );
-  if(!m_pMenuPopup)
-    g_warning("menu not found");
+  Glib::RefPtr<Glib::Object> object =
+    builder->get_object("ContextMenu");
+  Glib::RefPtr<Gio::Menu> gmenu =
+    Glib::RefPtr<Gio::Menu>::cast_dynamic(object);
+  if(!gmenu)
+    g_warning("GMenu not found");
 
+  m_pMenuPopup = new Gtk::Menu(gmenu);
 
 #ifndef GLOM_ENABLE_CLIENT_ONLY
   if(pApp)
-    m_refContextLayout->set_sensitive(pApp->get_userlevel() == AppState::USERLEVEL_DEVELOPER);
+    m_refContextLayout->set_enabled(pApp->get_userlevel() == AppState::USERLEVEL_DEVELOPER);
 #endif // !GLOM_ENABLE_CLIENT_ONLY
 }
 
diff --git a/glom/mode_data/box_data_calendar_related.h b/glom/mode_data/box_data_calendar_related.h
index ddebfcb..46cb2d1 100644
--- a/glom/mode_data/box_data_calendar_related.h
+++ b/glom/mode_data/box_data_calendar_related.h
@@ -27,6 +27,7 @@
 #include <libglom/data_structure/layout/layoutitem_calendarportal.h>
 #include <glom/utility_widgets/layoutwidgetbase.h>
 #include <gtkmm/calendar.h>
+#include <giomm/simpleactiongroup.h>
 
 namespace Glom
 {
@@ -78,7 +79,7 @@ private:
   Glib::ustring on_calendar_details(guint year, guint month, guint day);
   void on_calendar_month_changed();
     
-  void setup_menu();
+  void setup_menu(Gtk::Widget* widget);
   void on_calendar_button_press_event(GdkEventButton *event);
  
   void on_MenuPopup_activate_Edit();
@@ -96,12 +97,11 @@ private:
     
   //TODO: Avoid repeating these in so many widgets:
   Gtk::Menu* m_pMenuPopup;
-  Glib::RefPtr<Gtk::ActionGroup> m_refActionGroup;
-  Glib::RefPtr<Gtk::UIManager> m_refUIManager;
-  Glib::RefPtr<Gtk::Action> m_refContextEdit, m_refContextAdd, m_refContextDelete;
+  Glib::RefPtr<Gio::SimpleActionGroup> m_refActionGroup;
+  Glib::RefPtr<Gio::SimpleAction> m_refContextEdit, m_refContextAdd, m_refContextDelete;
 
 #ifndef GLOM_ENABLE_CLIENT_ONLY
-  Glib::RefPtr<Gtk::Action> m_refContextLayout;
+  Glib::RefPtr<Gio::SimpleAction> m_refContextLayout;
 #endif
     
   //The cached data for the month:
diff --git a/glom/mode_data/datawidget/checkbutton.cc b/glom/mode_data/datawidget/checkbutton.cc
index 3cb0eab..636b074 100644
--- a/glom/mode_data/datawidget/checkbutton.cc
+++ b/glom/mode_data/datawidget/checkbutton.cc
@@ -36,7 +36,7 @@ CheckButton::CheckButton(const Glib::ustring& title)
   : Gtk::CheckButton(title)
 {
 #ifndef GLOM_ENABLE_CLIENT_ONLY
-  setup_menu();
+  setup_menu(this);
 #endif // !GLOM_ENABLE_CLIENT_ONLY
 
   init();
@@ -48,7 +48,6 @@ CheckButton::~CheckButton()
 
 void CheckButton::init()
 {
-
 }
 
 #ifndef GLOM_ENABLE_CLIENT_ONLY
diff --git a/glom/mode_data/datawidget/combo.cc b/glom/mode_data/datawidget/combo.cc
index fe19f00..1423f1c 100644
--- a/glom/mode_data/datawidget/combo.cc
+++ b/glom/mode_data/datawidget/combo.cc
@@ -48,7 +48,7 @@ ComboGlom::ComboGlom(bool has_entry)
   m_ignore_changed(false)
 {
 #ifndef GLOM_ENABLE_CLIENT_ONLY
-  setup_menu();
+  setup_menu(this);
 #endif // !GLOM_ENABLE_CLIENT_ONLY
 
   //if(m_glom_type == Field::TYPE_NUMERIC)
diff --git a/glom/mode_data/datawidget/combo_as_radio_buttons.cc 
b/glom/mode_data/datawidget/combo_as_radio_buttons.cc
index 35d9c08..93752d3 100644
--- a/glom/mode_data/datawidget/combo_as_radio_buttons.cc
+++ b/glom/mode_data/datawidget/combo_as_radio_buttons.cc
@@ -40,7 +40,7 @@ ComboAsRadioButtons::ComboAsRadioButtons()
   ComboChoices()
 {
 #ifndef GLOM_ENABLE_CLIENT_ONLY
-  setup_menu();
+  setup_menu(this);
 #endif // !GLOM_ENABLE_CLIENT_ONLY
 
   init();
diff --git a/glom/mode_data/datawidget/datawidget.cc b/glom/mode_data/datawidget/datawidget.cc
index 1309af5..5925421 100644
--- a/glom/mode_data/datawidget/datawidget.cc
+++ b/glom/mode_data/datawidget/datawidget.cc
@@ -246,7 +246,7 @@ DataWidget::DataWidget(const sharedptr<LayoutItem_Field>& field, const Glib::ust
   }
 
 #ifndef GLOM_ENABLE_CLIENT_ONLY
-  setup_menu();
+  setup_menu(this);
 #endif // GLOM_ENABLE_CLIENT_ONLY
 
   set_events(Gdk::BUTTON_PRESS_MASK);
@@ -429,6 +429,7 @@ bool DataWidget::on_button_press_event(GdkEventButton *event)
   AppWindow* pApp = get_appwindow();
   if(pApp)
   {
+    //TODO: Avoid doing this multiple times:
     pApp->add_developer_action(m_refContextLayout); //So that it can be disabled when not in developer mode.
     pApp->add_developer_action(m_refContextAddField);
     pApp->add_developer_action(m_refContextAddRelatedRecords);
diff --git a/glom/mode_data/datawidget/entry.cc b/glom/mode_data/datawidget/entry.cc
index 325107a..0f2505f 100644
--- a/glom/mode_data/datawidget/entry.cc
+++ b/glom/mode_data/datawidget/entry.cc
@@ -42,20 +42,12 @@ Entry::Entry(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& /* build
   Gtk::Entry(cobject),
   m_glom_type(Field::TYPE_TEXT)
 {
-#ifndef GLOM_ENABLE_CLIENT_ONLY
-  setup_menu();
-#endif // !GLOM_ENABLE_CLIENT_ONLY
   init();
 }
 
 Entry::Entry(Field::glom_field_type glom_type)
-:
-  m_glom_type(glom_type)
+: m_glom_type(glom_type)
 {
-#ifndef GLOM_ENABLE_CLIENT_ONLY
-  setup_menu();
-#endif // !GLOM_ENABLE_CLIENT_ONLY
-
   init();
 }
 
@@ -65,6 +57,9 @@ Entry::~Entry()
 
 void Entry::init()
 {
+#ifndef GLOM_ENABLE_CLIENT_ONLY
+  setup_menu(this);
+#endif // !GLOM_ENABLE_CLIENT_ONLY
 }
 
 void Entry::set_layout_item(const sharedptr<LayoutItem>& layout_item, const Glib::ustring& table_name)
diff --git a/glom/mode_data/datawidget/textview.cc b/glom/mode_data/datawidget/textview.cc
index 8371b1f..4e4bd52 100644
--- a/glom/mode_data/datawidget/textview.cc
+++ b/glom/mode_data/datawidget/textview.cc
@@ -53,7 +53,7 @@ TextView::TextView(Field::glom_field_type glom_type)
 void TextView::init()
 {
 #ifndef GLOM_ENABLE_CLIENT_ONLY
-  setup_menu();
+  setup_menu(this);
 #endif // !GLOM_ENABLE_CLIENT_ONLY
 
   set_shadow_type(Gtk::SHADOW_IN);
diff --git a/glom/mode_data/db_adddel/db_adddel.cc b/glom/mode_data/db_adddel/db_adddel.cc
index 602b4d2..ba3be41 100644
--- a/glom/mode_data/db_adddel/db_adddel.cc
+++ b/glom/mode_data/db_adddel/db_adddel.cc
@@ -32,6 +32,7 @@
 #include <glom/utils_ui.h> //For Utils::image_scale_keeping_ratio().
 #include <glom/mode_data/datawidget/cellcreation.h>
 #include <glibmm/main.h>
+#include <giomm/menu.h>
 #include <libglom/db_utils.h>
 
 #include <iostream> //For debug output.
@@ -98,7 +99,7 @@ DbAddDel::DbAddDel()
   //signal_button_press_event().connect(sigc::mem_fun(*this, &DbAddDel::on_button_press_event_Popup));
   //add_blank();
 
-  setup_menu();
+  setup_menu(this);
 
 
   set_prevent_user_signals(false);
@@ -219,34 +220,27 @@ void DbAddDel::on_MenuPopup_activate_layout()
   signal_user_requested_layout().emit();
 }
 
-void DbAddDel::setup_menu()
+void DbAddDel::setup_menu(Gtk::Widget* /* widget */)
 {
-  m_refActionGroup = Gtk::ActionGroup::create();
+  m_refActionGroup = Gio::SimpleActionGroup::create();
 
-  m_refActionGroup->add(Gtk::Action::create("ContextMenu", "Context Menu") );
+  const Glib::ustring edit_title =
+    (m_open_button_title.empty() ? _("_Edit") : m_open_button_title); //TODO: Use this?
 
-  if(m_open_button_title.empty())
-    m_refContextEdit =  Gtk::Action::create("ContextEdit", _("_Edit"));
-  else
-    m_refContextEdit =  Gtk::Action::create("ContextEdit", m_open_button_title);
-
-  m_refActionGroup->add(m_refContextEdit,
+  m_refContextEdit = m_refActionGroup->add_action("edit",
     sigc::mem_fun(*this, &DbAddDel::on_MenuPopup_activate_Edit) );
 
-  m_refContextDelete =  Gtk::Action::create("ContextDelete", _("_Delete"));
-  m_refActionGroup->add(m_refContextDelete,
+  m_refContextDelete = m_refActionGroup->add_action("delete",
     sigc::mem_fun(*this, &DbAddDel::on_MenuPopup_activate_Delete) );
 
-  m_refContextAdd =  Gtk::Action::create("ContextAdd", _("_Add"));
-  m_refActionGroup->add(m_refContextAdd,
+  m_refContextAdd = m_refActionGroup->add_action("add",
     sigc::mem_fun(*this, &DbAddDel::on_MenuPopup_activate_Add) );
-  m_refContextAdd->set_sensitive(m_allow_add);
+  m_refContextAdd->set_enabled(m_allow_add);
 
 #ifndef GLOM_ENABLE_CLIENT_ONLY
   // Don't add ContextLayout in client only mode because it would never
   // be sensitive anyway
-  m_refContextLayout =  Gtk::Action::create("ContextLayout", _("Layout"));
-  m_refActionGroup->add(m_refContextLayout,
+  m_refContextLayout =  m_refActionGroup->add_action("layout",
     sigc::mem_fun(*this, &DbAddDel::on_MenuPopup_activate_layout) );
 
   //TODO: This does not work until this widget is in a container in the window:
@@ -258,53 +252,72 @@ void DbAddDel::setup_menu()
   }
 #endif // !GLOM_ENABLE_CLIENT_ONLY
 
-  m_refUIManager = Gtk::UIManager::create();
-
-  m_refUIManager->insert_action_group(m_refActionGroup);
-
-  //TODO: add_accel_group(m_refUIManager->get_accel_group());
-
-  try
-  {
-    Glib::ustring ui_info =
-        "<ui>"
-        "  <popup name='ContextMenu'>"
-        "    <menuitem action='ContextEdit'/>"
-        "    <menuitem action='ContextAdd'/>"
-        "    <menuitem action='ContextDelete'/>"
+  Glib::RefPtr<Gtk::Builder> builder = Gtk::Builder::create();
+
+  insert_action_group("context", m_refActionGroup);
+
+  //TODO: add_accel_group(builder->get_accel_group());
+
+  Glib::ustring ui_info =
+       "<interface>"
+        "  <menu id='ContextMenu'>"
+        "    <section>"
+        "      <item>"
+        "        <attribute name='label' translatable='yes'>_Edit</attribute>"
+        "        <attribute name='action'>context.edit</attribute>"
+        "      </item>"
+        "      <item>"
+        "        <attribute name='label' translatable='yes'>_Add</attribute>"
+        "        <attribute name='action'>context.add</attribute>"
+        "      </item>"
+        "      <item>"
+        "        <attribute name='label' translatable='yes'>_Delete</attribute>"
+        "        <attribute name='action'>context.delete</attribute>"
+        "      </item>"
 #ifndef GLOM_ENABLE_CLIENT_ONLY
-        "    <menuitem action='ContextLayout'/>"
+        "      <item>"
+        "        <attribute name='label' translatable='yes'>_Layout</attribute>"
+        "        <attribute name='action'>context.layout</attribute>"
+        "      </item>"
 #endif
-        "  </popup>"
-        "</ui>";
+        "    </section>"
+        "  </menu>"
+        "</interface>";
 
-    m_refUIManager->add_ui_from_string(ui_info);
+  try
+  {
+    builder->add_from_string(ui_info);
   }
   catch(const Glib::Error& ex)
   {
-    std::cerr << "building menus failed: " <<  ex.what();
+    std::cerr << G_STRFUNC << ": building menus failed: " <<  ex.what();
   }
 
   //Get the menu:
-  m_pMenuPopup = dynamic_cast<Gtk::Menu*>( m_refUIManager->get_widget("/ContextMenu") );
-  if(!m_pMenuPopup)
-    g_warning("menu not found");
+  Glib::RefPtr<Glib::Object> object =
+    builder->get_object("ContextMenu");
+  Glib::RefPtr<Gio::Menu> gmenu =
+    Glib::RefPtr<Gio::Menu>::cast_dynamic(object);
+  if(!gmenu)
+    g_warning("GMenu not found");
+
+  m_pMenuPopup = new Gtk::Menu(gmenu);
 
 
   if(get_allow_user_actions())
   {
-    m_refContextEdit->set_sensitive();
-    m_refContextDelete->set_sensitive();
+    m_refContextEdit->set_enabled();
+    m_refContextDelete->set_enabled();
   }
   else
   {
-    m_refContextEdit->set_sensitive(false);
-    m_refContextDelete->set_sensitive(false);
+    m_refContextEdit->set_enabled(false);
+    m_refContextDelete->set_enabled(false);
   }
 
 #ifndef GLOM_ENABLE_CLIENT_ONLY
   if(pApp)
-    m_refContextLayout->set_sensitive(pApp->get_userlevel() == AppState::USERLEVEL_DEVELOPER);
+    m_refContextLayout->set_enabled(pApp->get_userlevel() == AppState::USERLEVEL_DEVELOPER);
 #endif // !GLOM_ENABLE_CLIENT_ONLY
 }
 
@@ -1121,7 +1134,7 @@ void DbAddDel::set_allow_add(bool val)
 {
   m_allow_add = val;
 
-  m_refContextAdd->set_sensitive(val);
+  m_refContextAdd->set_enabled(val);
 }
 
 void DbAddDel::set_allow_delete(bool val)
@@ -2463,8 +2476,8 @@ void DbAddDel::on_treeview_selection_changed()
 
 void DbAddDel::on_selection_changed(bool selection)
 {
-  m_refContextDelete->set_sensitive(selection);
-  m_refContextAdd->set_sensitive(selection);
+  m_refContextDelete->set_enabled(selection);
+  m_refContextAdd->set_enabled(selection);
   
   m_signal_record_selection_changed.emit();
 }
diff --git a/glom/mode_data/db_adddel/db_adddel.h b/glom/mode_data/db_adddel/db_adddel.h
index dfc4b6f..ddbbe95 100644
--- a/glom/mode_data/db_adddel/db_adddel.h
+++ b/glom/mode_data/db_adddel/db_adddel.h
@@ -25,11 +25,12 @@
 #include <gtkmm/scrolledwindow.h>
 #include <gtkmm/treeview.h>
 #include <gtkmm/liststore.h>
-#include <gtkmm/uimanager.h>
+#include <gtkmm/builder.h>
 #include <libglom/data_structure/layout/layoutitem_field.h>
 #include <glom/mode_data/datawidget/treemodel_db.h>
 #include <libglom/document/document.h>
 #include <glom/base_db_table_data.h>
+#include <giomm/simpleactiongroup.h>
 
 #include <vector>
 #include <map>
@@ -306,7 +307,7 @@ private:
   type_list_indexes get_data_model_column_index(const sharedptr<const LayoutItem_Field>& layout_item_field, 
bool including_specified_field_layout = true) const;
 
 protected:
-  void setup_menu();
+  void setup_menu(Gtk::Widget* widget);
 
   /// A common handler for the edit button, the context menu, etc.
   void do_user_requested_edit();
@@ -412,12 +413,11 @@ protected:
 private:
   //TODO: Avoid repeating these in so many widgets:
   Gtk::Menu* m_pMenuPopup;
-  Glib::RefPtr<Gtk::ActionGroup> m_refActionGroup;
-  Glib::RefPtr<Gtk::UIManager> m_refUIManager;
-  Glib::RefPtr<Gtk::Action> m_refContextEdit, m_refContextAdd, m_refContextDelete;
+  Glib::RefPtr<Gio::SimpleActionGroup> m_refActionGroup;
+  Glib::RefPtr<Gio::SimpleAction> m_refContextEdit, m_refContextAdd, m_refContextDelete;
 
 #ifndef GLOM_ENABLE_CLIENT_ONLY
-  Glib::RefPtr<Gtk::Action> m_refContextLayout;
+  Glib::RefPtr<Gio::SimpleAction> m_refContextLayout;
 #endif
 
   bool m_bAllowUserActions;
diff --git a/glom/mode_data/db_adddel/db_adddel_withbuttons.cc 
b/glom/mode_data/db_adddel/db_adddel_withbuttons.cc
index 830c622..f04ad03 100644
--- a/glom/mode_data/db_adddel/db_adddel_withbuttons.cc
+++ b/glom/mode_data/db_adddel/db_adddel_withbuttons.cc
@@ -92,7 +92,7 @@ void DbAddDel_WithButtons::set_allow_user_actions(bool bVal)
   setup_buttons();
 
   //Recreate popup menu with correct items:
-  setup_menu();
+  setup_menu(this);
 }
 
 void DbAddDel_WithButtons::setup_buttons()
diff --git a/glom/mode_design/print_layouts/window_print_layout_edit.cc 
b/glom/mode_design/print_layouts/window_print_layout_edit.cc
index 3b02986..a89b869 100644
--- a/glom/mode_design/print_layouts/window_print_layout_edit.cc
+++ b/glom/mode_design/print_layouts/window_print_layout_edit.cc
@@ -893,7 +893,7 @@ void Window_PrintLayout_Edit::setup_context_menu()
   }
   catch(const Glib::Error& ex)
   {
-    std::cerr << G_STRFUNC << "building menus failed: " <<  ex.what();
+    std::cerr << G_STRFUNC << ": building menus failed: " <<  ex.what();
   }
 
   //Get the menu:
diff --git a/glom/mode_design/relationships_overview/dialog_relationships_overview.cc 
b/glom/mode_design/relationships_overview/dialog_relationships_overview.cc
index 9bac130..2a398e0 100644
--- a/glom/mode_design/relationships_overview/dialog_relationships_overview.cc
+++ b/glom/mode_design/relationships_overview/dialog_relationships_overview.cc
@@ -105,7 +105,7 @@ Dialog_RelationshipsOverview::Dialog_RelationshipsOverview(BaseObjectType* cobje
   }
   catch(const Glib::Error& ex)
   {
-    std::cerr << "building menus failed: " <<  ex.what();
+    std::cerr << G_STRFUNC << ": building menus failed: " <<  ex.what();
   }
 
   //Get the menu:
@@ -528,7 +528,7 @@ void Dialog_RelationshipsOverview::setup_context_menu()
   }
   catch(const Glib::Error& ex)
   {
-    std::cerr << "building menus failed: " <<  ex.what();
+    std::cerr << G_STRFUNC << ": building menus failed: " <<  ex.what();
   }
 
   //Get the menu:
diff --git a/glom/print_layout/canvas_print_layout.cc b/glom/print_layout/canvas_print_layout.cc
index c219d8d..2a8f837 100644
--- a/glom/print_layout/canvas_print_layout.cc
+++ b/glom/print_layout/canvas_print_layout.cc
@@ -309,7 +309,7 @@ void Canvas_PrintLayout::setup_context_menu()
   }
   catch(const Glib::Error& ex)
   {
-    std::cerr << "building menus failed: " <<  ex.what();
+    std::cerr << G_STRFUNC << ": building menus failed: " <<  ex.what();
   }
 
   //Get the menu:
diff --git a/glom/utility_widgets/adddel/adddel.cc b/glom/utility_widgets/adddel/adddel.cc
index b551df3..943589c 100644
--- a/glom/utility_widgets/adddel/adddel.cc
+++ b/glom/utility_widgets/adddel/adddel.cc
@@ -125,7 +125,7 @@ void AddDel::init()
   m_TreeView.signal_columns_changed().connect( sigc::mem_fun(*this, &AddDel::on_treeview_columns_changed) );
   //add_blank();
 
-  setup_menu();
+  setup_menu(this);
   signal_button_press_event().connect(sigc::mem_fun(*this, &AddDel::on_button_press_event_Popup));
 
   set_prevent_user_signals(false);
@@ -226,7 +226,7 @@ void AddDel::on_MenuPopup_activate_Delete()
   }
 }
 
-void AddDel::setup_menu()
+void AddDel::setup_menu(Gtk::Widget* /* widget */)
 {
   m_refActionGroup = Gtk::ActionGroup::create();
   m_refActionGroup->add(Gtk::Action::create("ContextMenu", "Context Menu") );
@@ -262,7 +262,7 @@ void AddDel::setup_menu()
   }
   catch(const Glib::Error& ex)
   {
-    std::cerr << "building menus failed: " <<  ex.what();
+    std::cerr << G_STRFUNC << ": building menus failed: " <<  ex.what();
   }
 
   //Get the menu:
diff --git a/glom/utility_widgets/adddel/adddel.h b/glom/utility_widgets/adddel/adddel.h
index 408793a..c3bf214 100644
--- a/glom/utility_widgets/adddel/adddel.h
+++ b/glom/utility_widgets/adddel/adddel.h
@@ -225,7 +225,7 @@ protected:
    */
   Gtk::TreeModel::iterator add_item_placeholder(); //Return index of new row.
 
-  void setup_menu();
+  void setup_menu(Gtk::Widget* widget);
   Glib::ustring treeview_get_key(const Gtk::TreeModel::iterator& row);
 
   ///Add a blank row, or return the existing blank row if there already is one.
diff --git a/glom/utility_widgets/adddel/adddel_withbuttons.cc 
b/glom/utility_widgets/adddel/adddel_withbuttons.cc
index 3044cce..81f735e 100644
--- a/glom/utility_widgets/adddel/adddel_withbuttons.cc
+++ b/glom/utility_widgets/adddel/adddel_withbuttons.cc
@@ -131,7 +131,7 @@ void AddDel_WithButtons::set_allow_user_actions(bool bVal)
   }
 
   //Recreate popup menu with correct items:
-  setup_menu();
+  setup_menu(this);
 }
 
 void AddDel_WithButtons::setup_buttons()
diff --git a/glom/utility_widgets/canvas/test_canvas_editable.cc 
b/glom/utility_widgets/canvas/test_canvas_editable.cc
index a64071d..77c3af5 100644
--- a/glom/utility_widgets/canvas/test_canvas_editable.cc
+++ b/glom/utility_widgets/canvas/test_canvas_editable.cc
@@ -204,7 +204,7 @@ private:
     }
     catch(const Glib::Error& ex)
     {
-      std::cerr << "building menus failed: " <<  ex.what();
+      std::cerr << G_STRFUNC << ": building menus failed: " <<  ex.what();
     }
 
     //Get the menu:
diff --git a/glom/utility_widgets/imageglom.cc b/glom/utility_widgets/imageglom.cc
index a4d4973..0bd81de 100644
--- a/glom/utility_widgets/imageglom.cc
+++ b/glom/utility_widgets/imageglom.cc
@@ -78,7 +78,7 @@ void ImageGlom::init()
   m_read_only = false;
 
 #ifndef GLOM_ENABLE_CLIENT_ONLY
-  setup_menu();
+  setup_menu(this);
 #endif // !GLOM_ENABLE_CLIENT_ONLY
 
   setup_menu_usermode();
@@ -991,7 +991,7 @@ void ImageGlom::setup_menu_usermode()
   }
   catch(const Glib::Error& ex)
   {
-    std::cerr << "building menus failed: " <<  ex.what();
+    std::cerr << G_STRFUNC << ": building menus failed: " <<  ex.what();
   }
 
   //Get the menu:
diff --git a/glom/utility_widgets/layoutwidgetmenu.cc b/glom/utility_widgets/layoutwidgetmenu.cc
index 9f371fb..f7d7150 100644
--- a/glom/utility_widgets/layoutwidgetmenu.cc
+++ b/glom/utility_widgets/layoutwidgetmenu.cc
@@ -22,6 +22,7 @@
 #include <glibmm/i18n.h>
 #include <glom/appwindow.h>
 #include "../mode_data/flowtablewithfields.h"
+#include <giomm/menu.h>
 #include <iostream>
 
 namespace Glom
@@ -33,18 +34,17 @@ LayoutWidgetMenu::LayoutWidgetMenu()
 #endif
 {
   #ifndef GLOM_ENABLE_CLIENT_ONLY
-  m_refActionGroup = Gtk::ActionGroup::create();
-
-  m_refActionGroup->add(Gtk::Action::create("ContextMenu", "Context Menu") );
-  m_refContextLayout =  Gtk::Action::create("ContextLayout", _("Choose Field"));
-  m_refContextLayoutProperties =  Gtk::Action::create("ContextLayoutProperties", _("Field Layout 
Properties"));
-  m_refContextAddField =  Gtk::Action::create("ContextAddField", _("Add Field"));
-  m_refContextAddRelatedRecords =  Gtk::Action::create("ContextAddRelatedRecords", _("Add Related Records"));
-  m_refContextAddNotebook =  Gtk::Action::create("ContextAddNotebook", _("Add Notebook"));
-  m_refContextAddGroup =  Gtk::Action::create("ContextAddGroup", _("Add Group"));
-  m_refContextAddButton =  Gtk::Action::create("ContextAddButton", _("Add Button"));
-  m_refContextAddText =  Gtk::Action::create("ContextAddText", _("Add Text"));
-  m_refContextDelete = Gtk::Action::create("ContextDelete", _("_Delete"));
+  m_refActionGroup = Gio::SimpleActionGroup::create();
+
+  m_refContextLayout = Gio::SimpleAction::create("choose-field");
+  m_refContextLayoutProperties = Gio::SimpleAction::create("field-layout-properties");
+  m_refContextAddField = Gio::SimpleAction::create("add-field");
+  m_refContextAddRelatedRecords = Gio::SimpleAction::create("add-related-records");
+  m_refContextAddNotebook = Gio::SimpleAction::create("add-notebook");
+  m_refContextAddGroup = Gio::SimpleAction::create("add-group");
+  m_refContextAddButton = Gio::SimpleAction::create("add-button");
+  m_refContextAddText = Gio::SimpleAction::create("add-text");
+  m_refContextDelete = Gio::SimpleAction::create("delete");
 #endif // !GLOM_ENABLE_CLIENT_ONLY
 }
 
@@ -53,33 +53,50 @@ LayoutWidgetMenu::~LayoutWidgetMenu()
 }
 
 #ifndef GLOM_ENABLE_CLIENT_ONLY
-void LayoutWidgetMenu::setup_menu()
+
+void LayoutWidgetMenu::add_action(const Glib::RefPtr<Gio::SimpleAction>& action, const 
Gio::ActionMap::ActivateSlot& slot)
 {
-  m_refActionGroup->add(m_refContextLayout,
+  if(!action)
+    return;
+
+  m_refActionGroup->add_action(m_refContextLayout);
+  action->signal_activate().connect(
+    sigc::hide(slot));
+}
+
+void LayoutWidgetMenu::setup_menu(Gtk::Widget* widget)
+{
+  if(!widget)
+  {
+    std::cerr << G_STRFUNC << ": parent is NULL." << std::endl;
+    return;
+  }
+
+  add_action(m_refContextLayout,
     sigc::mem_fun(*this, &LayoutWidgetMenu::on_menupopup_activate_layout) );
 
-  m_refActionGroup->add(m_refContextLayoutProperties,
+  add_action(m_refContextLayoutProperties,
     sigc::mem_fun(*this, &LayoutWidgetMenu::on_menupopup_activate_layout_properties) );
 
-  m_refActionGroup->add(m_refContextAddField,
+  add_action(m_refContextAddField,
     sigc::bind( sigc::mem_fun(*this, &LayoutWidgetMenu::on_menupopup_add_item), TYPE_FIELD ) );
 
-  m_refActionGroup->add(m_refContextAddRelatedRecords,
+  add_action(m_refContextAddRelatedRecords,
     sigc::bind( sigc::mem_fun(*this, &LayoutWidgetMenu::on_menupopup_add_item), TYPE_PORTAL ) );
 
-  m_refActionGroup->add(m_refContextAddGroup,
+  add_action(m_refContextAddGroup,
     sigc::bind( sigc::mem_fun(*this, &LayoutWidgetMenu::on_menupopup_add_item), TYPE_GROUP ) );
 
-  m_refActionGroup->add(m_refContextAddNotebook,
+  add_action(m_refContextAddNotebook,
     sigc::bind( sigc::mem_fun(*this, &LayoutWidgetMenu::on_menupopup_add_item), TYPE_NOTEBOOK ) );
 
-  m_refActionGroup->add(m_refContextAddButton,
+  add_action(m_refContextAddButton,
     sigc::bind( sigc::mem_fun(*this, &LayoutWidgetMenu::on_menupopup_add_item), TYPE_BUTTON ) );
 
-  m_refActionGroup->add(m_refContextAddText,
+  add_action(m_refContextAddText,
     sigc::bind( sigc::mem_fun(*this, &LayoutWidgetMenu::on_menupopup_add_item), TYPE_TEXT ) );
   
-  m_refActionGroup->add(m_refContextDelete,
+  add_action(m_refContextDelete,
     sigc::mem_fun(*this, &LayoutWidgetMenu::on_menupopup_activate_delete) );
 
   //TODO: This does not work until this widget is in a container in the window:s
@@ -98,45 +115,76 @@ void LayoutWidgetMenu::setup_menu()
     pApp->update_userlevel_ui(); //Update our action's sensitivity. 
   }
 
-  m_refUIManager = Gtk::UIManager::create();
-
-  m_refUIManager->insert_action_group(m_refActionGroup);
+  Glib::RefPtr<Gtk::Builder> builder = Gtk::Builder::create();
 
   //TODO: add_accel_group(m_refUIManager->get_accel_group());
 
+  const Glib::ustring ui_info =
+    "<interface>"
+    "  <menu id='ContextMenu'>"
+    "    <section>"
+    "      <item>"
+    "        <attribute name='label' translatable='yes'>Choose Field</attribute>"
+    "        <attribute name='action'>context.choose-field</attribute>"
+    "      </item>"
+    "      <item>"
+    "        <attribute name='label' translatable='yes'>Field Layout Properties</attribute>"
+    "        <attribute name='action'>context.field-layout-properties</attribute>"
+    "      </item>"
+    "      <item>"
+    "        <attribute name='label' translatable='yes'>Add Related Records</attribute>"
+    "        <attribute name='action'>context.add-related-records</attribute>"
+    "      </item>"
+    "      <item>"
+    "        <attribute name='label' translatable='yes'>Add Notebook</attribute>"
+    "        <attribute name='action'>context.add-notebook</attribute>"
+    "      </item>"
+    "      <item>"
+    "        <attribute name='label' translatable='yes'>Add Group</attribute>"
+    "        <attribute name='action'>context.add-group</attribute>"
+    "      </item>"
+    "      <item>"
+    "        <attribute name='label' translatable='yes'>Add Button</attribute>"
+    "        <attribute name='action'>context.add-button</attribute>"
+    "      </item>"
+    "      <item>"
+    "        <attribute name='label' translatable='yes'>Add Text</attribute>"
+    "        <attribute name='action'>context.add-text</attribute>"
+    "      </item>"
+    "    </section>"
+    "    <section>"
+    "      <item>"
+    "        <attribute name='label' translatable='yes'>Delete</attribute>"
+    "        <attribute name='action'>context.delete</attribute>"
+    "      </item>"
+    "    </section>"
+    "  </menu>"
+    "</interface>";
+
   try
   {
-    Glib::ustring ui_info = 
-        "<ui>"
-        "  <popup name='ContextMenu'>"
-        "    <menuitem action='ContextLayout'/>"
-        "    <menuitem action='ContextLayoutProperties'/>"
-        "    <menuitem action='ContextAddField'/>"
-        "    <menuitem action='ContextAddRelatedRecords'/>"
-        "    <menuitem action='ContextAddNotebook'/>"
-        "    <menuitem action='ContextAddGroup'/>"
-        "    <menuitem action='ContextAddButton'/>"
-        "    <menuitem action='ContextAddText'/>"
-        "    <separator />"
-        "    <menuitem action='ContextDelete' />"
-        "  </popup>"
-        "</ui>";
-
-    m_refUIManager->add_ui_from_string(ui_info);
+    builder->add_from_string(ui_info);
   }
   catch(const Glib::Error& ex)
   {
-    std::cerr << "building menus failed: " <<  ex.what();
+    std::cerr << G_STRFUNC << ": building menus failed: " <<  ex.what();
   }
 
   //Get the menu:
-  m_pMenuPopup = dynamic_cast<Gtk::Menu*>( m_refUIManager->get_widget("/ContextMenu") ); 
-  if(!m_pMenuPopup)
-    g_warning("menu not found");
+  Glib::RefPtr<Glib::Object> object =
+    builder->get_object("ContextMenu");
+  Glib::RefPtr<Gio::Menu> gmenu =
+    Glib::RefPtr<Gio::Menu>::cast_dynamic(object);
+  if(!gmenu)
+    g_warning("GMenu not found");
 
+  m_pMenuPopup = new Gtk::Menu(gmenu);
 
   if(pApp)
-    m_refContextLayout->set_sensitive(pApp->get_userlevel() == AppState::USERLEVEL_DEVELOPER);
+    m_refContextLayout->set_enabled(pApp->get_userlevel() == AppState::USERLEVEL_DEVELOPER);
+
+  //Make our popup menu work:
+  widget->insert_action_group("context", m_refActionGroup);
 }
 
 void LayoutWidgetMenu::on_menupopup_add_item(enumType item)
diff --git a/glom/utility_widgets/layoutwidgetmenu.h b/glom/utility_widgets/layoutwidgetmenu.h
index 06e5988..768d7a7 100644
--- a/glom/utility_widgets/layoutwidgetmenu.h
+++ b/glom/utility_widgets/layoutwidgetmenu.h
@@ -22,7 +22,9 @@
 #define GLOM_MODE_DATA_LAYOUT_WIDGET_MENU_H
 
 #include "layoutwidgetbase.h"
-#include <gtkmm/uimanager.h>
+#include <gtkmm/builder.h>
+#include <gtkmm/menu.h>
+#include <giomm/simpleactiongroup.h>
 
 namespace Glom
 {
@@ -35,7 +37,11 @@ public:
   
   //Popup-menu:
 #ifndef GLOM_ENABLE_CLIENT_ONLY
-  virtual void setup_menu();
+  /**
+   * @widget The widget instance, such as "this" in a derived class.
+   */
+  virtual void setup_menu(Gtk::Widget* widget); //TODO: Make this protected?
+
   virtual void on_menupopup_activate_layout();
   virtual void on_menupopup_activate_layout_properties();
   virtual void on_menupopup_add_item(enumType item);
@@ -47,14 +53,16 @@ protected:
   Gtk::Menu* m_pMenuPopup;
 
   //TODO_Performance: //Presumably we waste lots of memory by having this in each layout widget. Maybe we 
can use one shared menu.
-  Glib::RefPtr<Gtk::ActionGroup> m_refActionGroup;
-  Glib::RefPtr<Gtk::UIManager> m_refUIManager;
+  Glib::RefPtr<Gio::SimpleActionGroup> m_refActionGroup;
 
-  Glib::RefPtr<Gtk::Action> m_refContextLayout, m_refContextLayoutProperties;
-  Glib::RefPtr<Gtk::Action> m_refContextAddField, m_refContextAddRelatedRecords, 
+  Glib::RefPtr<Gio::SimpleAction> m_refContextLayout, m_refContextLayoutProperties;
+  Glib::RefPtr<Gio::SimpleAction> m_refContextAddField, m_refContextAddRelatedRecords, 
     m_refContextAddGroup, m_refContextAddNotebook, m_refContextAddButton, m_refContextAddText;
-  Glib::RefPtr<Gtk::Action> m_refContextDelete;
+  Glib::RefPtr<Gio::SimpleAction> m_refContextDelete;
 #endif // GLOM_ENABLE_CLIENT_ONLY
+
+private:
+  void add_action(const Glib::RefPtr<Gio::SimpleAction>& action, const Gio::ActionMap::ActivateSlot& slot);
 };
 
 } //namespace Glom
diff --git a/glom/utility_widgets/layoutwidgetutils.cc b/glom/utility_widgets/layoutwidgetutils.cc
index d24542f..dc99524 100644
--- a/glom/utility_widgets/layoutwidgetutils.cc
+++ b/glom/utility_widgets/layoutwidgetutils.cc
@@ -72,7 +72,7 @@ void LayoutWidgetUtils::setup_util_menu()
   }
   catch(const Glib::Error& ex)
   {
-    std::cerr << "building menus failed: " <<  ex.what();
+    std::cerr << G_STRFUNC << ": building menus failed: " <<  ex.what();
   }
 
   //Get the menu:
diff --git a/glom/utility_widgets/notebookglom.cc b/glom/utility_widgets/notebookglom.cc
index 51bc6ef..e19fc1e 100644
--- a/glom/utility_widgets/notebookglom.cc
+++ b/glom/utility_widgets/notebookglom.cc
@@ -30,10 +30,6 @@ namespace Glom
 NotebookGlom::NotebookGlom(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& /* builder */)
 : Gtk::Notebook(cobject)
 {
-#ifndef GLOM_ENABLE_CLIENT_ONLY
-  setup_menu();
-#endif // !GLOM_ENABLE_CLIENT_ONLY
-
   init();
 
   //set_size_request(400, -1); //It doesn't seem to demand the space used by its children.
@@ -41,11 +37,7 @@ NotebookGlom::NotebookGlom(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Buil
 
 NotebookGlom::NotebookGlom()
 {
-#ifndef GLOM_ENABLE_CLIENT_ONLY
-  setup_menu();
-#endif // !GLOM_ENABLE_CLIENT_ONLY
-
-init();
+  init();
 
   //set_size_request(400, -1); //It doesn't seem to demand the space used by its children.
 }
@@ -56,7 +48,9 @@ NotebookGlom::~NotebookGlom()
 
 void NotebookGlom::init()
 {
-
+#ifndef GLOM_ENABLE_CLIENT_ONLY
+  setup_menu(this);
+#endif // !GLOM_ENABLE_CLIENT_ONLY
 }
 
 AppWindow* NotebookGlom::get_appwindow() const
diff --git a/glom/utility_widgets/notebooklabelglom.cc b/glom/utility_widgets/notebooklabelglom.cc
index 2afd27f..efb4381 100644
--- a/glom/utility_widgets/notebooklabelglom.cc
+++ b/glom/utility_widgets/notebooklabelglom.cc
@@ -53,7 +53,7 @@ void NotebookLabel::init()
   m_label.show();
   set_events (Gdk::ALL_EVENTS_MASK);
   set_visible_window (false);
-  setup_menu();
+  setup_menu(this);
 }
 
 void NotebookLabel::set_label (const Glib::ustring& title)
@@ -107,7 +107,7 @@ void NotebookLabel::on_menu_delete_activate()
   }
 }
 
-void NotebookLabel::setup_menu()
+void NotebookLabel::setup_menu(Gtk::Widget* /* widget */)
 {
   m_refUIManager = Gtk::UIManager::create();
   m_refActionGroup = Gtk::ActionGroup::create();
@@ -138,7 +138,7 @@ void NotebookLabel::setup_menu()
   }
   catch(const Glib::Error& ex)
   {
-    std::cerr << "building menus failed: " <<  ex.what();
+    std::cerr << G_STRFUNC << ": building menus failed: " <<  ex.what();
   }
 
   //Get the menu:
diff --git a/glom/utility_widgets/notebooklabelglom.h b/glom/utility_widgets/notebooklabelglom.h
index 6c7d999..1eed1d4 100644
--- a/glom/utility_widgets/notebooklabelglom.h
+++ b/glom/utility_widgets/notebooklabelglom.h
@@ -26,6 +26,7 @@
 #include <gtkmm/label.h>
 #include <gtkmm/menu.h>
 #include <gtkmm/builder.h>
+#include <gtkmm/uimanager.h>
 
 namespace Glom
 {
@@ -50,7 +51,7 @@ private:
   Gtk::Label m_label;
   NotebookGlom* m_notebook;
   
-  void setup_menu();
+  void setup_menu(Gtk::Widget* widget);
   Gtk::Menu* m_pPopupMenu;
   
   void on_menu_new_group_activate();


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