[gedit/wip/redesign2] Start redesign of gedit



commit 2fa193c350748469c3e403d1cd15e19707cf2dde
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Fri May 3 10:51:14 2013 +0200

    Start redesign of gedit

 gedit/Makefile.am                                  |    8 +-
 gedit/gedit-app.c                                  |   71 +-
 gedit/gedit-commands-documents.c                   |   39 +-
 gedit/gedit-commands-edit.c                        |   49 +-
 gedit/gedit-commands-file-print.c                  |   21 +-
 gedit/gedit-commands-file.c                        |   58 +-
 gedit/gedit-commands-search.c                      |   38 +-
 gedit/gedit-commands-view.c                        |  101 +-
 gedit/gedit-commands.h                             |  183 ++-
 gedit/gedit-menu.ui                                |   16 +
 ...open-tool-button.c => gedit-open-menu-button.c} |   73 +-
 gedit/gedit-open-menu-button.h                     |   57 +
 gedit/gedit-open-tool-button.h                     |   60 -
 gedit/gedit-preferences-dialog.ui                  |    1 -
 gedit/gedit-ui.h                                   |  187 ---
 gedit/gedit-ui.xml                                 |  119 --
 gedit/gedit-window-private.h                       |   21 +-
 gedit/gedit-window.c                               | 1622 ++++++--------------
 gedit/gedit-window.ui                              |  436 ++++++
 gedit/gedit.gresource.xml                          |    1 +
 20 files changed, 1369 insertions(+), 1792 deletions(-)
---
diff --git a/gedit/Makefile.am b/gedit/Makefile.am
index 743ce39..9b5b9a9 100644
--- a/gedit/Makefile.am
+++ b/gedit/Makefile.am
@@ -113,7 +113,7 @@ NOINST_H_FILES =                    \
        gedit-multi-notebook.h          \
        gedit-notebook.h                \
        gedit-notebook-popup-menu.h     \
-       gedit-open-tool-button.h        \
+       gedit-open-menu-button.h        \
        gedit-plugins-engine.h          \
        gedit-preferences-dialog.h      \
        gedit-print-job.h               \
@@ -122,7 +122,6 @@ NOINST_H_FILES =                    \
        gedit-settings.h                \
        gedit-status-menu-button.h      \
        gedit-tab-label.h               \
-       gedit-ui.h                      \
        gedit-view-frame.h              \
        gedit-window-private.h
 
@@ -196,7 +195,7 @@ libgedit_c_files =                  \
        gedit-multi-notebook.c          \
        gedit-notebook.c                \
        gedit-notebook-popup-menu.c     \
-       gedit-open-tool-button.c        \
+       gedit-open-menu-button.c        \
        gedit-panel.c                   \
        gedit-plugins-engine.c          \
        gedit-preferences-dialog.c      \
@@ -267,7 +266,8 @@ EXTRA_DIST =                                \
        gedit-progress-info-bar.ui      \
        gedit-status-menu-button.ui     \
        gedit-view-frame.ui             \
-       gedit-highlight-mode-dialog.ui
+       gedit-highlight-mode-dialog.ui  \
+       gedit-window.ui
 
 CLEANFILES = $(BUILT_SOURCES) $(BUILT_SOURCES_PRIVATE)
 
diff --git a/gedit/gedit-app.c b/gedit/gedit-app.c
index 29553cf..713b8db 100644
--- a/gedit/gedit-app.c
+++ b/gedit/gedit-app.c
@@ -83,6 +83,7 @@ struct _GeditAppPrivate
        GtkPrintSettings  *print_settings;
 
        GObject           *settings;
+       GSettings         *ui_settings;
        GSettings         *window_settings;
 
        PeasExtensionSet  *extensions;
@@ -192,6 +193,7 @@ gedit_app_dispose (GObject *object)
 {
        GeditApp *app = GEDIT_APP (object);
 
+       g_clear_object (&app->priv->ui_settings);
        g_clear_object (&app->priv->window_settings);
        g_clear_object (&app->priv->settings);
 
@@ -373,7 +375,7 @@ quit_activated (GSimpleAction *action,
                 GVariant      *parameter,
                 gpointer       user_data)
 {
-       _gedit_cmd_file_quit (NULL, NULL);
+       _gedit_cmd_file_quit (NULL, NULL, NULL);
 }
 
 static GActionEntry app_entries[] = {
@@ -452,6 +454,7 @@ gedit_app_startup (GApplication *application)
 
        /* Load settings */
        app->priv->settings = gedit_settings_new ();
+       app->priv->ui_settings = g_settings_new ("org.gnome.gedit.preferences.ui");
        app->priv->window_settings = g_settings_new ("org.gnome.gedit.state.window");
 
        /* initial lockdown state */
@@ -461,12 +464,28 @@ gedit_app_startup (GApplication *application)
        if (_gedit_app_has_app_menu (app))
        {
                GtkBuilder *builder;
+               GAction *action;
                GError *error = NULL;
 
                g_action_map_add_action_entries (G_ACTION_MAP (app),
-                                                app_entries,
-                                                G_N_ELEMENTS (app_entries),
-                                                app);
+                                                app_entries,
+                                                G_N_ELEMENTS (app_entries),
+                                                app);
+
+               action = g_settings_create_action (app->priv->ui_settings,
+                                                  "statusbar-visible");
+               g_action_map_add_action (G_ACTION_MAP (app), action);
+               g_object_unref (action);
+
+               action = g_settings_create_action (app->priv->ui_settings,
+                                                  "side-panel-visible");
+               g_action_map_add_action (G_ACTION_MAP (app), action);
+               g_object_unref (action);
+
+               action = g_settings_create_action (app->priv->ui_settings,
+                                                  "bottom-panel-visible");
+               g_action_map_add_action (G_ACTION_MAP (app), action);
+               g_object_unref (action);
 
                builder = gtk_builder_new ();
                if (!gtk_builder_add_from_resource (builder,
@@ -488,6 +507,48 @@ gedit_app_startup (GApplication *application)
                g_object_unref (builder);
        }
 
+       /* Accelerators */
+       gtk_application_add_accelerator (GTK_APPLICATION (application),
+                                        "<Control>O", "win.open", NULL);
+       gtk_application_add_accelerator (GTK_APPLICATION (application),
+                                        "<Control>S", "win.save", NULL);
+       gtk_application_add_accelerator (GTK_APPLICATION (application),
+                                        "<Control><Shift>S", "win.save_as", NULL);
+       gtk_application_add_accelerator (GTK_APPLICATION (application),
+                                        "<Control><Shift>L", "win.save_all", NULL);
+       gtk_application_add_accelerator (GTK_APPLICATION (application),
+                                        "<Control>T", "win.new_tab", NULL);
+       gtk_application_add_accelerator (GTK_APPLICATION (application),
+                                        "<Control>W", "win.close", NULL);
+       gtk_application_add_accelerator (GTK_APPLICATION (application),
+                                        "<Control><Shift>W", "win.close_all", NULL);
+       gtk_application_add_accelerator (GTK_APPLICATION (application),
+                                        "<Control>F", "win.find", NULL);
+       gtk_application_add_accelerator (GTK_APPLICATION (application),
+                                        "<Control>H", "win.replace", NULL);
+       gtk_application_add_accelerator (GTK_APPLICATION (application),
+                                        "<Control><Shift>K", "win.clear_highlight", NULL);
+       gtk_application_add_accelerator (GTK_APPLICATION (application),
+                                        "<Control>I", "win.goto_line", NULL);
+       gtk_application_add_accelerator (GTK_APPLICATION (application),
+                                        "<Control>P", "win.print", NULL);
+       gtk_application_add_accelerator (GTK_APPLICATION (application),
+                                        "F11", "win.fullscreen", NULL);
+       gtk_application_add_accelerator (GTK_APPLICATION (application),
+                                        "<Control><Alt>N", "win.new_tab_group", NULL);
+       gtk_application_add_accelerator (GTK_APPLICATION (application),
+                                        "<Control><Shift><Alt>Page_Up",
+                                        "win.previous_tab_group", NULL);
+       gtk_application_add_accelerator (GTK_APPLICATION (application),
+                                        "<Control><Shift><Alt>Page_Down",
+                                        "win.next_tab_group", NULL);
+       gtk_application_add_accelerator (GTK_APPLICATION (application),
+                                        "<Control><Alt>Page_Up",
+                                        "win.previous_document", NULL);
+       gtk_application_add_accelerator (GTK_APPLICATION (application),
+                                        "<Control><Alt>Page_Down",
+                                        "win.next_document", NULL);
+
        /*
         * We use the default gtksourceview style scheme manager so that plugins
         * can obtain it easily without a gedit specific api, but we need to
@@ -1120,7 +1181,7 @@ window_delete_event (GeditWindow *window,
                return TRUE;
        }
 
-       _gedit_cmd_file_quit (NULL, window);
+       _gedit_cmd_file_quit (NULL, NULL, window);
 
        /* Do not destroy the window */
        return TRUE;
diff --git a/gedit/gedit-commands-documents.c b/gedit/gedit-commands-documents.c
index b079f3f..c67ea1f 100644
--- a/gedit/gedit-commands-documents.c
+++ b/gedit/gedit-commands-documents.c
@@ -43,9 +43,11 @@
 #include "gedit-debug.h"
 
 void
-_gedit_cmd_documents_previous_document (GtkAction   *action,
-                                       GeditWindow *window)
+_gedit_cmd_documents_previous_document (GSimpleAction *action,
+                                        GVariant      *parameter,
+                                        gpointer       user_data)
 {
+       GeditWindow *window = GEDIT_WINDOW (user_data);
        GtkNotebook *notebook;
 
        gedit_debug (DEBUG_COMMANDS);
@@ -55,9 +57,11 @@ _gedit_cmd_documents_previous_document (GtkAction   *action,
 }
 
 void
-_gedit_cmd_documents_next_document (GtkAction   *action,
-                                   GeditWindow *window)
+_gedit_cmd_documents_next_document (GSimpleAction *action,
+                                    GVariant      *parameter,
+                                    gpointer       user_data)
 {
+       GeditWindow *window = GEDIT_WINDOW (user_data);
        GtkNotebook *notebook;
 
        gedit_debug (DEBUG_COMMANDS);
@@ -67,9 +71,11 @@ _gedit_cmd_documents_next_document (GtkAction   *action,
 }
 
 void
-_gedit_cmd_documents_move_to_new_window (GtkAction   *action,
-                                        GeditWindow *window)
+_gedit_cmd_documents_move_to_new_window (GSimpleAction *action,
+                                         GVariant      *parameter,
+                                         gpointer       user_data)
 {
+       GeditWindow *window = GEDIT_WINDOW (user_data);
        GeditTab *tab;
 
        gedit_debug (DEBUG_COMMANDS);
@@ -84,24 +90,27 @@ _gedit_cmd_documents_move_to_new_window (GtkAction   *action,
 
 /* Methods releated with the tab groups */
 void
-_gedit_cmd_documents_new_tab_group (GtkAction   *action,
-                                   GeditWindow *window)
+_gedit_cmd_documents_new_tab_group (GSimpleAction *action,
+                                    GVariant      *parameter,
+                                    gpointer       user_data)
 {
-       gedit_multi_notebook_add_new_notebook (GEDIT_MULTI_NOTEBOOK (_gedit_window_get_multi_notebook 
(window)));
+       gedit_multi_notebook_add_new_notebook (GEDIT_MULTI_NOTEBOOK (_gedit_window_get_multi_notebook 
(GEDIT_WINDOW (user_data))));
 }
 
 void
-_gedit_cmd_documents_previous_tab_group (GtkAction   *action,
-                                        GeditWindow *window)
+_gedit_cmd_documents_previous_tab_group (GSimpleAction *action,
+                                         GVariant      *parameter,
+                                         gpointer       user_data)
 {
-       gedit_multi_notebook_previous_notebook (GEDIT_MULTI_NOTEBOOK (_gedit_window_get_multi_notebook 
(window)));
+       gedit_multi_notebook_previous_notebook (GEDIT_MULTI_NOTEBOOK (_gedit_window_get_multi_notebook 
(GEDIT_WINDOW (user_data))));
 }
 
 void
-_gedit_cmd_documents_next_tab_group (GtkAction   *action,
-                                    GeditWindow *window)
+_gedit_cmd_documents_next_tab_group (GSimpleAction *action,
+                                     GVariant      *parameter,
+                                     gpointer       user_data)
 {
-       gedit_multi_notebook_next_notebook (GEDIT_MULTI_NOTEBOOK (_gedit_window_get_multi_notebook (window)));
+       gedit_multi_notebook_next_notebook (GEDIT_MULTI_NOTEBOOK (_gedit_window_get_multi_notebook 
(GEDIT_WINDOW (user_data))));
 }
 
 /* ex:set ts=8 noet: */
diff --git a/gedit/gedit-commands-edit.c b/gedit/gedit-commands-edit.c
index 489484a..976af12 100644
--- a/gedit/gedit-commands-edit.c
+++ b/gedit/gedit-commands-edit.c
@@ -43,9 +43,11 @@
 #include "gedit-preferences-dialog.h"
 
 void
-_gedit_cmd_edit_undo (GtkAction   *action,
-                     GeditWindow *window)
+_gedit_cmd_edit_undo (GSimpleAction *action,
+                      GVariant      *parameter,
+                      gpointer       user_data)
 {
+       GeditWindow *window = GEDIT_WINDOW (user_data);
        GeditView *active_view;
        GtkSourceBuffer *active_document;
 
@@ -64,9 +66,11 @@ _gedit_cmd_edit_undo (GtkAction   *action,
 }
 
 void
-_gedit_cmd_edit_redo (GtkAction   *action,
-                     GeditWindow *window)
+_gedit_cmd_edit_redo (GSimpleAction *action,
+                      GVariant      *parameter,
+                      gpointer       user_data)
 {
+       GeditWindow *window = GEDIT_WINDOW (user_data);
        GeditView *active_view;
        GtkSourceBuffer *active_document;
 
@@ -85,9 +89,11 @@ _gedit_cmd_edit_redo (GtkAction   *action,
 }
 
 void
-_gedit_cmd_edit_cut (GtkAction   *action,
-                    GeditWindow *window)
+_gedit_cmd_edit_cut (GSimpleAction *action,
+                     GVariant      *parameter,
+                     gpointer       user_data)
 {
+       GeditWindow *window = GEDIT_WINDOW (user_data);
        GeditView *active_view;
 
        gedit_debug (DEBUG_COMMANDS);
@@ -101,9 +107,11 @@ _gedit_cmd_edit_cut (GtkAction   *action,
 }
 
 void
-_gedit_cmd_edit_copy (GtkAction   *action,
-                     GeditWindow *window)
+_gedit_cmd_edit_copy (GSimpleAction *action,
+                      GVariant      *parameter,
+                      gpointer       user_data)
 {
+       GeditWindow *window = GEDIT_WINDOW (user_data);
        GeditView *active_view;
 
        gedit_debug (DEBUG_COMMANDS);
@@ -117,9 +125,11 @@ _gedit_cmd_edit_copy (GtkAction   *action,
 }
 
 void
-_gedit_cmd_edit_paste (GtkAction   *action,
-                      GeditWindow *window)
+_gedit_cmd_edit_paste (GSimpleAction *action,
+                       GVariant      *parameter,
+                       gpointer       user_data)
 {
+       GeditWindow *window = GEDIT_WINDOW (user_data);
        GeditView *active_view;
 
        gedit_debug (DEBUG_COMMANDS);
@@ -133,9 +143,11 @@ _gedit_cmd_edit_paste (GtkAction   *action,
 }
 
 void
-_gedit_cmd_edit_delete (GtkAction   *action,
-                       GeditWindow *window)
+_gedit_cmd_edit_delete (GSimpleAction *action,
+                        GVariant      *parameter,
+                        gpointer       user_data)
 {
+       GeditWindow *window = GEDIT_WINDOW (user_data);
        GeditView *active_view;
 
        gedit_debug (DEBUG_COMMANDS);
@@ -149,9 +161,11 @@ _gedit_cmd_edit_delete (GtkAction   *action,
 }
 
 void
-_gedit_cmd_edit_select_all (GtkAction   *action,
-                           GeditWindow *window)
+_gedit_cmd_edit_select_all (GSimpleAction *action,
+                            GVariant      *parameter,
+                            gpointer       user_data)
 {
+       GeditWindow *window = GEDIT_WINDOW (user_data);
        GeditView *active_view;
 
        gedit_debug (DEBUG_COMMANDS);
@@ -165,9 +179,12 @@ _gedit_cmd_edit_select_all (GtkAction   *action,
 }
 
 void
-_gedit_cmd_edit_preferences (GtkAction   *action,
-                            GeditWindow *window)
+_gedit_cmd_edit_preferences (GSimpleAction *action,
+                             GVariant      *parameter,
+                             gpointer       user_data)
 {
+       GeditWindow *window = GEDIT_WINDOW (user_data);
+
        gedit_debug (DEBUG_COMMANDS);
 
        gedit_show_preferences_dialog (window);
diff --git a/gedit/gedit-commands-file-print.c b/gedit/gedit-commands-file-print.c
index 20646bd..ed3fcde 100644
--- a/gedit/gedit-commands-file-print.c
+++ b/gedit/gedit-commands-file-print.c
@@ -43,24 +43,11 @@
 #include "gedit-debug.h"
 
 void
-_gedit_cmd_file_print_preview (GtkAction   *action,
-                              GeditWindow *window)
-{
-       GeditTab *tab;
-
-       gedit_debug (DEBUG_COMMANDS);
-
-       tab = gedit_window_get_active_tab (window);
-       if (tab == NULL)
-               return;
-
-       _gedit_tab_print_preview (tab);
-}
-
-void
-_gedit_cmd_file_print (GtkAction   *action,
-                      GeditWindow *window)
+_gedit_cmd_file_print (GSimpleAction *action,
+                       GVariant      *parameter,
+                       gpointer       user_data)
 {
+       GeditWindow *window = GEDIT_WINDOW (user_data);
        GeditTab *tab;
 
        gedit_debug (DEBUG_COMMANDS);
diff --git a/gedit/gedit-commands-file.c b/gedit/gedit-commands-file.c
index fdf4654..fbd755b 100644
--- a/gedit/gedit-commands-file.c
+++ b/gedit/gedit-commands-file.c
@@ -64,9 +64,12 @@ static void tab_state_changed_while_saving (GeditTab    *tab,
                                            GeditWindow *window);
 
 void
-_gedit_cmd_file_new (GtkAction   *action,
-                    GeditWindow *window)
+_gedit_cmd_file_new (GSimpleAction *action,
+                     GVariant      *parameter,
+                     gpointer       user_data)
 {
+       GeditWindow *window = GEDIT_WINDOW (user_data);
+
        gedit_debug (DEBUG_COMMANDS);
 
        gedit_window_create_tab (window, TRUE);
@@ -417,9 +420,11 @@ open_dialog_response_cb (GeditFileChooserDialog *dialog,
 }
 
 void
-_gedit_cmd_file_open (GtkAction   *action,
-                     GeditWindow *window)
+_gedit_cmd_file_open (GSimpleAction *action,
+                      GVariant      *parameter,
+                      gpointer       user_data)
 {
+       GeditWindow *window = GEDIT_WINDOW (user_data);
        GtkWidget *open_dialog;
        gpointer data;
        GeditDocument *doc;
@@ -961,9 +966,11 @@ _gedit_cmd_file_save_tab (GeditTab    *tab,
 }
 
 void
-_gedit_cmd_file_save (GtkAction   *action,
-                      GeditWindow *window)
+_gedit_cmd_file_save (GSimpleAction *action,
+                      GVariant      *parameter,
+                      gpointer       user_data)
 {
+       GeditWindow *window = GEDIT_WINDOW (user_data);
        GeditTab *tab;
 
        gedit_debug (DEBUG_COMMANDS);
@@ -976,9 +983,11 @@ _gedit_cmd_file_save (GtkAction   *action,
 }
 
 void
-_gedit_cmd_file_save_as (GtkAction   *action,
-                         GeditWindow *window)
+_gedit_cmd_file_save_as (GSimpleAction *action,
+                         GVariant      *parameter,
+                         gpointer       user_data)
 {
+       GeditWindow *window = GEDIT_WINDOW (user_data);
        GeditTab *tab;
 
        gedit_debug (DEBUG_COMMANDS);
@@ -1129,10 +1138,11 @@ gedit_commands_save_all_documents (GeditWindow *window)
 }
 
 void
-_gedit_cmd_file_save_all (GtkAction   *action,
-                         GeditWindow *window)
+_gedit_cmd_file_save_all (GSimpleAction *action,
+                          GVariant      *parameter,
+                          gpointer       user_data)
 {
-       gedit_commands_save_all_documents (window);
+       gedit_commands_save_all_documents (GEDIT_WINDOW (user_data));
 }
 
 void
@@ -1317,9 +1327,11 @@ revert_dialog (GeditWindow   *window,
 }
 
 void
-_gedit_cmd_file_revert (GtkAction   *action,
-                       GeditWindow *window)
+_gedit_cmd_file_revert (GSimpleAction *action,
+                        GVariant      *parameter,
+                        gpointer       user_data)
 {
+       GeditWindow    *window = GEDIT_WINDOW (user_data);
        GeditTab       *tab;
        GeditDocument  *doc;
        GtkWidget      *dialog;
@@ -1816,9 +1828,11 @@ _gedit_cmd_file_close_tab (GeditTab    *tab,
 }
 
 void
-_gedit_cmd_file_close (GtkAction   *action,
-                      GeditWindow *window)
+_gedit_cmd_file_close (GSimpleAction *action,
+                       GVariant      *parameter,
+                       gpointer       user_data)
 {
+       GeditWindow *window = GEDIT_WINDOW (user_data);
        GeditTab *active_tab;
 
        gedit_debug (DEBUG_COMMANDS);
@@ -1906,9 +1920,12 @@ file_close_all (GeditWindow *window,
 }
 
 void
-_gedit_cmd_file_close_all (GtkAction   *action,
-                          GeditWindow *window)
+_gedit_cmd_file_close_all (GSimpleAction *action,
+                           GVariant      *parameter,
+                           gpointer       user_data)
 {
+       GeditWindow *window = GEDIT_WINDOW (user_data);
+
        gedit_debug (DEBUG_COMMANDS);
 
        g_return_if_fail (!(gedit_window_get_state (window) &
@@ -1949,9 +1966,12 @@ quit_all (void)
 }
 
 void
-_gedit_cmd_file_quit (GtkAction   *action,
-                      GeditWindow *window)
+_gedit_cmd_file_quit (GSimpleAction *action,
+                      GVariant      *parameter,
+                      gpointer       user_data)
 {
+       GeditWindow *window = GEDIT_WINDOW (user_data);
+
        gedit_debug (DEBUG_COMMANDS);
 
        if (window == NULL)
diff --git a/gedit/gedit-commands-search.c b/gedit/gedit-commands-search.c
index 64fb417..bebb803 100644
--- a/gedit/gedit-commands-search.c
+++ b/gedit/gedit-commands-search.c
@@ -563,9 +563,11 @@ create_dialog (GeditWindow *window)
 }
 
 void
-_gedit_cmd_search_find (GtkAction   *action,
-                       GeditWindow *window)
+_gedit_cmd_search_find (GSimpleAction *action,
+                        GVariant      *parameter,
+                        gpointer       user_data)
 {
+       GeditWindow *window = GEDIT_WINDOW (user_data);
        GeditTab *active_tab;
        GeditViewFrame *frame;
 
@@ -583,9 +585,11 @@ _gedit_cmd_search_find (GtkAction   *action,
 }
 
 void
-_gedit_cmd_search_replace (GtkAction   *action,
-                          GeditWindow *window)
+_gedit_cmd_search_replace (GSimpleAction *action,
+                           GVariant      *parameter,
+                           gpointer       user_data)
 {
+       GeditWindow *window = GEDIT_WINDOW (user_data);
        gpointer data;
        GtkWidget *replace_dialog;
 
@@ -611,27 +615,35 @@ _gedit_cmd_search_replace (GtkAction   *action,
 }
 
 void
-_gedit_cmd_search_find_next (GtkAction   *action,
-                            GeditWindow *window)
+_gedit_cmd_search_find_next (GSimpleAction *action,
+                             GVariant      *parameter,
+                             gpointer       user_data)
 {
+       GeditWindow *window = GEDIT_WINDOW (user_data);
+
        gedit_debug (DEBUG_COMMANDS);
 
        run_forward_search (window, FALSE);
 }
 
 void
-_gedit_cmd_search_find_prev (GtkAction   *action,
-                            GeditWindow *window)
+_gedit_cmd_search_find_prev (GSimpleAction *action,
+                             GVariant      *parameter,
+                             gpointer       user_data)
 {
+       GeditWindow *window = GEDIT_WINDOW (user_data);
+
        gedit_debug (DEBUG_COMMANDS);
 
        run_backward_search (window, FALSE);
 }
 
 void
-_gedit_cmd_search_clear_highlight (GtkAction   *action,
-                                  GeditWindow *window)
+_gedit_cmd_search_clear_highlight (GSimpleAction *action,
+                                   GVariant      *parameter,
+                                   gpointer       user_data)
 {
+       GeditWindow *window = GEDIT_WINDOW (user_data);
        GeditTab *active_tab;
        GeditViewFrame *frame;
        GeditDocument *doc;
@@ -653,9 +665,11 @@ _gedit_cmd_search_clear_highlight (GtkAction   *action,
 }
 
 void
-_gedit_cmd_search_goto_line (GtkAction   *action,
-                            GeditWindow *window)
+_gedit_cmd_search_goto_line (GSimpleAction *action,
+                             GVariant      *parameter,
+                             gpointer       user_data)
 {
+       GeditWindow *window = GEDIT_WINDOW (user_data);
        GeditTab *active_tab;
        GeditViewFrame *frame;
 
diff --git a/gedit/gedit-commands-view.c b/gedit/gedit-commands-view.c
index 2f42f05..26ff473 100644
--- a/gedit/gedit-commands-view.c
+++ b/gedit/gedit-commands-view.c
@@ -42,77 +42,13 @@
 #include "gedit-window-private.h"
 #include "gedit-highlight-mode-dialog.h"
 
-
-void
-_gedit_cmd_view_show_toolbar (GtkAction   *action,
-                             GeditWindow *window)
-{
-       gboolean visible;
-
-       gedit_debug (DEBUG_COMMANDS);
-
-       visible = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
-
-       gtk_widget_set_visible (window->priv->toolbar, visible);
-}
-
-void
-_gedit_cmd_view_show_statusbar (GtkAction   *action,
-                               GeditWindow *window)
-{
-       gboolean visible;
-
-       gedit_debug (DEBUG_COMMANDS);
-
-       visible = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
-
-       gtk_widget_set_visible (window->priv->statusbar, visible);
-}
-
-void
-_gedit_cmd_view_show_side_panel (GtkAction   *action,
-                                GeditWindow *window)
-{
-       gboolean visible;
-       GeditPanel *panel;
-
-       gedit_debug (DEBUG_COMMANDS);
-
-       visible = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
-       panel = gedit_window_get_side_panel (window);
-
-       gtk_widget_set_visible (GTK_WIDGET (panel), visible);
-
-       if (visible)
-       {
-               gtk_widget_grab_focus (GTK_WIDGET (panel));
-       }
-}
-
 void
-_gedit_cmd_view_show_bottom_panel (GtkAction   *action,
-                                  GeditWindow *window)
+_gedit_cmd_view_toggle_fullscreen_mode (GSimpleAction *action,
+                                        GVariant      *parameter,
+                                        gpointer       user_data)
 {
-       gboolean visible;
-       GeditPanel *panel;
-
-       gedit_debug (DEBUG_COMMANDS);
+       GeditWindow *window = GEDIT_WINDOW (user_data);
 
-       visible = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
-       panel = gedit_window_get_bottom_panel (window);
-
-       gtk_widget_set_visible (GTK_WIDGET (panel), visible);
-
-       if (visible)
-       {
-               gtk_widget_grab_focus (GTK_WIDGET (panel));
-       }
-}
-
-void
-_gedit_cmd_view_toggle_fullscreen_mode (GtkAction   *action,
-                                       GeditWindow *window)
-{
        gedit_debug (DEBUG_COMMANDS);
 
        if (_gedit_window_is_fullscreen (window))
@@ -122,22 +58,13 @@ _gedit_cmd_view_toggle_fullscreen_mode (GtkAction   *action,
 }
 
 void
-_gedit_cmd_view_leave_fullscreen_mode (GtkAction   *action,
-                                      GeditWindow *window)
+_gedit_cmd_view_leave_fullscreen_mode (GSimpleAction *action,
+                                       GVariant      *parameter,
+                                       gpointer       user_data)
 {
-       GtkAction *view_action;
-
-       view_action = gtk_action_group_get_action (window->priv->always_sensitive_action_group,
-                                                  "ViewFullscreen");
-       g_signal_handlers_block_by_func
-               (view_action, G_CALLBACK (_gedit_cmd_view_toggle_fullscreen_mode),
-                window);
-       gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (view_action),
-                                     FALSE);
+       GeditWindow *window = GEDIT_WINDOW (user_data);
+
        _gedit_window_unfullscreen (window);
-       g_signal_handlers_unblock_by_func (view_action,
-                                          G_CALLBACK (_gedit_cmd_view_toggle_fullscreen_mode),
-                                          window);
 }
 
 static void
@@ -156,15 +83,17 @@ on_language_selected (GeditHighlightModeDialog *dlg,
 }
 
 void
-_gedit_cmd_view_highlight_mode (GtkAction   *action,
-                                GeditWindow *window)
+_gedit_cmd_view_highlight_mode (GSimpleAction *action,
+                                GVariant      *parameter,
+                                gpointer       user_data)
 {
+       GtkWindow *window = GTK_WINDOW (user_data);
        GtkWidget *dlg;
        GeditDocument *doc;
 
-       dlg = gedit_highlight_mode_dialog_new (GTK_WINDOW (window));
+       dlg = gedit_highlight_mode_dialog_new (window);
 
-       doc = gedit_window_get_active_document (window);
+       doc = gedit_window_get_active_document (GEDIT_WINDOW (window));
        if (doc)
        {
                gedit_highlight_mode_dialog_select_language (GEDIT_HIGHLIGHT_MODE_DIALOG (dlg),
diff --git a/gedit/gedit-commands.h b/gedit/gedit-commands.h
index a711906..9f3a6b2 100644
--- a/gedit/gedit-commands.h
+++ b/gedit/gedit-commands.h
@@ -69,92 +69,115 @@ GSList             *_gedit_cmd_load_files_from_prompt      (GeditWindow         *window,
                                                         gint                 line_pos,
                                                         gint                 column_pos) 
G_GNUC_WARN_UNUSED_RESULT;
 
-void           _gedit_cmd_file_new                     (GtkAction   *action,
-                                                        GeditWindow *window);
-void           _gedit_cmd_file_open                    (GtkAction   *action,
-                                                        GeditWindow *window);
+void           _gedit_cmd_file_new                     (GSimpleAction *action,
+                                                         GVariant      *parameter,
+                                                         gpointer       user_data);
+void           _gedit_cmd_file_open                    (GSimpleAction *action,
+                                                         GVariant      *parameter,
+                                                         gpointer       user_data);
 void           _gedit_cmd_file_save_tab                (GeditTab    *tab,
                                                         GeditWindow *window);
 void           _gedit_cmd_file_save_as_tab             (GeditTab    *tab,
                                                         GeditWindow *window);
-void           _gedit_cmd_file_save                    (GtkAction   *action,
-                                                        GeditWindow *window);
-void           _gedit_cmd_file_save_as                 (GtkAction   *action,
-                                                        GeditWindow *window);
-void           _gedit_cmd_file_save_all                (GtkAction   *action,
-                                                        GeditWindow *window);
-void           _gedit_cmd_file_revert                  (GtkAction   *action,
-                                                        GeditWindow *window);
+void           _gedit_cmd_file_save                    (GSimpleAction *action,
+                                                         GVariant      *parameter,
+                                                         gpointer       user_data);
+void           _gedit_cmd_file_save_as                 (GSimpleAction *action,
+                                                         GVariant      *parameter,
+                                                         gpointer       user_data);
+void           _gedit_cmd_file_save_all                (GSimpleAction *action,
+                                                         GVariant      *parameter,
+                                                         gpointer       user_data);
+void           _gedit_cmd_file_revert                  (GSimpleAction *action,
+                                                         GVariant      *parameter,
+                                                         gpointer       user_data);
 void           _gedit_cmd_file_open_uri                (GtkAction   *action,
                                                         GeditWindow *window);
-void           _gedit_cmd_file_print_preview           (GtkAction   *action,
-                                                        GeditWindow *window);
-void           _gedit_cmd_file_print                   (GtkAction   *action,
-                                                        GeditWindow *window);
-void           _gedit_cmd_file_close                   (GtkAction   *action,
-                                                        GeditWindow *window);
-void           _gedit_cmd_file_close_all               (GtkAction   *action,
-                                                        GeditWindow *window);
-void           _gedit_cmd_file_quit                    (GtkAction   *action,
-                                                        GeditWindow *window);
-
-void           _gedit_cmd_edit_undo                    (GtkAction   *action,
-                                                        GeditWindow *window);
-void           _gedit_cmd_edit_redo                    (GtkAction   *action,
-                                                        GeditWindow *window);
-void           _gedit_cmd_edit_cut                     (GtkAction   *action,
-                                                        GeditWindow *window);
-void           _gedit_cmd_edit_copy                    (GtkAction   *action,
-                                                        GeditWindow *window);
-void           _gedit_cmd_edit_paste                   (GtkAction   *action,
-                                                        GeditWindow *window);
-void           _gedit_cmd_edit_delete                  (GtkAction   *action,
-                                                        GeditWindow *window);
-void           _gedit_cmd_edit_select_all              (GtkAction   *action,
-                                                        GeditWindow *window);
-void           _gedit_cmd_edit_preferences             (GtkAction   *action,
-                                                        GeditWindow *window);
-
-void           _gedit_cmd_view_show_toolbar            (GtkAction   *action,
-                                                        GeditWindow *window);
-void           _gedit_cmd_view_show_statusbar          (GtkAction   *action,
-                                                        GeditWindow *window);
-void           _gedit_cmd_view_show_side_panel         (GtkAction   *action,
-                                                        GeditWindow *window);
-void           _gedit_cmd_view_show_bottom_panel       (GtkAction   *action,
-                                                        GeditWindow *window);
-void           _gedit_cmd_view_toggle_fullscreen_mode  (GtkAction   *action,
-                                                        GeditWindow *window);
-void           _gedit_cmd_view_leave_fullscreen_mode   (GtkAction   *action,
-                                                        GeditWindow *window);
-void            _gedit_cmd_view_highlight_mode          (GtkAction   *action,
-                                                         GeditWindow *window);
-
-void           _gedit_cmd_search_find                  (GtkAction   *action,
-                                                        GeditWindow *window);
-void           _gedit_cmd_search_find_next             (GtkAction   *action,
-                                                        GeditWindow *window);
-void           _gedit_cmd_search_find_prev             (GtkAction   *action,
-                                                        GeditWindow *window);
-void           _gedit_cmd_search_replace               (GtkAction   *action,
-                                                        GeditWindow *window);
-void           _gedit_cmd_search_clear_highlight       (GtkAction   *action,
-                                                        GeditWindow *window);
-void           _gedit_cmd_search_goto_line             (GtkAction   *action,
-                                                        GeditWindow *window);
-
-void           _gedit_cmd_documents_previous_document  (GtkAction   *action,
-                                                        GeditWindow *window);
-void           _gedit_cmd_documents_next_document      (GtkAction   *action,
-                                                        GeditWindow *window);
-void           _gedit_cmd_documents_move_to_new_window (GtkAction   *action,
-                                                        GeditWindow *window);
-void           _gedit_cmd_documents_new_tab_group      (GtkAction   *action,
-                                                        GeditWindow *window);
-void           _gedit_cmd_documents_previous_tab_group (GtkAction   *action,
-                                                        GeditWindow *window);
-void           _gedit_cmd_documents_next_tab_group     (GtkAction   *action,
-                                                        GeditWindow *window);
+void           _gedit_cmd_file_print                   (GSimpleAction *action,
+                                                         GVariant      *parameter,
+                                                         gpointer       user_data);
+void           _gedit_cmd_file_close                   (GSimpleAction *action,
+                                                         GVariant      *parameter,
+                                                         gpointer       user_data);
+void           _gedit_cmd_file_close_all               (GSimpleAction *action,
+                                                         GVariant      *parameter,
+                                                         gpointer       user_data);
+void           _gedit_cmd_file_quit                    (GSimpleAction *action,
+                                                         GVariant      *parameter,
+                                                         gpointer       user_data);
+
+void           _gedit_cmd_edit_undo                    (GSimpleAction *action,
+                                                         GVariant      *parameter,
+                                                         gpointer       user_data);
+void           _gedit_cmd_edit_redo                    (GSimpleAction *action,
+                                                         GVariant      *parameter,
+                                                         gpointer       user_data);
+void           _gedit_cmd_edit_cut                     (GSimpleAction *action,
+                                                         GVariant      *parameter,
+                                                         gpointer       user_data);
+void           _gedit_cmd_edit_copy                    (GSimpleAction *action,
+                                                         GVariant      *parameter,
+                                                         gpointer       user_data);
+void           _gedit_cmd_edit_paste                   (GSimpleAction *action,
+                                                         GVariant      *parameter,
+                                                         gpointer       user_data);
+void           _gedit_cmd_edit_delete                  (GSimpleAction *action,
+                                                         GVariant      *parameter,
+                                                         gpointer       user_data);
+void           _gedit_cmd_edit_select_all              (GSimpleAction *action,
+                                                         GVariant      *parameter,
+                                                         gpointer       user_data);
+void           _gedit_cmd_edit_preferences             (GSimpleAction *action,
+                                                         GVariant      *parameter,
+                                                         gpointer       user_data);
+
+void           _gedit_cmd_view_toggle_fullscreen_mode  (GSimpleAction *action,
+                                                         GVariant      *parameter,
+                                                         gpointer       user_data);
+void           _gedit_cmd_view_leave_fullscreen_mode   (GSimpleAction *action,
+                                                         GVariant      *parameter,
+                                                         gpointer       user_data);
+void            _gedit_cmd_view_highlight_mode          (GSimpleAction *action,
+                                                         GVariant      *parameter,
+                                                         gpointer       user_data);
+
+void           _gedit_cmd_search_find                  (GSimpleAction *action,
+                                                         GVariant      *parameter,
+                                                         gpointer       user_data);
+void           _gedit_cmd_search_find_next             (GSimpleAction *action,
+                                                         GVariant      *parameter,
+                                                         gpointer       user_data);
+void           _gedit_cmd_search_find_prev             (GSimpleAction *action,
+                                                         GVariant      *parameter,
+                                                         gpointer       user_data);
+void           _gedit_cmd_search_replace               (GSimpleAction *action,
+                                                         GVariant      *parameter,
+                                                         gpointer       user_data);
+void           _gedit_cmd_search_clear_highlight       (GSimpleAction *action,
+                                                         GVariant      *parameter,
+                                                         gpointer       user_data);
+void           _gedit_cmd_search_goto_line             (GSimpleAction *action,
+                                                         GVariant      *parameter,
+                                                         gpointer       user_data);
+
+void           _gedit_cmd_documents_previous_document  (GSimpleAction *action,
+                                                         GVariant      *parameter,
+                                                         gpointer       user_data);
+void           _gedit_cmd_documents_next_document      (GSimpleAction *action,
+                                                         GVariant      *parameter,
+                                                         gpointer       user_data);
+void           _gedit_cmd_documents_move_to_new_window (GSimpleAction *action,
+                                                         GVariant      *parameter,
+                                                         gpointer       user_data);
+void           _gedit_cmd_documents_new_tab_group      (GSimpleAction *action,
+                                                         GVariant      *parameter,
+                                                         gpointer       user_data);
+void           _gedit_cmd_documents_previous_tab_group (GSimpleAction *action,
+                                                         GVariant      *parameter,
+                                                         gpointer       user_data);
+void           _gedit_cmd_documents_next_tab_group     (GSimpleAction *action,
+                                                         GVariant      *parameter,
+                                                         gpointer       user_data);
 
 void           _gedit_cmd_help_contents                (GtkAction   *action,
                                                         GeditWindow *window);
diff --git a/gedit/gedit-menu.ui b/gedit/gedit-menu.ui
index 11da064..27d563a 100644
--- a/gedit/gedit-menu.ui
+++ b/gedit/gedit-menu.ui
@@ -10,6 +10,22 @@
     </section>
     <section>
       <item>
+        <attribute name="label" translatable="yes">_Statusbar</attribute>
+        <attribute name="action">app.statusbar-visible</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">Side _Panel</attribute>
+        <attribute name="action">app.side-panel-visible</attribute>
+        <attribute name="accel">F9</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">_Bottom Panel</attribute>
+        <attribute name="action">app.bottom-panel-visible</attribute>
+        <attribute name="accel">&lt;Primary&gt;F9</attribute>
+      </item>
+    </section>
+    <section>
+      <item>
         <attribute name="label" translatable="yes">_Preferences</attribute>
         <attribute name="action">app.preferences</attribute>
       </item>
diff --git a/gedit/gedit-open-tool-button.c b/gedit/gedit-open-menu-button.c
similarity index 63%
rename from gedit/gedit-open-tool-button.c
rename to gedit/gedit-open-menu-button.c
index c7f8859..696fbc3 100644
--- a/gedit/gedit-open-tool-button.c
+++ b/gedit/gedit-open-menu-button.c
@@ -1,5 +1,5 @@
 /*
- * gedit-open-tool-button.c
+ * gedit-open-menu-button.c
  * This file is part of gedit
  *
  * Copyright (C) 2012 - Paolo Borelli
@@ -25,12 +25,12 @@
 
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
-#include "gedit-open-tool-button.h"
+#include "gedit-open-menu-button.h"
 
-struct _GeditOpenToolButtonPrivate
+typedef struct _GeditOpenMenuButtonPrivate
 {
        gint limit;
-};
+} GeditOpenMenuButtonPrivate;
 
 enum
 {
@@ -38,10 +38,10 @@ enum
        PROP_LIMIT
 };
 
-G_DEFINE_TYPE_WITH_PRIVATE (GeditOpenToolButton, gedit_open_tool_button, GTK_TYPE_MENU_TOOL_BUTTON)
+G_DEFINE_TYPE_WITH_PRIVATE (GeditOpenMenuButton, gedit_open_menu_button, GTK_TYPE_MENU_BUTTON)
 
 static void
-set_recent_menu (GeditOpenToolButton *button)
+set_recent_menu (GeditOpenMenuButton *button)
 {
        GtkRecentManager *recent_manager;
        GtkRecentFilter *filter;
@@ -64,28 +64,28 @@ set_recent_menu (GeditOpenToolButton *button)
        gtk_recent_chooser_set_filter (GTK_RECENT_CHOOSER (recent_menu),
                                       filter);
 
-       gtk_menu_tool_button_set_menu (GTK_MENU_TOOL_BUTTON (button),
-                                      recent_menu);
+       gtk_menu_button_set_popup (GTK_MENU_BUTTON (button), recent_menu);
 }
 
 static void
-gedit_open_tool_button_dispose (GObject *object)
+gedit_open_menu_button_dispose (GObject *object)
 {
-       G_OBJECT_CLASS (gedit_open_tool_button_parent_class)->dispose (object);
+       G_OBJECT_CLASS (gedit_open_menu_button_parent_class)->dispose (object);
 }
 
 static void
-gedit_open_tool_button_get_property (GObject    *object,
+gedit_open_menu_button_get_property (GObject    *object,
                                      guint       prop_id,
                                      GValue     *value,
                                      GParamSpec *pspec)
 {
-       GeditOpenToolButton *button = GEDIT_OPEN_TOOL_BUTTON (object);
+       GeditOpenMenuButton *button = GEDIT_OPEN_MENU_BUTTON (object);
+       GeditOpenMenuButtonPrivate *priv = gedit_open_menu_button_get_instance_private (button);
 
        switch (prop_id)
        {
                case PROP_LIMIT:
-                       g_value_set_int (value, button->priv->limit);
+                       g_value_set_int (value, priv->limit);
                        break;
                default:
                        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -94,17 +94,18 @@ gedit_open_tool_button_get_property (GObject    *object,
 }
 
 static void
-gedit_open_tool_button_set_property (GObject      *object,
+gedit_open_menu_button_set_property (GObject      *object,
                                      guint         prop_id,
                                      const GValue *value,
                                      GParamSpec   *pspec)
 {
-       GeditOpenToolButton *button = GEDIT_OPEN_TOOL_BUTTON (object);
+       GeditOpenMenuButton *button = GEDIT_OPEN_MENU_BUTTON (object);
+       GeditOpenMenuButtonPrivate *priv = gedit_open_menu_button_get_instance_private (button);
 
        switch (prop_id)
        {
                case PROP_LIMIT:
-                       button->priv->limit = g_value_get_int (value);
+                       priv->limit = g_value_get_int (value);
                        break;
                default:
                        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -113,35 +114,33 @@ gedit_open_tool_button_set_property (GObject      *object,
 }
 
 static void
-gedit_open_tool_button_constructed (GObject *object)
+gedit_open_menu_button_constructed (GObject *object)
 {
-       GeditOpenToolButton *button = GEDIT_OPEN_TOOL_BUTTON (object);
+       GeditOpenMenuButton *button = GEDIT_OPEN_MENU_BUTTON (object);
 
        set_recent_menu (button);
 
-       gtk_tool_item_set_tooltip_text (GTK_TOOL_ITEM (button), _("Open a file"));
-       gtk_menu_tool_button_set_arrow_tooltip_text (GTK_MENU_TOOL_BUTTON (button),
-                                                    _("Open a recently used file"));
-
-       G_OBJECT_CLASS (gedit_open_tool_button_parent_class)->constructed (object);
+       G_OBJECT_CLASS (gedit_open_menu_button_parent_class)->constructed (object);
 }
 
 static void
-gedit_open_tool_button_init (GeditOpenToolButton *button)
+gedit_open_menu_button_init (GeditOpenMenuButton *button)
 {
-       button->priv = gedit_open_tool_button_get_instance_private (button);
-       button->priv->limit = 10;
+       GeditOpenMenuButtonPrivate *priv;
+
+       priv = gedit_open_menu_button_get_instance_private (button);
+       priv->limit = 10;
 }
 
 static void
-gedit_open_tool_button_class_init (GeditOpenToolButtonClass *klass)
+gedit_open_menu_button_class_init (GeditOpenMenuButtonClass *klass)
 {
        GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
-       object_class->dispose = gedit_open_tool_button_dispose;
-       object_class->get_property = gedit_open_tool_button_get_property;
-       object_class->set_property = gedit_open_tool_button_set_property;
-       object_class->constructed = gedit_open_tool_button_constructed;
+       object_class->dispose = gedit_open_menu_button_dispose;
+       object_class->get_property = gedit_open_menu_button_get_property;
+       object_class->set_property = gedit_open_menu_button_set_property;
+       object_class->constructed = gedit_open_menu_button_constructed;
 
        g_object_class_install_property (object_class, PROP_LIMIT,
                                         g_param_spec_int ("limit",
@@ -154,16 +153,16 @@ gedit_open_tool_button_class_init (GeditOpenToolButtonClass *klass)
                                                           G_PARAM_STATIC_STRINGS));
 }
 
-GtkToolItem *
-gedit_open_tool_button_new (void)
+GtkMenuItem *
+gedit_open_menu_button_new (void)
 {
-       GeditOpenToolButton *button;
+       GeditOpenMenuButton *button;
 
-       button = g_object_new (GEDIT_TYPE_OPEN_TOOL_BUTTON,
-                              "stock-id", GTK_STOCK_OPEN,
+       button = g_object_new (GEDIT_TYPE_OPEN_MENU_BUTTON,
+                              "direction", GTK_ARROW_DOWN,
                               NULL);
 
-       return GTK_TOOL_ITEM (button);
+       return GTK_MENU_ITEM (button);
 }
 
 /* ex:set ts=8 noet: */
diff --git a/gedit/gedit-open-menu-button.h b/gedit/gedit-open-menu-button.h
new file mode 100644
index 0000000..4320030
--- /dev/null
+++ b/gedit/gedit-open-menu-button.h
@@ -0,0 +1,57 @@
+/*
+ * gedit-open-menu-button.h
+ * This file is part of gedit
+ *
+ * Copyright (C) 2012 - Paolo Borelli
+ *
+ * gedit is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * gedit is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifndef __GEDIT_OPEN_MENU_BUTTON_H__
+#define __GEDIT_OPEN_MENU_BUTTON_H__
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define GEDIT_TYPE_OPEN_MENU_BUTTON            (gedit_open_menu_button_get_type ())
+#define GEDIT_OPEN_MENU_BUTTON(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
GEDIT_TYPE_OPEN_MENU_BUTTON, GeditOpenMenuButton))
+#define GEDIT_OPEN_MENU_BUTTON_CONST(obj)      (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
GEDIT_TYPE_OPEN_MENU_BUTTON, GeditOpenMenuButton const))
+#define GEDIT_OPEN_MENU_BUTTON_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), 
GEDIT_TYPE_OPEN_MENU_BUTTON, GeditOpenMenuButtonClass))
+#define GEDIT_IS_OPEN_MENU_BUTTON(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
GEDIT_TYPE_OPEN_MENU_BUTTON))
+#define GEDIT_IS_OPEN_MENU_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), 
GEDIT_TYPE_OPEN_MENU_BUTTON))
+#define GEDIT_OPEN_MENU_BUTTON_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), 
GEDIT_TYPE_OPEN_MENU_BUTTON, GeditOpenMenuButtonClass))
+
+typedef struct _GeditOpenMenuButton            GeditOpenMenuButton;
+typedef struct _GeditOpenMenuButtonClass       GeditOpenMenuButtonClass;
+
+struct _GeditOpenMenuButton
+{
+       GtkMenuButton parent;
+};
+
+struct _GeditOpenMenuButtonClass
+{
+       GtkMenuButtonClass parent_class;
+};
+
+GType            gedit_open_menu_button_get_type (void) G_GNUC_CONST;
+
+GtkMenuItem     *gedit_open_menu_button_new      (void);
+
+G_END_DECLS
+
+#endif /* __GEDIT_OPEN_MENU_BUTTON_H__ */
+/* ex:set ts=8 noet: */
diff --git a/gedit/gedit-preferences-dialog.ui b/gedit/gedit-preferences-dialog.ui
index 6989ca5..2ec2416 100644
--- a/gedit/gedit-preferences-dialog.ui
+++ b/gedit/gedit-preferences-dialog.ui
@@ -782,7 +782,6 @@
                                 </child>
                                 <child>
                                   <object class="GtkTreeViewColumn" id="schemes_column">
-                                    <property name="title" translatable="yes">column</property>
                                     <child>
                                       <object class="GtkCellRendererText" id="schemes_renderer">
                                         <property name="ellipsize">end</property>
diff --git a/gedit/gedit-ui.xml b/gedit/gedit-ui.xml
index a0ee907..1dc9a7d 100644
--- a/gedit/gedit-ui.xml
+++ b/gedit/gedit-ui.xml
@@ -30,40 +30,19 @@
 
   <menubar name="MenuBar">
     <menu name="FileMenu" action="File">
-      <menuitem name="FileNewMenu" action="FileNew"/>
       <placeholder name="FileOps_1"/>
-      <menuitem name="FileOpenMenu" action="FileOpen"/>
       <placeholder name="FileOps_2"/>
       <separator/>
-      <menuitem name="FileSaveMenu" action="FileSave"/>
-      <menuitem name="FileSaveAsMenu" action="FileSaveAs"/>
       <placeholder name="FileOps_3"/>
-      <menuitem name="FileRevertMenu" action="FileRevert"/>
       <placeholder name="FileOps_4"/>
       <separator/>
       <placeholder name="FileOps_5"/>
-      <menuitem name="FilePrintPreviewMenu" action="FilePrintPreview"/>
-      <menuitem name="FilePrintMenu" action="FilePrint"/>
-      <placeholder name="FileRecentsPlaceholder">
-        <separator/>
-      </placeholder>
-      <separator/>
-      <menuitem name="FileCloseMenu" action="FileClose"/>
-      <placeholder name="FileQuitMenuHolder" />
     </menu>
 
     <menu name="EditMenu" action="Edit">
-      <menuitem name="EditUndoMenu" action="EditUndo"/>
-      <menuitem name="EditRedoMenu" action="EditRedo"/>
-      <separator/>
-      <menuitem name="EditCutMenu" action="EditCut"/>
-      <menuitem name="EditCopyMenu" action="EditCopy"/>
-      <menuitem name="EditPasteMenu" action="EditPaste"/>
-      <menuitem name="EditDeleteMenu" action="EditDelete"/>
       <placeholder name="EditOps_1" /> 
       <separator/>
       <placeholder name="EditOps_2" /> 
-      <menuitem name="EditSelectAllMenu" action="EditSelectAll"/>
       <placeholder name="EditOps_3" />
       <separator/>
       <placeholder name="EditOps_4" />
@@ -76,40 +55,9 @@
     </menu>
 
     <menu name="ViewMenu" action="View">
-      <menuitem name="ViewToolbarMenu" action="ViewToolbar"/>
-      <menuitem name="ViewStatusbarMenu" action="ViewStatusbar"/>
-      <menuitem name="ViewSidePaneMenu" action="ViewSidePanel"/>
-      <menuitem name="ViewBottomPaneMenu" action="ViewBottomPanel"/>
-      <separator/>
-      <menuitem name="ViewFullscreenMenu" action="ViewFullscreen"/>
-      <separator/>
       <menuitem name="ViewHighlightModeMenu" action="ViewHighlightMode"/>
     </menu>
 
-    <menu name="SearchMenu" action="Search">
-      <menuitem name="SearchFindMenu" action="SearchFind"/>
-      <menuitem name="SearchFindNextMenu" action="SearchFindNext"/>
-      <menuitem name="SearchFindPreviousMenu" action="SearchFindPrevious"/>
-      <placeholder name="SearchOps_1" />
-      <separator/>
-      <placeholder name="SearchOps_2" />
-      <separator/>
-      <menuitem name="SearchReplaceMenu" action="SearchReplace"/>
-      <placeholder name="SearchOps_3" />
-      <separator/>
-      <placeholder name="SearchOps_4" />
-      <separator/>
-      <menuitem name="SearchClearHighlight" action="SearchClearHighlight"/>      
-      <placeholder name="SearchOps_5" />
-      <separator/>
-      <placeholder name="SearchOps_6" />
-      <separator/>
-      <menuitem name="SearchGoToLineMenu" action="SearchGoToLine"/>      
-      <placeholder name="SearchOps_7" />
-      <separator/>
-      <placeholder name="SearchOps_8" />
-    </menu>
-
     <menu name="ToolsMenu" action="Tools">
       <placeholder name="ToolsOps_1" />
       <separator/>
@@ -122,72 +70,5 @@
       <placeholder name="ToolsOps_5" />
     </menu>
 
-    <placeholder name="ExtraMenu_1" />
-
-    <menu name="DocumentsMenu" action="Documents">
-      <menuitem action="FileSaveAll" />
-      <menuitem action="FileCloseAll" />
-      <separator />
-      <menuitem action="DocumentsNewTabGroup"/>
-      <menuitem action="DocumentsPreviousTabGroup"/>
-      <menuitem action="DocumentsNextTabGroup"/>
-      <separator />
-      <placeholder name="DocumentsOps_1" />
-      <separator/>
-      <placeholder name="DocumentsOps_2" />
-      <separator/>
-      <placeholder name="DocumentsOps_3" />
-      <menuitem action="DocumentsPreviousDocument" />      
-      <menuitem action="DocumentsNextDocument" />
-      <separator/>
-      <menuitem action="DocumentsMoveToNewWindow"/>
-      <placeholder name="DocumentsListPlaceholder">
-      <separator/>
-      </placeholder>
-    </menu>
-
-    <menu name="HelpMenu" action="Help">
-     <placeholder name="HelpOps_1" />
-     <separator/>
-     <placeholder name="HelpHolder" />
-    </menu>
-
   </menubar>
-
-  <toolbar name="ToolBar">
-    <toolitem action="FileNew"/>
-    <toolitem action="FileSave"/>
-    <separator/>
-    <toolitem action="FilePrint"/>
-    <separator/>
-    <toolitem action="EditUndo"/>
-    <toolitem action="EditRedo"/>
-    <separator/>
-    <toolitem action="EditCut"/>
-    <toolitem action="EditCopy"/>
-    <toolitem action="EditPaste"/>
-    <separator/>
-    <toolitem action="SearchFind"/>
-    <toolitem action="SearchReplace"/>
-  </toolbar>
-
-  <toolbar name="FullscreenToolBar">
-    <toolitem action="FileNew"/>
-    <toolitem action="FileSave"/>
-    <separator/>
-    <toolitem action="FilePrint"/>
-    <separator/>
-    <toolitem action="EditUndo"/>
-    <toolitem action="EditRedo"/>
-    <separator/>
-    <toolitem action="EditCut"/>
-    <toolitem action="EditCopy"/>
-    <toolitem action="EditPaste"/>
-    <separator/>
-    <toolitem action="SearchFind"/>
-    <toolitem action="SearchReplace"/>
-    <separator expand="true"/>
-    <toolitem action="LeaveFullscreen"/>
-  </toolbar>
-
 </ui>
diff --git a/gedit/gedit-window-private.h b/gedit/gedit-window-private.h
index ccd2bdf..4d68fdb 100644
--- a/gedit/gedit-window-private.h
+++ b/gedit/gedit-window-private.h
@@ -65,6 +65,7 @@ struct _GeditWindowPrivate
 
        /* Widgets for fullscreen mode */
        GtkWidget      *fullscreen_controls;
+       gboolean        fullscreen_controls_setup;
        guint           fullscreen_animation_timeout_id;
        gboolean        fullscreen_animation_enter;
 
@@ -72,8 +73,8 @@ struct _GeditWindowPrivate
        GtkWidget      *statusbar;
        GtkWidget      *tab_width_combo;
        GtkWidget      *tab_width_combo_menu;
-       GtkWidget      *language_combo;
-       GtkWidget      *language_combo_menu;
+       GtkWidget      *language_button;
+       GtkWidget      *language_button_label;
        guint           generic_message_cid;
        guint           tip_message_cid;
        guint           bracket_match_message_cid;
@@ -83,21 +84,15 @@ struct _GeditWindowPrivate
 
        /* Menus & Toolbars */
        GtkUIManager   *manager;
-       GtkActionGroup *action_group;
-       GtkActionGroup *always_sensitive_action_group;
-       GtkActionGroup *close_action_group;
-       GtkActionGroup *quit_action_group;
-       GtkActionGroup *panels_action_group;
        GtkActionGroup *documents_list_action_group;
        guint           documents_list_menu_ui_id;
-       GtkWidget      *toolbar;
-       GtkWidget      *menubar;
 
-       /* recent files */
-       GtkActionGroup *recents_action_group;
-       guint           recents_menu_ui_id;
-       gulong          recents_handler_id;
+       GtkWidget      *headerbar;
+       GtkWidget      *open_button;
+       GtkWidget      *open_menu;
+       GtkWidget      *close_button;
 
+       /* recent files */
        guint           update_documents_list_menu_id;
 
        gint            num_tabs_with_error;
diff --git a/gedit/gedit-window.c b/gedit/gedit-window.c
index 7b20183..b7dc509 100644
--- a/gedit/gedit-window.c
+++ b/gedit/gedit-window.c
@@ -41,7 +41,6 @@
 #include <gtksourceview/gtksource.h>
 #include <libpeas/peas-extension-set.h>
 
-#include "gedit-ui.h"
 #include "gedit-window.h"
 #include "gedit-window-private.h"
 #include "gedit-app.h"
@@ -52,7 +51,7 @@
 #include "gedit-utils.h"
 #include "gedit-commands.h"
 #include "gedit-debug.h"
-#include "gedit-open-tool-button.h"
+#include "gedit-open-menu-button.h"
 #include "gedit-panel.h"
 #include "gedit-documents-panel.h"
 #include "gedit-plugins-engine.h"
@@ -63,10 +62,9 @@
 #include "gedit-settings.h"
 #include "gedit-marshal.h"
 #include "gedit-document.h"
+#include "gedit-close-button.h"
 
-#define LANGUAGE_NONE (const gchar *)"LangNone"
 #define TAB_WIDTH_DATA "GeditWindowTabWidthData"
-#define LANGUAGE_DATA "GeditWindowLanguageData"
 #define FULLSCREEN_ANIMATION_SPEED 4
 
 /* Signals */
@@ -95,9 +93,6 @@ enum
 
 G_DEFINE_TYPE_WITH_PRIVATE (GeditWindow, gedit_window, GTK_TYPE_APPLICATION_WINDOW)
 
-static void    recent_manager_changed  (GtkRecentManager *manager,
-                                        GeditWindow      *window);
-
 static void
 gedit_window_get_property (GObject    *object,
                           guint       prop_id,
@@ -230,16 +225,6 @@ gedit_window_dispose (GObject *object)
                window->priv->fullscreen_controls = NULL;
        }
 
-       if (window->priv->recents_handler_id != 0)
-       {
-               GtkRecentManager *recent_manager;
-
-               recent_manager =  gtk_recent_manager_get_default ();
-               g_signal_handler_disconnect (recent_manager,
-                                            window->priv->recents_handler_id);
-               window->priv->recents_handler_id = 0;
-       }
-
        if (window->priv->update_documents_list_menu_id != 0)
        {
                g_source_remove (window->priv->update_documents_list_menu_id);
@@ -433,95 +418,20 @@ gedit_window_class_init (GeditWindowClass *klass)
                                                             GEDIT_WINDOW_STATE_NORMAL,
                                                             G_PARAM_READABLE |
                                                             G_PARAM_STATIC_STRINGS));
-}
-
-static void
-menu_item_select_cb (GtkMenuItem *proxy,
-                    GeditWindow *window)
-{
-       GtkAction *action;
-       char *message;
-
-       action = gtk_activatable_get_related_action (GTK_ACTIVATABLE (proxy));
-       g_return_if_fail (action != NULL);
-
-       g_object_get (G_OBJECT (action), "tooltip", &message, NULL);
-       if (message)
-       {
-               gtk_statusbar_push (GTK_STATUSBAR (window->priv->statusbar),
-                                   window->priv->tip_message_cid, message);
-               g_free (message);
-       }
-}
 
-static void
-menu_item_deselect_cb (GtkMenuItem *proxy,
-                       GeditWindow *window)
-{
-       gtk_statusbar_pop (GTK_STATUSBAR (window->priv->statusbar),
-                          window->priv->tip_message_cid);
-}
-
-static void
-connect_proxy_cb (GtkUIManager *manager,
-                  GtkAction *action,
-                  GtkWidget *proxy,
-                  GeditWindow *window)
-{
-       if (GTK_IS_MENU_ITEM (proxy))
-       {
-               g_signal_connect (proxy, "select",
-                                 G_CALLBACK (menu_item_select_cb), window);
-               g_signal_connect (proxy, "deselect",
-                                 G_CALLBACK (menu_item_deselect_cb), window);
-       }
-}
-
-static void
-disconnect_proxy_cb (GtkUIManager *manager,
-                     GtkAction    *action,
-                     GtkWidget    *proxy,
-                     GeditWindow  *window)
-{
-       if (GTK_IS_MENU_ITEM (proxy))
-       {
-               g_signal_handlers_disconnect_by_func
-                       (proxy, G_CALLBACK (menu_item_select_cb), window);
-               g_signal_handlers_disconnect_by_func
-                       (proxy, G_CALLBACK (menu_item_deselect_cb), window);
-       }
-}
-
-/* Returns TRUE if toolbar is visible */
-static gboolean
-set_toolbar_visibility (GeditWindow *window,
-                        GeditWindow *origin)
-{
-       gboolean visible;
-       GtkAction *action;
-
-       if (origin == NULL)
-       {
-               visible = g_settings_get_boolean (window->priv->ui_settings,
-                                                 GEDIT_SETTINGS_TOOLBAR_VISIBLE);
-       }
-       else
-       {
-               visible = gtk_widget_get_visible (origin->priv->toolbar);
-       }
-
-       /* Set visibility */
-       gtk_widget_set_visible (window->priv->toolbar, visible);
-
-       action = gtk_action_group_get_action (window->priv->always_sensitive_action_group,
-                                             "ViewToolbar");
-
-       if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)) != visible)
-       {
-               gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), visible);
-       }
-
-       return visible;
+       /* Bind class to template */
+       gtk_widget_class_set_template_from_resource (widget_class,
+                                                    "/org/gnome/gedit/ui/gedit-window.ui");
+       gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, headerbar);
+       gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, open_menu);
+       gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, close_button);
+       gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, hpaned);
+       gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, side_panel);
+       gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, vpaned);
+       gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, multi_notebook);
+       gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, bottom_panel);
+       gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, statusbar);
+       gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, fullscreen_controls);
 }
 
 static void
@@ -530,7 +440,7 @@ update_next_prev_doc_sensitivity (GeditWindow *window,
 {
        GeditNotebook *notebook;
        gint tab_number;
-       GtkAction *action;
+       GAction *action;
 
        gedit_debug (DEBUG_WINDOW);
 
@@ -539,21 +449,22 @@ update_next_prev_doc_sensitivity (GeditWindow *window,
 
        g_return_if_fail (tab_number >= 0);
 
-       action = gtk_action_group_get_action (window->priv->action_group,
-                                             "DocumentsPreviousDocument");
-       gtk_action_set_sensitive (action, tab_number != 0);
+       action = g_action_map_lookup_action (G_ACTION_MAP (window),
+                                            "previous_document");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
+                                    tab_number != 0);
 
-       action = gtk_action_group_get_action (window->priv->action_group,
-                                             "DocumentsNextDocument");
-       gtk_action_set_sensitive (action,
-                                 tab_number < gtk_notebook_get_n_pages (GTK_NOTEBOOK (notebook)) - 1);
+       action = g_action_map_lookup_action (G_ACTION_MAP (window),
+                                            "next_document");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
+                                    tab_number < gtk_notebook_get_n_pages (GTK_NOTEBOOK (notebook)) - 1);
 }
 
 static void
 update_next_prev_doc_sensitivity_per_window (GeditWindow *window)
 {
        GeditTab *tab;
-       GtkAction *action;
+       GAction *action;
 
        gedit_debug (DEBUG_WINDOW);
 
@@ -565,13 +476,13 @@ update_next_prev_doc_sensitivity_per_window (GeditWindow *window)
                return;
        }
 
-       action = gtk_action_group_get_action (window->priv->action_group,
-                                             "DocumentsPreviousDocument");
-       gtk_action_set_sensitive (action, FALSE);
+       action = g_action_map_lookup_action (G_ACTION_MAP (window),
+                                            "previous_document");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action), FALSE);
 
-       action = gtk_action_group_get_action (window->priv->action_group,
-                                             "DocumentsNextDocument");
-       gtk_action_set_sensitive (action, FALSE);
+       action = g_action_map_lookup_action (G_ACTION_MAP (window),
+                                            "next_document");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action), FALSE);
 }
 
 static void
@@ -580,8 +491,8 @@ received_clipboard_contents (GtkClipboard     *clipboard,
                             GeditWindow      *window)
 {
        GeditTab *tab;
-       gboolean sens;
-       GtkAction *action;
+       gboolean enabled;
+       GAction *action;
 
        /* getting clipboard contents is async, so we need to
         * get the current tab and its state */
@@ -596,18 +507,16 @@ received_clipboard_contents (GtkClipboard     *clipboard,
                state = gedit_tab_get_state (tab);
                state_normal = (state == GEDIT_TAB_STATE_NORMAL);
 
-               sens = state_normal &&
-                      gtk_selection_data_targets_include_text (selection_data);
+               enabled = state_normal &&
+                         gtk_selection_data_targets_include_text (selection_data);
        }
        else
        {
-               sens = FALSE;
+               enabled = FALSE;
        }
 
-       action = gtk_action_group_get_action (window->priv->action_group,
-                                             "EditPaste");
-
-       gtk_action_set_sensitive (action, sens);
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "paste");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action), enabled);
 
        g_object_unref (window);
 }
@@ -629,14 +538,12 @@ set_paste_sensitivity_according_to_clipboard (GeditWindow  *window,
        }
        else
        {
-               GtkAction *action;
-
-               action = gtk_action_group_get_action (window->priv->action_group,
-                                                     "EditPaste");
+               GAction *action;
 
+               action = g_action_map_lookup_action (G_ACTION_MAP (window), "paste");
                /* XFIXES extension not availbale, make
                 * Paste always sensitive */
-               gtk_action_set_sensitive (action, TRUE);
+               g_simple_action_set_enabled (G_SIMPLE_ACTION (action), TRUE);
        }
 }
 
@@ -655,7 +562,7 @@ set_sensitivity_according_to_tab (GeditWindow *window,
 {
        GeditDocument *doc;
        GeditView *view;
-       GtkAction *action;
+       GAction *action;
        gboolean b;
        gboolean state_normal;
        gboolean editable;
@@ -684,83 +591,66 @@ set_sensitivity_according_to_tab (GeditWindow *window,
        clipboard = gtk_widget_get_clipboard (GTK_WIDGET (window),
                                              GDK_SELECTION_CLIPBOARD);
 
-       action = gtk_action_group_get_action (window->priv->action_group,
-                                             "FileSave");
-       gtk_action_set_sensitive (action,
-                                 (state_normal ||
-                                  (state == GEDIT_TAB_STATE_EXTERNALLY_MODIFIED_NOTIFICATION) ||
-                                  (state == GEDIT_TAB_STATE_SHOWING_PRINT_PREVIEW)) &&
-                                 !gedit_document_get_readonly (doc) &&
-                                 !(lockdown & GEDIT_LOCKDOWN_SAVE_TO_DISK));
-
-       action = gtk_action_group_get_action (window->priv->action_group,
-                                             "FileSaveAs");
-       gtk_action_set_sensitive (action,
-                                 (state_normal ||
-                                  (state == GEDIT_TAB_STATE_SAVING_ERROR) ||
-                                  (state == GEDIT_TAB_STATE_EXTERNALLY_MODIFIED_NOTIFICATION) ||
-                                  (state == GEDIT_TAB_STATE_SHOWING_PRINT_PREVIEW)) &&
-                                 !(lockdown & GEDIT_LOCKDOWN_SAVE_TO_DISK));
-
-       action = gtk_action_group_get_action (window->priv->action_group,
-                                             "FileRevert");
-       gtk_action_set_sensitive (action,
-                                 (state_normal ||
-                                  (state == GEDIT_TAB_STATE_EXTERNALLY_MODIFIED_NOTIFICATION)) &&
-                                 !gedit_document_is_untitled (doc));
-
-       action = gtk_action_group_get_action (window->priv->action_group,
-                                             "FilePrintPreview");
-       gtk_action_set_sensitive (action,
-                                 state_normal &&
-                                 !(lockdown & GEDIT_LOCKDOWN_PRINTING));
-
-       action = gtk_action_group_get_action (window->priv->action_group,
-                                             "FilePrint");
-       gtk_action_set_sensitive (action,
-                                 (state_normal ||
-                                 (state == GEDIT_TAB_STATE_SHOWING_PRINT_PREVIEW)) &&
-                                 !(lockdown & GEDIT_LOCKDOWN_PRINTING));
-
-       action = gtk_action_group_get_action (window->priv->close_action_group,
-                                             "FileClose");
-
-       gtk_action_set_sensitive (action,
-                                 (state != GEDIT_TAB_STATE_CLOSING) &&
-                                 (state != GEDIT_TAB_STATE_SAVING) &&
-                                 (state != GEDIT_TAB_STATE_SHOWING_PRINT_PREVIEW) &&
-                                 (state != GEDIT_TAB_STATE_PRINTING) &&
-                                 (state != GEDIT_TAB_STATE_PRINT_PREVIEWING) &&
-                                 (state != GEDIT_TAB_STATE_SAVING_ERROR));
-
-       action = gtk_action_group_get_action (window->priv->action_group,
-                                             "EditUndo");
-       gtk_action_set_sensitive (action,
-                                 state_normal &&
-                                 gtk_source_buffer_can_undo (GTK_SOURCE_BUFFER (doc)));
-
-       action = gtk_action_group_get_action (window->priv->action_group,
-                                             "EditRedo");
-       gtk_action_set_sensitive (action,
-                                 state_normal &&
-                                 gtk_source_buffer_can_redo (GTK_SOURCE_BUFFER (doc)));
-
-       action = gtk_action_group_get_action (window->priv->action_group,
-                                             "EditCut");
-       gtk_action_set_sensitive (action,
-                                 state_normal &&
-                                 editable &&
-                                 gtk_text_buffer_get_has_selection (GTK_TEXT_BUFFER (doc)));
-
-       action = gtk_action_group_get_action (window->priv->action_group,
-                                             "EditCopy");
-       gtk_action_set_sensitive (action,
-                                 (state_normal ||
-                                  state == GEDIT_TAB_STATE_EXTERNALLY_MODIFIED_NOTIFICATION) &&
-                                 gtk_text_buffer_get_has_selection (GTK_TEXT_BUFFER (doc)));
-
-       action = gtk_action_group_get_action (window->priv->action_group,
-                                             "EditPaste");
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "save");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
+                                    (state_normal ||
+                                     (state == GEDIT_TAB_STATE_EXTERNALLY_MODIFIED_NOTIFICATION) ||
+                                     (state == GEDIT_TAB_STATE_SHOWING_PRINT_PREVIEW)) &&
+                                    !gedit_document_get_readonly (doc) &&
+                                    !(lockdown & GEDIT_LOCKDOWN_SAVE_TO_DISK));
+
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "save_as");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
+                                    (state_normal ||
+                                     (state == GEDIT_TAB_STATE_SAVING_ERROR) ||
+                                     (state == GEDIT_TAB_STATE_EXTERNALLY_MODIFIED_NOTIFICATION) ||
+                                     (state == GEDIT_TAB_STATE_SHOWING_PRINT_PREVIEW)) &&
+                                    !(lockdown & GEDIT_LOCKDOWN_SAVE_TO_DISK));
+
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "revert");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
+                                    (state_normal ||
+                                     (state == GEDIT_TAB_STATE_EXTERNALLY_MODIFIED_NOTIFICATION)) &&
+                                    !gedit_document_is_untitled (doc));
+
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "print");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
+                                    (state_normal ||
+                                    (state == GEDIT_TAB_STATE_SHOWING_PRINT_PREVIEW)) &&
+                                    !(lockdown & GEDIT_LOCKDOWN_PRINTING));
+
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "close");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
+                                    (state != GEDIT_TAB_STATE_CLOSING) &&
+                                    (state != GEDIT_TAB_STATE_SAVING) &&
+                                    (state != GEDIT_TAB_STATE_SHOWING_PRINT_PREVIEW) &&
+                                    (state != GEDIT_TAB_STATE_PRINTING) &&
+                                    (state != GEDIT_TAB_STATE_PRINT_PREVIEWING) &&
+                                    (state != GEDIT_TAB_STATE_SAVING_ERROR));
+
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "undo");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
+                                    state_normal &&
+                                    gtk_source_buffer_can_undo (GTK_SOURCE_BUFFER (doc)));
+
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "redo");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
+                                    state_normal &&
+                                    gtk_source_buffer_can_redo (GTK_SOURCE_BUFFER (doc)));
+
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "cut");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
+                                    state_normal &&
+                                    editable &&
+                                    gtk_text_buffer_get_has_selection (GTK_TEXT_BUFFER (doc)));
+
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "copy");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
+                                    (state_normal ||
+                                     state == GEDIT_TAB_STATE_EXTERNALLY_MODIFIED_NOTIFICATION) &&
+                                    gtk_text_buffer_get_has_selection (GTK_TEXT_BUFFER (doc)));
+
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "paste");
        if (state_normal && editable)
        {
                set_paste_sensitivity_according_to_clipboard (window,
@@ -768,58 +658,50 @@ set_sensitivity_according_to_tab (GeditWindow *window,
        }
        else
        {
-               gtk_action_set_sensitive (action, FALSE);
+               g_simple_action_set_enabled (G_SIMPLE_ACTION (action), FALSE);
        }
 
-       action = gtk_action_group_get_action (window->priv->action_group,
-                                             "EditDelete");
-       gtk_action_set_sensitive (action,
-                                 state_normal &&
-                                 editable &&
-                                 gtk_text_buffer_get_has_selection (GTK_TEXT_BUFFER (doc)));
-
-       action = gtk_action_group_get_action (window->priv->action_group,
-                                             "SearchFind");
-       gtk_action_set_sensitive (action,
-                                 (state_normal ||
-                                  state == GEDIT_TAB_STATE_EXTERNALLY_MODIFIED_NOTIFICATION));
-
-       action = gtk_action_group_get_action (window->priv->action_group,
-                                             "SearchReplace");
-       gtk_action_set_sensitive (action,
-                                 state_normal &&
-                                 editable);
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "delete");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
+                                    state_normal &&
+                                    editable &&
+                                    gtk_text_buffer_get_has_selection (GTK_TEXT_BUFFER (doc)));
+
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "find");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
+                                    (state_normal ||
+                                     state == GEDIT_TAB_STATE_EXTERNALLY_MODIFIED_NOTIFICATION));
+
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "replace");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
+                                    state_normal &&
+                                    editable);
 
        b = !_gedit_document_get_empty_search (doc);
-       action = gtk_action_group_get_action (window->priv->action_group,
-                                             "SearchFindNext");
-       gtk_action_set_sensitive (action,
-                                 (state_normal ||
-                                  state == GEDIT_TAB_STATE_EXTERNALLY_MODIFIED_NOTIFICATION) && b);
-
-       action = gtk_action_group_get_action (window->priv->action_group,
-                                             "SearchFindPrevious");
-       gtk_action_set_sensitive (action,
-                                 (state_normal ||
-                                  state == GEDIT_TAB_STATE_EXTERNALLY_MODIFIED_NOTIFICATION) && b);
-
-       action = gtk_action_group_get_action (window->priv->action_group,
-                                             "SearchClearHighlight");
-       gtk_action_set_sensitive (action,
-                                 (state_normal ||
-                                  state == GEDIT_TAB_STATE_EXTERNALLY_MODIFIED_NOTIFICATION) && b);
-
-       action = gtk_action_group_get_action (window->priv->action_group,
-                                             "SearchGoToLine");
-       gtk_action_set_sensitive (action,
-                                 (state_normal ||
-                                  state == GEDIT_TAB_STATE_EXTERNALLY_MODIFIED_NOTIFICATION));
-
-       action = gtk_action_group_get_action (window->priv->action_group,
-                                             "ViewHighlightMode");
-       gtk_action_set_sensitive (action,
-                                 (state != GEDIT_TAB_STATE_CLOSING) &&
-                                 enable_syntax_highlighting);
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "find_next");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
+                                    (state_normal ||
+                                     state == GEDIT_TAB_STATE_EXTERNALLY_MODIFIED_NOTIFICATION) && b);
+
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "find_prev");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
+                                    (state_normal ||
+                                     state == GEDIT_TAB_STATE_EXTERNALLY_MODIFIED_NOTIFICATION) && b);
+
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "clear_highlight");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
+                                    (state_normal ||
+                                     state == GEDIT_TAB_STATE_EXTERNALLY_MODIFIED_NOTIFICATION) && b);
+
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "goto_line");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
+                                    (state_normal ||
+                                     state == GEDIT_TAB_STATE_EXTERNALLY_MODIFIED_NOTIFICATION));
+
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "highlight_mode");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
+                                    (state != GEDIT_TAB_STATE_CLOSING) &&
+                                    enable_syntax_highlighting);
 
        update_next_prev_doc_sensitivity (window, tab);
 
@@ -919,407 +801,34 @@ recent_chooser_item_activated (GtkRecentChooser *chooser,
 }
 
 static void
-recents_menu_activate (GtkAction   *action,
-                      GeditWindow *window)
-{
-       GtkRecentInfo *info;
-       const gchar *uri;
-       GFile *location;
-
-       info = g_object_get_data (G_OBJECT (action), "gtk-recent-info");
-       g_return_if_fail (info != NULL);
-
-       /* TODO: get_file when exists */
-       uri = gtk_recent_info_get_uri (info);
-       location = g_file_new_for_uri (uri);
-
-       if (location)
-       {
-               open_recent_file (location, window);
-               g_object_unref (location);
-       }
-}
-
-static gint
-sort_recents_mru (GtkRecentInfo *a, GtkRecentInfo *b)
-{
-       return (gtk_recent_info_get_modified (b) - gtk_recent_info_get_modified (a));
-}
-
-static void    update_recent_files_menu (GeditWindow *window);
-
-static void
-recent_manager_changed (GtkRecentManager *manager,
-                       GeditWindow      *window)
-{
-       /* regenerate the menu when the model changes */
-       update_recent_files_menu (window);
-}
-
-/*
- * Manually construct the inline recents list in the File menu.
- * Hopefully gtk 2.12 will add support for it.
- */
-static void
-update_recent_files_menu (GeditWindow *window)
+setup_headerbar_open_button (GeditWindow *window)
 {
-       GeditWindowPrivate *p = window->priv;
-       GtkRecentManager *recent_manager;
-       gint max_recents;
-       GList *actions, *l, *items;
-       GList *filtered_items = NULL;
-       gint i;
+       GtkMenu *recent_menu;
 
-       gedit_debug (DEBUG_WINDOW);
-
-       g_settings_get (window->priv->ui_settings, GEDIT_SETTINGS_MAX_RECENTS,
-                       "u", &max_recents);
-
-       g_return_if_fail (p->recents_action_group != NULL);
-
-       if (p->recents_menu_ui_id != 0)
-       {
-               gtk_ui_manager_remove_ui (p->manager,
-                                         p->recents_menu_ui_id);
-       }
-
-       actions = gtk_action_group_list_actions (p->recents_action_group);
-       for (l = actions; l != NULL; l = l->next)
-       {
-               g_signal_handlers_disconnect_by_func (GTK_ACTION (l->data),
-                                                     G_CALLBACK (recents_menu_activate),
-                                                     window);
-               gtk_action_group_remove_action (p->recents_action_group,
-                                               GTK_ACTION (l->data));
-       }
-       g_list_free (actions);
-
-       p->recents_menu_ui_id = gtk_ui_manager_new_merge_id (p->manager);
-
-       recent_manager =  gtk_recent_manager_get_default ();
-       items = gtk_recent_manager_get_items (recent_manager);
-
-       /* filter */
-       for (l = items; l != NULL; l = l->next)
-       {
-               GtkRecentInfo *info = l->data;
-
-               if (!gtk_recent_info_has_group (info, "gedit"))
-                       continue;
-
-               filtered_items = g_list_prepend (filtered_items, info);
-       }
-
-       /* sort */
-       filtered_items = g_list_sort (filtered_items,
-                                     (GCompareFunc) sort_recents_mru);
-
-       i = 0;
-       for (l = filtered_items; l != NULL; l = l->next)
-       {
-               gchar *action_name;
-               const gchar *display_name;
-               gchar *escaped;
-               gchar *label;
-               gchar *uri;
-               gchar *ruri;
-               gchar *tip;
-               GtkAction *action;
-               GtkRecentInfo *info = l->data;
-               GFile *location;
-               const gchar *mime_type;
-               gchar *content_type;
-               GIcon *icon = NULL;
-
-               /* clamp */
-               if (i >= max_recents)
-                       break;
-
-               i++;
-
-               action_name = g_strdup_printf ("recent-info-%d", i);
-
-               display_name = gtk_recent_info_get_display_name (info);
-               escaped = gedit_utils_escape_underscores (display_name, -1);
-               if (i >= 10)
-               {
-                       label = g_strdup_printf ("%d.  %s",
-                                                i,
-                                                escaped);
-               }
-               else
-               {
-                       label = g_strdup_printf ("_%d.  %s",
-                                                i,
-                                                escaped);
-               }
-
-               g_free (escaped);
-
-               /* gtk_recent_info_get_uri_display (info) is buggy and
-                * works only for local files */
-               location = g_file_new_for_uri (gtk_recent_info_get_uri (info));
-               uri = g_file_get_parse_name (location);
-               g_object_unref (location);
-               ruri = gedit_utils_replace_home_dir_with_tilde (uri);
-               g_free (uri);
-
-               /* Translators: %s is a URI */
-               tip = g_strdup_printf (_("Open '%s'"), ruri);
-               g_free (ruri);
-
-               mime_type = gtk_recent_info_get_mime_type (info);
-               content_type = g_content_type_from_mime_type (mime_type);
-               if (content_type != NULL)
-               {
-                       icon = g_content_type_get_icon (content_type);
-                       g_free (content_type);
-               }
-
-               action = g_object_new (GTK_TYPE_ACTION,
-                                      "name", action_name,
-                                      "label", label,
-                                      "gicon", icon,
-                                      "always-show-image", TRUE,
-                                      "tooltip", tip,
-                                      NULL);
-
-               g_object_set_data_full (G_OBJECT (action),
-                                       "gtk-recent-info",
-                                       gtk_recent_info_ref (info),
-                                       (GDestroyNotify) gtk_recent_info_unref);
-
-               g_signal_connect (action,
-                                 "activate",
-                                 G_CALLBACK (recents_menu_activate),
-                                 window);
-
-               gtk_action_group_add_action (p->recents_action_group,
-                                            action);
-               g_object_unref (action);
-
-               gtk_ui_manager_add_ui (p->manager,
-                                      p->recents_menu_ui_id,
-                                      "/MenuBar/FileMenu/FileRecentsPlaceholder",
-                                      action_name,
-                                      action_name,
-                                      GTK_UI_MANAGER_MENUITEM,
-                                      FALSE);
-
-               g_free (action_name);
-               g_free (label);
-               g_free (tip);
-               if (icon != NULL)
-               {
-                       g_object_unref (icon);
-               }
-       }
-
-       g_list_free (filtered_items);
-       g_list_free_full (items, (GDestroyNotify) gtk_recent_info_unref);
-}
-
-static void
-set_non_homogeneus (GtkWidget *widget,
-                   gpointer   data)
-{
-       gtk_tool_item_set_homogeneous (GTK_TOOL_ITEM (widget), FALSE);
-}
-
-static void
-toolbar_visibility_changed (GtkWidget   *toolbar,
-                           GParamSpec  *pspec,
-                           GeditWindow *window)
-{
-       gboolean visible;
-       GtkAction *action;
-
-       visible = gtk_widget_get_visible (toolbar);
-
-       g_settings_set_boolean (window->priv->ui_settings,
-                               GEDIT_SETTINGS_TOOLBAR_VISIBLE, visible);
-
-       action = gtk_action_group_get_action (window->priv->always_sensitive_action_group,
-                                             "ViewToolbar");
-
-       if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)) != visible)
-               gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), visible);
-}
-
-static void
-setup_toolbar_open_button (GeditWindow *window,
-                          GtkWidget   *toolbar)
-{
-       GtkToolItem *open_button;
-       GtkWidget *recent_menu;
-       GtkAction *action;
-
-       open_button = gedit_open_tool_button_new ();
        g_settings_bind (window->priv->ui_settings,
                         GEDIT_SETTINGS_MAX_RECENTS,
-                        open_button,
+                        window->priv->open_menu,
                         "limit",
                         G_SETTINGS_BIND_GET);
 
-       recent_menu = gtk_menu_tool_button_get_menu (GTK_MENU_TOOL_BUTTON (open_button));
+       recent_menu = gtk_menu_button_get_popup (GTK_MENU_BUTTON (window->priv->open_menu));
 
        g_signal_connect (recent_menu,
                          "item-activated",
                          G_CALLBACK (recent_chooser_item_activated),
                          window);
-
-       action = gtk_action_group_get_action (window->priv->always_sensitive_action_group,
-                                             "FileOpen");
-       g_object_set (action,
-                     "is_important", TRUE,
-                     "short_label", _("Open"),
-                     NULL);
-       gtk_activatable_set_related_action (GTK_ACTIVATABLE (open_button),
-                                           action);
-
-       gtk_toolbar_insert (GTK_TOOLBAR (toolbar),
-                           open_button,
-                           1);
 }
 
 static void
-create_menu_bar_and_toolbar (GeditWindow *window,
-                            GtkWidget   *main_box)
+create_menu_bar_and_toolbar (GeditWindow *window)
 {
        GtkActionGroup *action_group;
-       GtkAction *action;
        GtkUIManager *manager;
-       GtkRecentManager *recent_manager;
-       GError *error = NULL;
-
-       gedit_debug (DEBUG_WINDOW);
 
        manager = gtk_ui_manager_new ();
        window->priv->manager = manager;
 
-       gtk_window_add_accel_group (GTK_WINDOW (window),
-                                   gtk_ui_manager_get_accel_group (manager));
-
-       action_group = gtk_action_group_new ("GeditWindowAlwaysSensitiveActions");
-       gtk_action_group_set_translation_domain (action_group, NULL);
-       gtk_action_group_add_actions (action_group,
-                                     gedit_always_sensitive_menu_entries,
-                                     G_N_ELEMENTS (gedit_always_sensitive_menu_entries),
-                                     window);
-       gtk_action_group_add_toggle_actions (action_group,
-                                            gedit_always_sensitive_toggle_menu_entries,
-                                            G_N_ELEMENTS (gedit_always_sensitive_toggle_menu_entries),
-                                            window);
-
-       gtk_ui_manager_insert_action_group (manager, action_group, 0);
-       g_object_unref (action_group);
-       window->priv->always_sensitive_action_group = action_group;
-
-       action_group = gtk_action_group_new ("GeditWindowActions");
-       gtk_action_group_set_translation_domain (action_group, NULL);
-       gtk_action_group_add_actions (action_group,
-                                     gedit_menu_entries,
-                                     G_N_ELEMENTS (gedit_menu_entries),
-                                     window);
-       gtk_ui_manager_insert_action_group (manager, action_group, 0);
-       g_object_unref (action_group);
-       window->priv->action_group = action_group;
-
-       /* set short labels to use in the toolbar */
-       action = gtk_action_group_get_action (action_group, "FileSave");
-       g_object_set (action, "short_label", _("Save"), NULL);
-       action = gtk_action_group_get_action (action_group, "FilePrint");
-       g_object_set (action, "short_label", _("Print"), NULL);
-       action = gtk_action_group_get_action (action_group, "SearchFind");
-       g_object_set (action, "short_label", _("Find"), NULL);
-       action = gtk_action_group_get_action (action_group, "SearchReplace");
-       g_object_set (action, "short_label", _("Replace"), NULL);
-
-       /* set which actions should have priority on the toolbar */
-       action = gtk_action_group_get_action (action_group, "FileSave");
-       g_object_set (action, "is_important", TRUE, NULL);
-       action = gtk_action_group_get_action (action_group, "EditUndo");
-       g_object_set (action, "is_important", TRUE, NULL);
-
-       action_group = gtk_action_group_new ("GeditQuitWindowActions");
-       gtk_action_group_set_translation_domain (action_group, NULL);
-       gtk_action_group_add_actions (action_group,
-                                     gedit_quit_menu_entries,
-                                     G_N_ELEMENTS (gedit_quit_menu_entries),
-                                     window);
-
-       gtk_ui_manager_insert_action_group (manager, action_group, 0);
-       g_object_unref (action_group);
-       window->priv->quit_action_group = action_group;
-
-       action_group = gtk_action_group_new ("GeditCloseWindowActions");
-       gtk_action_group_set_translation_domain (action_group, NULL);
-       gtk_action_group_add_actions (action_group,
-                                     gedit_close_menu_entries,
-                                     G_N_ELEMENTS (gedit_close_menu_entries),
-                                     window);
-
-       gtk_ui_manager_insert_action_group (manager, action_group, 0);
-       g_object_unref (action_group);
-       window->priv->close_action_group = action_group;
-
-       action_group = gtk_action_group_new ("GeditWindowPanelsActions");
-       gtk_action_group_set_translation_domain (action_group, NULL);
-       gtk_action_group_add_toggle_actions (action_group,
-                                            gedit_panels_toggle_menu_entries,
-                                            G_N_ELEMENTS (gedit_panels_toggle_menu_entries),
-                                            window);
-
-       gtk_ui_manager_insert_action_group (manager, action_group, 0);
-       g_object_unref (action_group);
-       window->priv->panels_action_group = action_group;
-
-       gtk_ui_manager_add_ui_from_resource (manager,
-                                            "/org/gnome/gedit/ui/gedit-ui.xml",
-                                            &error);
-       if (error != NULL)
-       {
-               g_warning ("Could not add ui definition: %s", error->message);
-               g_error_free (error);
-               return;
-       }
-
-       if (!_gedit_app_has_app_menu (GEDIT_APP (g_application_get_default ())))
-       {
-               gtk_ui_manager_add_ui_from_resource (manager,
-                                                    "/org/gnome/gedit/ui/gedit-ui-fallback.xml",
-                                                    &error);
-               if (error != NULL)
-               {
-                       g_warning ("Could not add fallback ui definition: %s", error->message);
-                       g_error_free (error);
-                       return;
-               }
-       }
-
-       /* show tooltips in the statusbar */
-       g_signal_connect (manager,
-                         "connect_proxy",
-                         G_CALLBACK (connect_proxy_cb),
-                         window);
-       g_signal_connect (manager,
-                         "disconnect_proxy",
-                         G_CALLBACK (disconnect_proxy_cb),
-                         window);
-
-       /* recent files menu */
-       action_group = gtk_action_group_new ("RecentFilesActions");
-       gtk_action_group_set_translation_domain (action_group, NULL);
-       window->priv->recents_action_group = action_group;
-       gtk_ui_manager_insert_action_group (manager, action_group, 0);
-       g_object_unref (action_group);
-
-       recent_manager = gtk_recent_manager_get_default ();
-       window->priv->recents_handler_id = g_signal_connect (recent_manager,
-                                                            "changed",
-                                                            G_CALLBACK (recent_manager_changed),
-                                                            window);
-       update_recent_files_menu (window);
+       gedit_debug (DEBUG_WINDOW);
 
        /* list of open documents menu */
        action_group = gtk_action_group_new ("DocumentsListActions");
@@ -1327,44 +836,6 @@ create_menu_bar_and_toolbar (GeditWindow *window,
        window->priv->documents_list_action_group = action_group;
        gtk_ui_manager_insert_action_group (manager, action_group, 0);
        g_object_unref (action_group);
-
-       window->priv->menubar = gtk_ui_manager_get_widget (manager, "/MenuBar");
-       gtk_box_pack_start (GTK_BOX (main_box),
-                           window->priv->menubar,
-                           FALSE,
-                           FALSE,
-                           0);
-
-       window->priv->toolbar = gtk_ui_manager_get_widget (manager, "/ToolBar");
-       gtk_style_context_add_class (gtk_widget_get_style_context (window->priv->toolbar),
-                                    GTK_STYLE_CLASS_PRIMARY_TOOLBAR);
-
-       gtk_box_pack_start (GTK_BOX (main_box),
-                           window->priv->toolbar,
-                           FALSE,
-                           FALSE,
-                           0);
-
-       /* XXX: We shouldn't need this special case, gtk+ should take care of
-               using this setting when it is in windows */
-#ifdef G_OS_WIN32
-       gtk_toolbar_set_style (GTK_TOOLBAR (window->priv->toolbar),
-                              GTK_TOOLBAR_ICONS);
-#else
-       gtk_toolbar_unset_style (GTK_TOOLBAR (window->priv->toolbar));
-#endif
-       set_toolbar_visibility (window, NULL);
-
-       setup_toolbar_open_button (window, window->priv->toolbar);
-
-       gtk_container_foreach (GTK_CONTAINER (window->priv->toolbar),
-                              (GtkCallback)set_non_homogeneus,
-                              NULL);
-
-       g_signal_connect_after (G_OBJECT (window->priv->toolbar),
-                               "notify::visible",
-                               G_CALLBACK (toolbar_visibility_changed),
-                               window);
 }
 
 static void
@@ -1605,55 +1076,6 @@ activate_documents_list_item (GeditWindow *window,
        g_free (action_name);
 }
 
-/* Returns TRUE if status bar is visible */
-static gboolean
-set_statusbar_style (GeditWindow *window,
-                    GeditWindow *origin)
-{
-       GtkAction *action;
-       gboolean visible;
-
-       if (origin == NULL)
-       {
-               visible = g_settings_get_boolean (window->priv->ui_settings,
-                                                 GEDIT_SETTINGS_STATUSBAR_VISIBLE);
-       }
-       else
-       {
-               visible = gtk_widget_get_visible (origin->priv->statusbar);
-       }
-
-       gtk_widget_set_visible (window->priv->statusbar, visible);
-
-       action = gtk_action_group_get_action (window->priv->always_sensitive_action_group,
-                                             "ViewStatusbar");
-
-       if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)) != visible)
-               gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), visible);
-
-       return visible;
-}
-
-static void
-statusbar_visibility_changed (GtkWidget   *statusbar,
-                             GParamSpec  *pspec,
-                             GeditWindow *window)
-{
-       gboolean visible;
-       GtkAction *action;
-
-       visible = gtk_widget_get_visible (statusbar);
-
-       g_settings_set_boolean (window->priv->ui_settings,
-                               GEDIT_SETTINGS_STATUSBAR_VISIBLE, visible);
-
-       action = gtk_action_group_get_action (window->priv->always_sensitive_action_group,
-                                             "ViewStatusbar");
-
-       if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)) != visible)
-               gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), visible);
-}
-
 static void
 tab_width_combo_item_activated (GtkMenuItem *item,
                                GeditWindow *window)
@@ -1753,92 +1175,48 @@ create_tab_width_combo (GeditWindow *window)
 }
 
 static void
-language_combo_item_activated (GtkMenuItem *item,
-                              GeditWindow *window)
+on_language_button_clicked (GtkButton   *button,
+                            GeditWindow *window)
 {
-       GeditDocument *doc;
-       GtkSourceLanguage *language;
-
-       doc = gedit_window_get_active_document (window);
-
-       if (!doc)
-               return;
-
-       language = GTK_SOURCE_LANGUAGE (g_object_get_data (G_OBJECT (item), LANGUAGE_DATA));
-       gedit_document_set_language (doc, language);
+       _gedit_cmd_view_highlight_mode (NULL, NULL, window);
 }
 
 static void
-create_language_combo (GeditWindow *window)
+create_language_button (GeditWindow *window)
 {
-       GtkSourceLanguageManager *lm;
-       const gchar * const *ids;
-       const gchar *name;
-       GtkWidget *item;
-       gint i;
+       GtkWidget *box;
+       GtkWidget *arrow;
 
-       window->priv->language_combo = gedit_status_menu_button_new ();
-       window->priv->language_combo_menu = gtk_menu_new ();
-       gtk_menu_button_set_popup (GTK_MENU_BUTTON (window->priv->language_combo),
-                                  window->priv->language_combo_menu);
-       gtk_widget_show (window->priv->language_combo);
+       // quick hack to have the right style
+       window->priv->language_button = gedit_close_button_new ();
+       gtk_widget_show (window->priv->language_button);
        gtk_box_pack_end (GTK_BOX (window->priv->statusbar),
-                         window->priv->language_combo,
-                         FALSE,
-                         TRUE,
-                         0);
-
-       name = _("Plain Text");
-       item = gtk_menu_item_new_with_label (name);
-       gtk_widget_show (item);
+                         window->priv->language_button,
+                         FALSE, TRUE, 0);
 
-       g_object_set_data (G_OBJECT (item), LANGUAGE_DATA, NULL);
-       gtk_menu_shell_append (GTK_MENU_SHELL (window->priv->language_combo_menu),
-                              GTK_WIDGET (item));
-       g_signal_connect (item,
-                         "activate",
-                         G_CALLBACK (language_combo_item_activated),
-                         window);
-
-       lm = gtk_source_language_manager_get_default ();
-       ids = gtk_source_language_manager_get_language_ids (lm);
-
-       for (i = 0; ids[i] != NULL; i++)
-       {
-               GtkSourceLanguage *lang;
-
-               lang = gtk_source_language_manager_get_language (lm, ids[i]);
-
-               if (!gtk_source_language_get_hidden (lang))
-               {
-                       name = gtk_source_language_get_name (lang);
-                       item = gtk_menu_item_new_with_label (name);
-                       gtk_widget_show (item);
+       gtk_widget_destroy (gtk_bin_get_child (GTK_BIN (window->priv->language_button)));
+       box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3);
+       gtk_widget_show (box);
+       gtk_container_add (GTK_CONTAINER (window->priv->language_button), box);
 
-                       g_object_set_data_full (G_OBJECT (item),
-                                               LANGUAGE_DATA,
-                                               g_object_ref (lang),
-                                               (GDestroyNotify)g_object_unref);
+       window->priv->language_button_label = gtk_label_new (NULL);
+       gtk_widget_show (window->priv->language_button_label);
+       gtk_box_pack_start (GTK_BOX (box), window->priv->language_button_label,
+                           FALSE, TRUE, 0);
 
-                       gtk_menu_shell_append (GTK_MENU_SHELL (window->priv->language_combo_menu),
-                                              GTK_WIDGET (item));
+       arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE);
+       gtk_widget_show (arrow);
+       gtk_box_pack_start (GTK_BOX (box), arrow, FALSE, FALSE, 0);
 
-                       g_signal_connect (item,
-                                         "activate",
-                                         G_CALLBACK (language_combo_item_activated),
-                                         window);
-               }
-       }
+       g_signal_connect (window->priv->language_button, "clicked",
+                         G_CALLBACK (on_language_button_clicked), window);
 }
 
 static void
-create_statusbar (GeditWindow *window,
-                 GtkWidget   *main_box)
+setup_statusbar (GeditWindow *window)
 {
        gedit_debug (DEBUG_WINDOW);
 
-       window->priv->statusbar = gedit_statusbar_new ();
-
        window->priv->generic_message_cid = gtk_statusbar_get_context_id
                (GTK_STATUSBAR (window->priv->statusbar), "generic_message");
        window->priv->tip_message_cid = gtk_statusbar_get_context_id
@@ -1846,21 +1224,14 @@ create_statusbar (GeditWindow *window,
        window->priv->bracket_match_message_cid = gtk_statusbar_get_context_id
                (GTK_STATUSBAR (window->priv->statusbar), "bracket_match_message");
 
-       gtk_box_pack_end (GTK_BOX (main_box),
-                         window->priv->statusbar,
-                         FALSE,
-                         TRUE,
-                         0);
-
        create_tab_width_combo (window);
-       create_language_combo (window);
+       create_language_button (window);
 
-       g_signal_connect_after (G_OBJECT (window->priv->statusbar),
-                               "notify::visible",
-                               G_CALLBACK (statusbar_visibility_changed),
-                               window);
-
-       set_statusbar_style (window, NULL);
+       g_settings_bind (window->priv->ui_settings,
+                        "statusbar-visible",
+                        window->priv->statusbar,
+                        "visible",
+                        G_SETTINGS_BIND_GET);
 }
 
 static GeditWindow *
@@ -1905,14 +1276,6 @@ clone_window (GeditWindow *origin)
        _gedit_panel_set_active_item_by_id (GEDIT_PANEL (window->priv->bottom_panel),
                                            panel_page);
 
-       gtk_widget_set_visible (window->priv->side_panel,
-                               gtk_widget_get_visible (origin->priv->side_panel));
-       gtk_widget_set_visible (window->priv->bottom_panel,
-                               gtk_widget_get_visible (origin->priv->bottom_panel));
-
-       set_statusbar_style (window, origin);
-       set_toolbar_visibility (window, origin);
-
        return window;
 }
 
@@ -2005,7 +1368,9 @@ set_title (GeditWindow *window)
        GeditDocument *doc = NULL;
        gchar *name;
        gchar *dirname = NULL;
+       gchar *main_title = NULL;
        gchar *title = NULL;
+       gchar *subtitle = NULL;
        gint len;
 
        tab = gedit_window_get_active_tab (window);
@@ -2073,42 +1438,55 @@ set_title (GeditWindow *window)
 
        if (gedit_document_get_readonly (doc))
        {
+               title = g_strdup_printf ("%s [%s]",
+                                        name, _("Read-Only"));
+
                if (dirname != NULL)
                {
-                       title = g_strdup_printf ("%s [%s] (%s) - gedit",
-                                                name,
-                                                _("Read-Only"),
-                                                dirname);
+                       main_title = g_strdup_printf ("%s [%s] (%s) - gedit",
+                                                     name,
+                                                     _("Read-Only"),
+                                                     dirname);
+                       subtitle = dirname;
                }
                else
                {
-                       title = g_strdup_printf ("%s [%s] - gedit",
-                                                name,
-                                                _("Read-Only"));
+                       main_title = g_strdup_printf ("%s [%s] - gedit",
+                                                     name,
+                                                     _("Read-Only"));
                }
        }
        else
        {
+               title = g_strdup (name);
+
                if (dirname != NULL)
                {
-                       title = g_strdup_printf ("%s (%s) - gedit",
-                                                name,
-                                                dirname);
+                       main_title = g_strdup_printf ("%s (%s) - gedit",
+                                                     name,
+                                                     dirname);
+                       subtitle = dirname;
                }
                else
                {
-                       title = g_strdup_printf ("%s - gedit",
-                                                name);
+                       main_title = g_strdup_printf ("%s - gedit",
+                                                     name);
                }
        }
 
        gedit_app_set_window_title (GEDIT_APP (g_application_get_default ()),
                                    window,
-                                   title);
+                                   main_title);
+
+       gtk_header_bar_set_title (GTK_HEADER_BAR (window->priv->headerbar),
+                                 title);
+       gtk_header_bar_set_subtitle (GTK_HEADER_BAR (window->priv->headerbar),
+                                    subtitle);
 
        g_free (dirname);
        g_free (name);
        g_free (title);
+       g_free (main_title);
 }
 
 #undef MAX_TITLE_LENGTH
@@ -2178,7 +1556,11 @@ language_changed (GObject     *object,
        else
                label = _("Plain Text");
 
-       gedit_status_menu_button_set_label (GEDIT_STATUS_MENU_BUTTON (window->priv->language_combo), label);
+       gtk_label_set_text (GTK_LABEL (window->priv->language_button_label), label);
+
+       peas_extension_set_foreach (window->priv->extensions,
+                                   (PeasExtensionSetForeachFunc) extension_update_state,
+                                   window);
 }
 
 static void
@@ -2224,7 +1606,7 @@ update_statusbar (GeditWindow *window,
                                       gtk_text_view_get_overwrite (GTK_TEXT_VIEW (new_view)));
 
        gtk_widget_show (window->priv->tab_width_combo);
-       gtk_widget_show (window->priv->language_combo);
+       gtk_widget_show (window->priv->language_button);
 
        /* find the use spaces item */
        items = gtk_container_get_children (GTK_CONTAINER (window->priv->tab_width_combo_menu));
@@ -2286,56 +1668,88 @@ tab_switched (GeditMultiNotebook *mnb,
 static void
 set_sensitivity_according_to_window_state (GeditWindow *window)
 {
-       GtkAction *action;
+       GAction *action;
        GeditLockdownMask lockdown;
        gint num_tabs;
 
        lockdown = gedit_app_get_lockdown (GEDIT_APP (g_application_get_default ()));
+       num_tabs = gedit_multi_notebook_get_n_tabs (window->priv->multi_notebook);
 
        /* We disable File->Quit/SaveAll/CloseAll while printing to avoid to have two
           operations (save and print/print preview) that uses the message area at
           the same time (may be we can remove this limitation in the future) */
        /* We disable File->Quit/CloseAll if state is saving since saving cannot be
           cancelled (may be we can remove this limitation in the future) */
-       gtk_action_group_set_sensitive (window->priv->quit_action_group,
-                                 !(window->priv->state & GEDIT_WINDOW_STATE_SAVING) &&
-                                 !(window->priv->state & GEDIT_WINDOW_STATE_PRINTING));
-
-       action = gtk_action_group_get_action (window->priv->action_group,
-                                             "FileCloseAll");
-       gtk_action_set_sensitive (action,
-                                 !(window->priv->state & GEDIT_WINDOW_STATE_SAVING) &&
-                                 !(window->priv->state & GEDIT_WINDOW_STATE_PRINTING));
-
-       action = gtk_action_group_get_action (window->priv->action_group,
-                                             "FileSaveAll");
-       gtk_action_set_sensitive (action,
-                                 !(window->priv->state & GEDIT_WINDOW_STATE_PRINTING) &&
-                                 !(lockdown & GEDIT_LOCKDOWN_SAVE_TO_DISK));
+       action = g_action_map_lookup_action (G_ACTION_MAP (g_application_get_default ()),
+                                            "quit");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
+                                    !(window->priv->state & GEDIT_WINDOW_STATE_SAVING) &&
+                                    !(window->priv->state & GEDIT_WINDOW_STATE_PRINTING) &&
+                                    num_tabs > 0);
 
-       num_tabs = gedit_multi_notebook_get_n_tabs (window->priv->multi_notebook);
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "close_all");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
+                                    !(window->priv->state & GEDIT_WINDOW_STATE_SAVING) &&
+                                    !(window->priv->state & GEDIT_WINDOW_STATE_PRINTING));
 
-       if (!gtk_action_group_get_sensitive (window->priv->action_group))
-       {
-               gtk_action_group_set_sensitive (window->priv->action_group,
-                                               num_tabs > 0);
-       }
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "save_all");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
+                                    !(window->priv->state & GEDIT_WINDOW_STATE_PRINTING) &&
+                                    !(lockdown & GEDIT_LOCKDOWN_SAVE_TO_DISK));
 
-       if (!gtk_action_group_get_sensitive (window->priv->quit_action_group))
-       {
-               gtk_action_group_set_sensitive (window->priv->quit_action_group,
-                                               num_tabs > 0);
-       }
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "save");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action), num_tabs > 0);
+
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "save_as");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action), num_tabs > 0);
+
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "revert");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action), num_tabs > 0);
+
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "print");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action), num_tabs > 0);
+
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "find");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action), num_tabs > 0);
+
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "replace");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action), num_tabs > 0);
+
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "find_next");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action), num_tabs > 0);
+
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "find_prev");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action), num_tabs > 0);
+
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "clear_highlight");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action), num_tabs > 0);
 
-       if (!gtk_action_group_get_sensitive (window->priv->close_action_group))
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "goto_line");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action), num_tabs > 0);
+
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "new_tab_group");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action), num_tabs > 0);
+
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "previous_document");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action), num_tabs > 0);
+
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "next_document");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action), num_tabs > 0);
+
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "move_to_new_window");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action), num_tabs > 1);
+
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "highlight_mode");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action), num_tabs > 0);
+
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "close");
+       if (!g_action_get_enabled (action))
        {
 #ifdef OS_OSX
                /* On OS X, File Close is always sensitive */
-               gtk_action_group_set_sensitive (window->priv->close_action_group,
-                                               TRUE);
+               g_simple_action_set_enabled (G_SIMPLE_ACTION (action), TRUE);
 #else
-               gtk_action_group_set_sensitive (window->priv->close_action_group,
-                                               num_tabs > 0);
+               g_simple_action_set_enabled (G_SIMPLE_ACTION (action), num_tabs > 0);
 #endif
        }
 }
@@ -2352,7 +1766,7 @@ _gedit_window_set_lockdown (GeditWindow       *window,
                            GeditLockdownMask  lockdown)
 {
        GeditTab *tab;
-       GtkAction *action;
+       GAction *action;
        gboolean autosave;
 
        /* start/stop autosave in each existing tab */
@@ -2368,11 +1782,10 @@ _gedit_window_set_lockdown (GeditWindow       *window,
 
        set_sensitivity_according_to_tab (window, tab);
 
-       action = gtk_action_group_get_action (window->priv->action_group,
-                                             "FileSaveAll");
-       gtk_action_set_sensitive (action,
-                                 !(window->priv->state & GEDIT_WINDOW_STATE_PRINTING) &&
-                                 !(lockdown & GEDIT_LOCKDOWN_SAVE_TO_DISK));
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "save_all");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
+                                    !(window->priv->state & GEDIT_WINDOW_STATE_PRINTING) &&
+                                    !(lockdown & GEDIT_LOCKDOWN_SAVE_TO_DISK));
 }
 
 static void
@@ -2520,13 +1933,16 @@ sync_name (GeditTab    *tab,
 
        if (tab == gedit_window_get_active_tab (window))
        {
+               GAction *gaction;
+
                set_title (window);
 
                doc = gedit_tab_get_document (tab);
-               action = gtk_action_group_get_action (window->priv->action_group,
-                                                     "FileRevert");
-               gtk_action_set_sensitive (action,
-                                         !gedit_document_is_untitled (doc));
+               
+               gaction = g_action_map_lookup_action (G_ACTION_MAP (window),
+                                                     "revert");
+               g_simple_action_set_enabled (G_SIMPLE_ACTION (gaction),
+                                            !gedit_document_is_untitled (doc));
        }
 
        /* sync the item in the documents list menu */
@@ -2736,9 +2152,9 @@ run_fullscreen_animation (gpointer data)
 }
 
 static void
-show_hide_fullscreen_toolbar (GeditWindow *window,
-                             gboolean     show,
-                             gint         height)
+show_hide_fullscreen_controls (GeditWindow *window,
+                              gboolean     show,
+                              gint         height)
 {
        GtkSettings *settings;
        gboolean enable_animations;
@@ -2791,7 +2207,7 @@ on_fullscreen_controls_enter_notify_event (GtkWidget        *widget,
                                           GdkEventCrossing *event,
                                           GeditWindow      *window)
 {
-       show_hide_fullscreen_toolbar (window, TRUE, 0);
+       show_hide_fullscreen_controls (window, TRUE, 0);
 
        return FALSE;
 }
@@ -2815,45 +2231,23 @@ on_fullscreen_controls_leave_notify_event (GtkWidget        *widget,
         */
        if (y >= h)
        {
-               show_hide_fullscreen_toolbar (window, FALSE, h);
+               show_hide_fullscreen_controls (window, FALSE, h);
        }
 
        return FALSE;
 }
 
 static void
-fullscreen_controls_build (GeditWindow *window)
+fullscreen_controls_setup (GeditWindow *window)
 {
        GeditWindowPrivate *priv = window->priv;
-       GtkWidget *toolbar;
-       GtkAction *action;
 
-       if (priv->fullscreen_controls != NULL)
+       if (priv->fullscreen_controls_setup)
                return;
 
-       priv->fullscreen_controls = gtk_window_new (GTK_WINDOW_POPUP);
-
        gtk_window_set_transient_for (GTK_WINDOW (priv->fullscreen_controls),
                                      GTK_WINDOW (&window->window));
-
-       /* popup toolbar */
-       toolbar = gtk_ui_manager_get_widget (priv->manager, "/FullscreenToolBar");
-       gtk_container_add (GTK_CONTAINER (priv->fullscreen_controls),
-                          toolbar);
-
-       action = gtk_action_group_get_action (priv->always_sensitive_action_group,
-                                             "LeaveFullscreen");
-       g_object_set (action, "is-important", TRUE, NULL);
-
-       setup_toolbar_open_button (window, toolbar);
-
-       gtk_container_foreach (GTK_CONTAINER (toolbar),
-                              (GtkCallback)set_non_homogeneus,
-                              NULL);
-
-       /* Set the toolbar style */
-       gtk_toolbar_set_style (GTK_TOOLBAR (toolbar),
-                              GTK_TOOLBAR_BOTH_HORIZ);
+       gtk_window_set_attached_to (GTK_WINDOW (window), priv->fullscreen_controls);
 
        g_signal_connect (priv->fullscreen_controls, "enter-notify-event",
                          G_CALLBACK (on_fullscreen_controls_enter_notify_event),
@@ -2861,6 +2255,7 @@ fullscreen_controls_build (GeditWindow *window)
        g_signal_connect (priv->fullscreen_controls, "leave-notify-event",
                          G_CALLBACK (on_fullscreen_controls_leave_notify_event),
                          window);
+       priv->fullscreen_controls_setup = TRUE;
 }
 
 static void
@@ -2868,25 +2263,27 @@ empty_search_notify_cb (GeditDocument *doc,
                        GParamSpec    *pspec,
                        GeditWindow   *window)
 {
-       gboolean sensitive;
-       GtkAction *action;
+       GAction *action;
+       gboolean enabled;
 
        if (doc != gedit_window_get_active_document (window))
                return;
 
-       sensitive = !_gedit_document_get_empty_search (doc);
+       enabled = !_gedit_document_get_empty_search (doc);
 
-       action = gtk_action_group_get_action (window->priv->action_group,
-                                             "SearchFindNext");
-       gtk_action_set_sensitive (action, sensitive);
+       action = g_action_map_lookup_action (G_ACTION_MAP (window),
+                                            "clear_highlight");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action), enabled);
 
-       action = gtk_action_group_get_action (window->priv->action_group,
-                                             "SearchFindPrevious");
-       gtk_action_set_sensitive (action, sensitive);
 
-       action = gtk_action_group_get_action (window->priv->action_group,
-                                             "SearchClearHighlight");
-       gtk_action_set_sensitive (action, sensitive);
+       action = g_action_map_lookup_action (G_ACTION_MAP (window),
+                                            "find_next");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action), enabled);
+
+
+       action = g_action_map_lookup_action (G_ACTION_MAP (window),
+                                            "find_prev");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action), enabled);
 }
 
 static void
@@ -2894,17 +2291,16 @@ can_undo (GeditDocument *doc,
          GParamSpec    *pspec,
          GeditWindow   *window)
 {
-       GtkAction *action;
-       gboolean sensitive;
+       GAction *action;
+       gboolean enabled;
 
-       sensitive = gtk_source_buffer_can_undo (GTK_SOURCE_BUFFER (doc));
+       enabled = gtk_source_buffer_can_undo (GTK_SOURCE_BUFFER (doc));
 
        if (doc != gedit_window_get_active_document (window))
                return;
 
-       action = gtk_action_group_get_action (window->priv->action_group,
-                                            "EditUndo");
-       gtk_action_set_sensitive (action, sensitive);
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "undo");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action), enabled);
 }
 
 static void
@@ -2912,17 +2308,16 @@ can_redo (GeditDocument *doc,
          GParamSpec    *pspec,
          GeditWindow   *window)
 {
-       GtkAction *action;
-       gboolean sensitive;
+       GAction *action;
+       gboolean enabled;
 
-       sensitive = gtk_source_buffer_can_redo (GTK_SOURCE_BUFFER (doc));
+       enabled = gtk_source_buffer_can_redo (GTK_SOURCE_BUFFER (doc));
 
        if (doc != gedit_window_get_active_document (window))
                return;
 
-       action = gtk_action_group_get_action (window->priv->action_group,
-                                            "EditRedo");
-       gtk_action_set_sensitive (action, sensitive);
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "redo");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action), enabled);
 }
 
 static void
@@ -2932,7 +2327,7 @@ selection_changed (GeditDocument *doc,
 {
        GeditTab *tab;
        GeditView *view;
-       GtkAction *action;
+       GAction *action;
        GeditTabState state;
        gboolean state_normal;
        gboolean editable;
@@ -2949,37 +2344,24 @@ selection_changed (GeditDocument *doc,
        view = gedit_tab_get_view (tab);
        editable = gtk_text_view_get_editable (GTK_TEXT_VIEW (view));
 
-       action = gtk_action_group_get_action (window->priv->action_group,
-                                             "EditCut");
-       gtk_action_set_sensitive (action,
-                                 state_normal &&
-                                 editable &&
-                                 gtk_text_buffer_get_has_selection (GTK_TEXT_BUFFER (doc)));
-
-       action = gtk_action_group_get_action (window->priv->action_group,
-                                             "EditCopy");
-       gtk_action_set_sensitive (action,
-                                 (state_normal ||
-                                  state == GEDIT_TAB_STATE_EXTERNALLY_MODIFIED_NOTIFICATION) &&
-                                 gtk_text_buffer_get_has_selection (GTK_TEXT_BUFFER (doc)));
-
-       action = gtk_action_group_get_action (window->priv->action_group,
-                                             "EditDelete");
-       gtk_action_set_sensitive (action,
-                                 state_normal &&
-                                 editable &&
-                                 gtk_text_buffer_get_has_selection (GTK_TEXT_BUFFER (doc)));
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "cut");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
+                                    state_normal &&
+                                    editable &&
+                                    gtk_text_buffer_get_has_selection (GTK_TEXT_BUFFER (doc)));
 
-       peas_extension_set_foreach (window->priv->extensions,
-                                   (PeasExtensionSetForeachFunc) extension_update_state,
-                                   window);
-}
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "copy");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
+                                    (state_normal ||
+                                     state == GEDIT_TAB_STATE_EXTERNALLY_MODIFIED_NOTIFICATION) &&
+                                    gtk_text_buffer_get_has_selection (GTK_TEXT_BUFFER (doc)));
+
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "delete");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
+                                    state_normal &&
+                                    editable &&
+                                    gtk_text_buffer_get_has_selection (GTK_TEXT_BUFFER (doc)));
 
-static void
-sync_languages_menu (GeditDocument *doc,
-                    GParamSpec    *pspec,
-                    GeditWindow   *window)
-{
        peas_extension_set_foreach (window->priv->extensions,
                                    (PeasExtensionSetForeachFunc) extension_update_state,
                                    window);
@@ -3015,28 +2397,67 @@ update_sensitivity_according_to_open_tabs (GeditWindow *window,
                                           gint         num_notebooks,
                                           gint         num_tabs)
 {
-       GtkAction *action;
+       GAction *action;
+
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "save");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action), num_tabs > 0);
+
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "save_as");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action), num_tabs > 0);
+
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "revert");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action), num_tabs > 0);
+
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "print");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action), num_tabs > 0);
+
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "find");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action), num_tabs > 0);
+
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "find_next");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action), num_tabs > 0);
+
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "replace");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action), num_tabs > 0);
+
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "find_prev");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action), num_tabs > 0);
+
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "clear_highlight");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action), num_tabs > 0);
 
-       /* Set sensitivity */
-       gtk_action_group_set_sensitive (window->priv->action_group,
-                                       num_tabs != 0);
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "goto_line");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action), num_tabs > 0);
 
-       action = gtk_action_group_get_action (window->priv->action_group,
-                                            "DocumentsMoveToNewWindow");
-       gtk_action_set_sensitive (action, num_tabs > 1);
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "new_tab_group");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action), num_tabs > 0);
 
-       action = gtk_action_group_get_action (window->priv->action_group,
-                                             "DocumentsPreviousTabGroup");
-       gtk_action_set_sensitive (action, num_notebooks > 1);
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "previous_document");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action), num_tabs > 0);
 
-       action = gtk_action_group_get_action (window->priv->action_group,
-                                             "DocumentsNextTabGroup");
-       gtk_action_set_sensitive (action, num_notebooks > 1);
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "next_document");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action), num_tabs > 0);
+
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "move_to_new_window");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
+                                    num_tabs > 1);
+
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "previous_tab_group");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
+                                    num_notebooks > 1);
+
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "next_tab_group");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
+                                    num_notebooks > 1);
+
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "highlight_mode");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action), num_tabs > 0);
 
        /* Do not set close action insensitive on OS X */
 #ifndef OS_OSX
-       gtk_action_group_set_sensitive (window->priv->close_action_group,
-                                       num_tabs != 0);
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "close");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
+                                    num_tabs != 0);
 #endif
 }
 
@@ -3106,10 +2527,6 @@ on_tab_added (GeditMultiNotebook *multi,
                          G_CALLBACK (selection_changed),
                          window);
        g_signal_connect (doc,
-                         "notify::language",
-                         G_CALLBACK (sync_languages_menu),
-                         window);
-       g_signal_connect (doc,
                          "notify::read-only",
                          G_CALLBACK (readonly_changed),
                          window);
@@ -3180,9 +2597,6 @@ on_tab_removed (GeditMultiNotebook *multi,
                                              G_CALLBACK (selection_changed),
                                              window);
        g_signal_handlers_disconnect_by_func (doc,
-                                             G_CALLBACK (sync_languages_menu),
-                                             window);
-       g_signal_handlers_disconnect_by_func (doc,
                                              G_CALLBACK (readonly_changed),
                                              window);
        g_signal_handlers_disconnect_by_func (view,
@@ -3225,7 +2639,7 @@ on_tab_removed (GeditMultiNotebook *multi,
 
                /* hide the combos */
                gtk_widget_hide (window->priv->tab_width_combo);
-               gtk_widget_hide (window->priv->language_combo);
+               gtk_widget_hide (window->priv->language_button);
        }
 
        if (!window->priv->dispose_has_run)
@@ -3407,51 +2821,39 @@ vpaned_restore_position (GtkWidget   *widget,
 }
 
 static void
-side_panel_visibility_changed (GtkWidget   *side_panel,
-                              GParamSpec  *pspec,
-                              GeditWindow *window)
+side_panel_visibility_changed (GSettings   *settings,
+                               const gchar *key,
+                               GeditWindow *window)
 {
        gboolean visible;
-       GtkAction *action;
 
-       visible = gtk_widget_get_visible (side_panel);
+       visible = g_settings_get_boolean (settings, key);
 
-       g_settings_set_boolean (window->priv->ui_settings,
-                               GEDIT_SETTINGS_SIDE_PANEL_VISIBLE,
-                               visible);
+       gtk_widget_set_visible (window->priv->side_panel, visible);
 
-       action = gtk_action_group_get_action (window->priv->panels_action_group,
-                                             "ViewSidePanel");
-
-       if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)) != visible)
-               gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), visible);
-
-       /* focus the document */
-       if (!visible)
+       /* focus the right widget */
+       if (visible)
+       {
+               gtk_widget_grab_focus (window->priv->side_panel);
+       }
+       else
        {
                gtk_widget_grab_focus (GTK_WIDGET (window->priv->multi_notebook));
        }
 }
 
 static void
-create_side_panel (GeditWindow *window)
+setup_side_panel (GeditWindow *window)
 {
        GtkWidget *documents_panel;
        GtkWidget *image;
 
        gedit_debug (DEBUG_WINDOW);
 
-       window->priv->side_panel = gedit_panel_new (GTK_ORIENTATION_VERTICAL);
-
-       gtk_paned_pack1 (GTK_PANED (window->priv->hpaned),
-                        window->priv->side_panel,
-                        FALSE,
-                        FALSE);
-
-       g_signal_connect_after (window->priv->side_panel,
-                               "notify::visible",
-                               G_CALLBACK (side_panel_visibility_changed),
-                               window);
+       g_signal_connect (window->priv->ui_settings,
+                         "changed::side-panel-visible",
+                         G_CALLBACK (side_panel_visibility_changed),
+                         window);
 
        documents_panel = gedit_documents_panel_new (window);
        image = gtk_image_new_from_icon_name ("view-list-symbolic",
@@ -3465,27 +2867,23 @@ create_side_panel (GeditWindow *window)
 }
 
 static void
-bottom_panel_visibility_changed (GeditPanel  *bottom_panel,
-                                GParamSpec  *pspec,
+bottom_panel_visibility_changed (GSettings   *settings,
+                                const gchar *key,
                                 GeditWindow *window)
 {
        gboolean visible;
-       GtkAction *action;
-
-       visible = gtk_widget_get_visible (GTK_WIDGET (bottom_panel));
-
-       g_settings_set_boolean (window->priv->ui_settings,
-                               GEDIT_SETTINGS_BOTTOM_PANEL_VISIBLE,
-                               visible);
 
-       action = gtk_action_group_get_action (window->priv->panels_action_group,
-                                             "ViewBottomPanel");
+       visible = g_settings_get_boolean (settings, key) &&
+                 gedit_panel_get_n_items (GEDIT_PANEL (window->priv->bottom_panel)) > 0;
 
-       if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)) != visible)
-               gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), visible);
+       gtk_widget_set_visible (window->priv->bottom_panel, visible);
 
-       /* focus the document */
-       if (!visible)
+       /* focus the right widget */
+       if (visible)
+       {
+               gtk_widget_grab_focus (window->priv->bottom_panel);
+       }
+       else
        {
                gtk_widget_grab_focus (GTK_WIDGET (window->priv->multi_notebook));
        }
@@ -3498,13 +2896,7 @@ bottom_panel_item_removed (GeditPanel  *panel,
 {
        if (gedit_panel_get_n_items (panel) == 0)
        {
-               GtkAction *action;
-
                gtk_widget_hide (GTK_WIDGET (panel));
-
-               action = gtk_action_group_get_action (window->priv->panels_action_group,
-                                                     "ViewBottomPanel");
-               gtk_action_set_sensitive (action, FALSE);
        }
 }
 
@@ -3517,33 +2909,24 @@ bottom_panel_item_added (GeditPanel  *panel,
         * sensitive and if needed show the panel */
        if (gedit_panel_get_n_items (panel) == 1)
        {
-               GtkAction *action;
                gboolean show;
 
-               action = gtk_action_group_get_action (window->priv->panels_action_group,
-                                                     "ViewBottomPanel");
-               gtk_action_set_sensitive (action, TRUE);
-
-               show = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
+               show = g_settings_get_boolean (window->priv->ui_settings,
+                                              "bottom-panel-visible");
                if (show)
+               {
                        gtk_widget_show (GTK_WIDGET (panel));
+               }
        }
 }
 
 static void
-create_bottom_panel (GeditWindow *window)
+setup_bottom_panel (GeditWindow *window)
 {
        gedit_debug (DEBUG_WINDOW);
 
-       window->priv->bottom_panel = gedit_panel_new (GTK_ORIENTATION_HORIZONTAL);
-
-       gtk_paned_pack2 (GTK_PANED (window->priv->vpaned),
-                        window->priv->bottom_panel,
-                        FALSE,
-                        FALSE);
-
-       g_signal_connect_after (window->priv->bottom_panel,
-                               "notify::visible",
+       g_signal_connect_after (window->priv->ui_settings,
+                               "changed::bottom-panel-visible",
                                G_CALLBACK (bottom_panel_visibility_changed),
                                window);
 }
@@ -3586,13 +2969,6 @@ init_panels_visibility (GeditWindow *window)
                        gtk_widget_show (window->priv->bottom_panel);
                }
        }
-       else
-       {
-               GtkAction *action;
-               action = gtk_action_group_get_action (window->priv->panels_action_group,
-                                                     "ViewBottomPanel");
-               gtk_action_set_sensitive (action, FALSE);
-       }
 
        /* start track sensitivity after the initial state is set */
        window->priv->bottom_panel_item_removed_handler_id =
@@ -3681,10 +3057,58 @@ extension_removed (PeasExtensionSet *extensions,
        gtk_ui_manager_ensure_update (window->priv->manager);
 }
 
+static GActionEntry win_entries[] = {
+       { "open", _gedit_cmd_file_open },
+       { "new_tab", _gedit_cmd_file_new },
+       { "save", _gedit_cmd_file_save },
+       { "save_as", _gedit_cmd_file_save_as },
+       { "print", _gedit_cmd_file_print },
+       { "revert", _gedit_cmd_file_revert },
+       { "close", _gedit_cmd_file_close },
+       { "fullscreen", _gedit_cmd_view_toggle_fullscreen_mode },
+       { "leave_fullscreen", _gedit_cmd_view_leave_fullscreen_mode },
+       { "find", _gedit_cmd_search_find },
+       { "find_next", _gedit_cmd_search_find_next },
+       { "find_prev", _gedit_cmd_search_find_prev },
+       { "replace", _gedit_cmd_search_replace },
+       { "clear_highlight", _gedit_cmd_search_clear_highlight },
+       { "goto_line", _gedit_cmd_search_goto_line },
+       { "save_all", _gedit_cmd_file_save_all },
+       { "close_all", _gedit_cmd_file_close_all },
+       { "new_tab_group", _gedit_cmd_documents_new_tab_group },
+       { "previous_tab_group", _gedit_cmd_documents_previous_tab_group },
+       { "next_tab_group", _gedit_cmd_documents_next_tab_group },
+       { "previous_document", _gedit_cmd_documents_previous_document },
+       { "next_document", _gedit_cmd_documents_next_document },
+       { "move_to_new_window", _gedit_cmd_documents_move_to_new_window },
+       { "undo", _gedit_cmd_edit_undo },
+       { "redo", _gedit_cmd_edit_redo },
+       { "cut", _gedit_cmd_edit_cut },
+       { "copy", _gedit_cmd_edit_copy },
+       { "paste", _gedit_cmd_edit_paste },
+       { "delete", _gedit_cmd_edit_delete },
+       { "select_all", _gedit_cmd_edit_select_all },
+       { "highlight_mode", _gedit_cmd_view_highlight_mode }
+};
+
+static void
+on_window_close_button_clicked (GtkButton *button,
+                                GtkWidget *window)
+{
+       GdkEvent *event;
+
+       event = gdk_event_new (GDK_DELETE);
+
+       event->any.window = g_object_ref (gtk_widget_get_window (window));
+       event->any.send_event = TRUE;
+
+       gtk_main_do_event (event);
+       gdk_event_free (event);
+}
+
 static void
 gedit_window_init (GeditWindow *window)
 {
-       GtkWidget *main_box;
        GtkTargetList *tl;
 
        gedit_debug (DEBUG_WINDOW);
@@ -3707,42 +3131,29 @@ gedit_window_init (GeditWindow *window)
 
        window->priv->message_bus = gedit_message_bus_new ();
 
+       gtk_widget_init_template (GTK_WIDGET (window));
+
+       g_action_map_add_action_entries (G_ACTION_MAP (window),
+                                        win_entries,
+                                        G_N_ELEMENTS (win_entries),
+                                        window);
+
        window->priv->window_group = gtk_window_group_new ();
        gtk_window_group_add_window (window->priv->window_group, GTK_WINDOW (window));
 
-       main_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-       gtk_container_add (GTK_CONTAINER (window), main_box);
-       gtk_widget_show (main_box);
-
        /* Add menu bar and toolbar bar */
-       create_menu_bar_and_toolbar (window, main_box);
-
-       /* Add status bar */
-       create_statusbar (window, main_box);
-
-       /* Add the main area */
-       gedit_debug_message (DEBUG_WINDOW, "Add main area");
-       window->priv->hpaned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
-       gtk_box_pack_start (GTK_BOX (main_box),
-                           window->priv->hpaned,
-                           TRUE,
-                           TRUE,
-                           0);
-
-       window->priv->vpaned = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
-       gtk_paned_pack2 (GTK_PANED (window->priv->hpaned),
-                        window->priv->vpaned,
-                        TRUE,
-                        FALSE);
-
-       gedit_debug_message (DEBUG_WINDOW, "Create gedit notebook group");
-       window->priv->multi_notebook = gedit_multi_notebook_new ();
-       gtk_paned_pack1 (GTK_PANED (window->priv->vpaned),
-                        GTK_WIDGET (window->priv->multi_notebook),
-                        TRUE,
-                        FALSE);
-       gtk_widget_show (GTK_WIDGET (window->priv->multi_notebook));
+       // FIXME: kill this, right now it is just not added to the window
+       create_menu_bar_and_toolbar (window);
+
+       setup_headerbar_open_button (window);
+
+       g_signal_connect (window->priv->close_button, "clicked",
+                         G_CALLBACK (on_window_close_button_clicked), window);
 
+       /* Setup status bar */
+       setup_statusbar (window);
+
+       /* Setup main area */
        g_signal_connect (window->priv->multi_notebook,
                          "notebook-removed",
                          G_CALLBACK (on_notebook_removed),
@@ -3788,8 +3199,8 @@ gedit_window_init (GeditWindow *window)
                          window);
 
        /* side and bottom panels */
-       create_side_panel (window);
-       create_bottom_panel (window);
+       setup_side_panel (window);
+       setup_bottom_panel (window);
 
        /* panels' state must be restored after panels have been mapped,
         * since the bottom panel position depends on the size of the vpaned. */
@@ -3807,9 +3218,6 @@ gedit_window_init (GeditWindow *window)
                                G_CALLBACK (vpaned_restore_position),
                                window);
 
-       gtk_widget_show (window->priv->hpaned);
-       gtk_widget_show (window->priv->vpaned);
-
        /* Drag and drop support, set targets to NULL because we add the
           default uri_targets below */
        gtk_drag_dest_set (GTK_WIDGET (window),
@@ -4504,19 +3912,9 @@ _gedit_window_fullscreen (GeditWindow *window)
                                               (GtkCallback)hide_notebook_tabs,
                                               window);
 
-       gtk_widget_hide (window->priv->menubar);
-
-       g_signal_handlers_block_by_func (window->priv->toolbar,
-                                        toolbar_visibility_changed,
-                                        window);
-       gtk_widget_hide (window->priv->toolbar);
-
-       g_signal_handlers_block_by_func (window->priv->statusbar,
-                                        statusbar_visibility_changed,
-                                        window);
        gtk_widget_hide (window->priv->statusbar);
 
-       fullscreen_controls_build (window);
+       fullscreen_controls_setup (window);
        fullscreen_controls_show (window);
 }
 
@@ -4533,9 +3931,6 @@ show_notebook_tabs (GtkNotebook *notebook,
 void
 _gedit_window_unfullscreen (GeditWindow *window)
 {
-       gboolean visible;
-       GtkAction *action;
-
        g_return_if_fail (GEDIT_IS_WINDOW (window));
 
        if (!_gedit_window_is_fullscreen (window))
@@ -4548,25 +3943,10 @@ _gedit_window_unfullscreen (GeditWindow *window)
                                               (GtkCallback)show_notebook_tabs,
                                               window);
 
-       gtk_widget_show (window->priv->menubar);
-
-       action = gtk_action_group_get_action (window->priv->always_sensitive_action_group,
-                                             "ViewToolbar");
-       visible = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
-       if (visible)
-               gtk_widget_show (window->priv->toolbar);
-       g_signal_handlers_unblock_by_func (window->priv->toolbar,
-                                          toolbar_visibility_changed,
-                                          window);
-
-       action = gtk_action_group_get_action (window->priv->always_sensitive_action_group,
-                                             "ViewStatusbar");
-       visible = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
-       if (visible)
+       if (g_settings_get_boolean (window->priv->ui_settings, "statusbar-visible"))
+       {
                gtk_widget_show (window->priv->statusbar);
-       g_signal_handlers_unblock_by_func (window->priv->statusbar,
-                                          statusbar_visibility_changed,
-                                          window);
+       }
 
        gtk_widget_hide (window->priv->fullscreen_controls);
 }
diff --git a/gedit/gedit-window.ui b/gedit/gedit-window.ui
new file mode 100644
index 0000000..4d444c4
--- /dev/null
+++ b/gedit/gedit-window.ui
@@ -0,0 +1,436 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.8 -->
+  <menu id="gear-menu">
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">_Print</attribute>
+        <attribute name="action">win.print</attribute>
+        <attribute name="accel">&lt;Primary&gt;p</attribute>
+      </item>
+    </section>
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">_Save As…</attribute>
+        <attribute name="action">win.save_as</attribute>
+        <attribute name="accel">&lt;Primary&gt;&lt;Shift&gt;s</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">_Reload</attribute>
+        <attribute name="action">win.revert</attribute>
+      </item>
+    </section>
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">_Fullscreen</attribute>
+        <attribute name="action">win.fullscreen</attribute>
+        <attribute name="accel">F11</attribute>
+      </item>
+    </section>
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">_Find and Replace…</attribute>
+        <attribute name="action">win.replace</attribute>
+        <attribute name="accel">&lt;Primary&gt;h</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">_Clear Highlight</attribute>
+        <attribute name="action">win.clear_highlight</attribute>
+        <attribute name="accel">&lt;Primary&gt;&lt;Shift&gt;k</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">_Go to Line…</attribute>
+        <attribute name="action">win.goto_line</attribute>
+        <attribute name="accel">&lt;Primary&gt;i</attribute>
+      </item>
+    </section>
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">_Highlight Mode...</attribute>
+        <attribute name="action">win.highlight_mode</attribute>
+      </item>
+    </section>
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">_Close</attribute>
+        <attribute name="action">win.close</attribute>
+        <attribute name="accel">&lt;Primary&gt;w</attribute>
+      </item>
+    </section>
+  </menu>
+  <template class="GeditWindow" parent="GtkWindow">
+    <property name="can_focus">False</property>
+    <property name="has_focus">False</property>
+    <property name="is_focus">False</property>
+    <child type="titlebar">
+      <object class="GtkHeaderBar" id="headerbar">
+        <property name="visible">True</property>
+        <child>
+          <object class="GtkBox" id="open_box">
+            <property name="visible">True</property>
+            <property name="orientation">horizontal</property>
+            <property name="valign">center</property>
+            <style>
+              <class name="linked"/>
+            </style>
+            <child>
+              <object class="GtkButton" id="open_button">
+                <property name="visible">True</property>
+                <property name="label" translatable="yes">Open</property>
+                <property name="tooltip_text" translatable="yes">Open a file</property>
+                <property name="action_name">win.open</property>
+                <style>
+                  <class name="text-button"/>
+                </style>
+              </object>
+            </child>
+            <child>
+              <object class="GeditOpenMenuButton" id="open_menu">
+                <property name="visible">True</property>
+                <property name="tooltip_text" translatable="yes">Open a recently used file</property>
+                <style>
+                  <class name="image-button"/>
+                </style>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="pack_type">start</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkButton" id="new_tab_button">
+            <property name="visible">True</property>
+            <property name="valign">center</property>
+            <property name="tooltip_text" translatable="yes">Create a new document</property>
+            <property name="action_name">win.new_tab</property>
+            <style>
+              <class name="image-button"/>
+            </style>
+            <child>
+              <object class="GtkImage" id="new_tab_image">
+                <property name="visible">True</property>
+                <property name="icon_size">1</property>
+                <property name="icon_name">tab-new-symbolic</property>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="pack_type">start</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkButton" id="save_button">
+            <property name="visible">True</property>
+            <property name="valign">center</property>
+            <property name="tooltip_text" translatable="yes">Save the current file</property>
+            <property name="action_name">win.save</property>
+            <style>
+              <class name="image-button"/>
+            </style>
+            <child>
+              <object class="GtkImage" id="save_image">
+                <property name="visible">True</property>
+                <property name="icon_size">1</property>
+                <property name="icon_name">document-save-symbolic</property>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="pack_type">start</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkButton" id="find_button">
+            <property name="visible">True</property>
+            <property name="valign">center</property>
+            <property name="tooltip_text" translatable="yes">Search for text</property>
+            <property name="action_name">win.find</property>
+            <style>
+              <class name="image-button"/>
+            </style>
+            <child>
+              <object class="GtkImage" id="find_image">
+                <property name="visible">True</property>
+                <property name="icon_size">1</property>
+                <property name="icon_name">edit-find-symbolic</property>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="pack_type">end</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkMenuButton" id="gear_button">
+            <property name="visible">True</property>
+            <property name="valign">center</property>
+            <property name="menu_model">gear-menu</property>
+            <style>
+              <class name="image-button"/>
+            </style>
+            <child>
+              <object class="GtkImage" id="gear_image">
+                <property name="visible">True</property>
+                <property name="icon_size">1</property>
+                <property name="icon_name">emblem-system-symbolic</property>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="pack_type">end</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkSeparator" id="close_button_separator">
+            <property name="visible">True</property>
+            <property name="orientation">vertical</property>
+            <property name="valign">fill</property>
+          </object>
+          <packing>
+            <property name="pack_type">end</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkButton" id="close_button">
+            <property name="visible">True</property>
+            <property name="valign">center</property>
+            <property name="relief">none</property>
+            <style>
+              <class name="image-button"/>
+            </style>
+            <child>
+              <object class="GtkImage" id="close_image">
+                <property name="visible">True</property>
+                <property name="icon_size">1</property>
+                <property name="icon_name">window-close-symbolic</property>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="pack_type">end</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <child>
+      <object class="GtkBox" id="main_box">
+        <property name="visible">True</property>
+        <property name="orientation">vertical</property>
+        <child>
+          <object class="GtkPaned" id="hpaned">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="has_focus">False</property>
+            <property name="is_focus">False</property>
+            <child>
+              <object class="GeditPanel" id="side_panel">
+                <property name="visible">False</property>
+                <property name="orientation">vertical</property>
+              </object>
+              <packing>
+                <property name="resize">False</property>
+                <property name="shrink">False</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkPaned" id="vpaned">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="has_focus">False</property>
+                <property name="is_focus">False</property>
+                <property name="orientation">vertical</property>
+                <child>
+                  <object class="GeditMultiNotebook" id="multi_notebook">
+                    <property name="visible">True</property>
+                  </object>
+                  <packing>
+                    <property name="resize">True</property>
+                    <property name="shrink">False</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GeditPanel" id="bottom_panel">
+                    <property name="visible">False</property>
+                    <property name="orientation">horizontal</property>
+                  </object>
+                  <packing>
+                    <property name="resize">False</property>
+                    <property name="shrink">False</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="resize">True</property>
+                <property name="shrink">True</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GeditStatusbar" id="statusbar">
+            <property name="visible">True</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </template>
+  <object class="GtkWindow" id="fullscreen_controls">
+    <property name="type">popup</property>
+    <property name="can_focus">False</property>
+    <property name="has_focus">False</property>
+    <property name="is_focus">False</property>
+    <child>
+      <object class="GtkHeaderBar" id="fullscreen_headerbar">
+        <property name="visible">True</property>
+        <child>
+          <object class="GtkBox" id="fullscreen_open_box">
+            <property name="visible">True</property>
+            <property name="orientation">horizontal</property>
+            <property name="valign">center</property>
+            <style>
+              <class name="linked"/>
+            </style>
+            <child>
+              <object class="GtkButton" id="fullscreen_open_button">
+                <property name="visible">True</property>
+                <property name="label" translatable="yes">Open</property>
+                <property name="tooltip_text" translatable="yes">Open a file</property>
+                <property name="action_name">win.open</property>
+                <style>
+                  <class name="text-button"/>
+                </style>
+              </object>
+            </child>
+            <child>
+              <object class="GeditOpenMenuButton" id="fullscreen_open_menu">
+                <property name="visible">True</property>
+                <property name="tooltip_text" translatable="yes">Open a recently used file</property>
+                <style>
+                  <class name="image-button"/>
+                </style>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="pack_type">start</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkButton" id="fullscreen_new_tab_button">
+            <property name="visible">True</property>
+            <property name="valign">center</property>
+            <property name="tooltip_text" translatable="yes">Create a new document</property>
+            <property name="action_name">win.new_tab</property>
+            <style>
+              <class name="image-button"/>
+            </style>
+            <child>
+              <object class="GtkImage" id="fullscreen_new_tab_image">
+                <property name="visible">True</property>
+                <property name="icon_size">1</property>
+                <property name="icon_name">tab-new-symbolic</property>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="pack_type">start</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkButton" id="fullscreen_save_button">
+            <property name="visible">True</property>
+            <property name="valign">center</property>
+            <property name="tooltip_text" translatable="yes">Save the current file</property>
+            <property name="action_name">win.save</property>
+            <style>
+              <class name="image-button"/>
+            </style>
+            <child>
+              <object class="GtkImage" id="fullscreen_save_image">
+                <property name="visible">True</property>
+                <property name="icon_size">1</property>
+                <property name="icon_name">document-save-symbolic</property>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="pack_type">start</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkButton" id="fullscreen_find_button">
+            <property name="visible">True</property>
+            <property name="valign">center</property>
+            <property name="tooltip_text" translatable="yes">Search for text</property>
+            <property name="action_name">win.find</property>
+            <style>
+              <class name="image-button"/>
+            </style>
+            <child>
+              <object class="GtkImage" id="fullscreen_find_image">
+                <property name="visible">True</property>
+                <property name="icon_size">1</property>
+                <property name="icon_name">edit-find-symbolic</property>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="pack_type">end</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkMenuButton" id="fullscreen_gear_button">
+            <property name="visible">True</property>
+            <property name="valign">center</property>
+            <property name="menu_model">gear-menu</property>
+            <style>
+              <class name="image-button"/>
+            </style>
+            <child>
+              <object class="GtkImage" id="fullscreen_gear_image">
+                <property name="visible">True</property>
+                <property name="icon_size">1</property>
+                <property name="icon_name">emblem-system-symbolic</property>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="pack_type">end</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkButton" id="leave_fullscreen_button">
+            <property name="visible">True</property>
+            <property name="valign">center</property>
+            <property name="tooltip_text" translatable="yes">Leave Fullscreen</property>
+            <property name="action_name">win.leave_fullscreen</property>
+            <style>
+              <class name="image-button"/>
+            </style>
+            <child>
+              <object class="GtkImage" id="leave_fullscreen_image">
+                <property name="visible">True</property>
+                <property name="icon_size">1</property>
+                <property name="icon_name">view-restore-symbolic</property>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="pack_type">end</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/gedit/gedit.gresource.xml b/gedit/gedit.gresource.xml
index e277680..722d1e4 100644
--- a/gedit/gedit.gresource.xml
+++ b/gedit/gedit.gresource.xml
@@ -13,5 +13,6 @@
     <file preprocess="xml-stripblanks">gedit-status-menu-button.ui</file>
     <file preprocess="xml-stripblanks">gedit-view-frame.ui</file>
     <file preprocess="xml-stripblanks">gedit-highlight-mode-dialog.ui</file>
+    <file preprocess="xml-stripblanks">gedit-window.ui</file>
   </gresource>
 </gresources>


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