[gedit/wip/redesign: 2/9] Start redesign of gedit



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

    Start redesign of gedit

 gedit/Makefile.am                                  |    7 +-
 gedit/gedit-commands-file-print.c                  |   21 +-
 gedit/gedit-commands-file.c                        |   37 +-
 gedit/gedit-commands-search.c                      |   38 +-
 gedit/gedit-commands.h                             |   69 ++-
 ...open-tool-button.c => gedit-open-menu-button.c} |   65 +-
 gedit/gedit-open-menu-button.h                     |   60 ++
 gedit/gedit-open-tool-button.h                     |   60 --
 gedit/gedit-ui.h                                   |   60 +--
 gedit/gedit-ui.xml                                 |   51 --
 gedit/gedit-window-private.h                       |    9 +-
 gedit/gedit-window.c                               |  676 +++++---------------
 gedit/gedit-window.ui                              |  274 ++++++++
 gedit/gedit.gresource.xml                          |    1 +
 14 files changed, 631 insertions(+), 797 deletions(-)
---
diff --git a/gedit/Makefile.am b/gedit/Makefile.am
index a7cce7e..c953798 100644
--- a/gedit/Makefile.am
+++ b/gedit/Makefile.am
@@ -108,7 +108,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               \
@@ -191,7 +191,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      \
@@ -262,7 +262,8 @@ EXTRA_DIST =                                \
        gedit-print-preferences.ui      \
        gedit-progress-info-bar.ui      \
        gedit-status-menu-button.ui     \
-       gedit-view-frame.ui
+       gedit-view-frame.ui             \
+       gedit-window.ui
 
 CLEANFILES = $(BUILT_SOURCES) $(BUILT_SOURCES_PRIVATE)
 
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..7d977de 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);
@@ -1317,9 +1326,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 +1827,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);
diff --git a/gedit/gedit-commands-search.c b/gedit/gedit-commands-search.c
index c3f2433..a1e3b84 100644
--- a/gedit/gedit-commands-search.c
+++ b/gedit/gedit-commands-search.c
@@ -537,9 +537,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;
 
@@ -554,9 +556,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;
        GeditDocument *doc;
@@ -625,27 +629,35 @@ do_find_again (GeditWindow *window,
 }
 
 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);
 
        do_find_again (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);
 
        do_find_again (window, TRUE);
 }
 
 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;
 
@@ -660,9 +672,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.h b/gedit/gedit-commands.h
index ad6b5c8..1c11c8f 100644
--- a/gedit/gedit-commands.h
+++ b/gedit/gedit-commands.h
@@ -69,30 +69,35 @@ 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                    (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                (GtkAction   *action,
                                                         GeditWindow *window);
-void           _gedit_cmd_file_revert                  (GtkAction   *action,
-                                                        GeditWindow *window);
+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_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               (GtkAction   *action,
                                                         GeditWindow *window);
 void           _gedit_cmd_file_quit                    (GtkAction   *action,
@@ -128,20 +133,24 @@ void              _gedit_cmd_view_toggle_fullscreen_mode  (GtkAction   *action,
 void           _gedit_cmd_view_leave_fullscreen_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_search_incremental_search    (GtkAction   *action,
-                                                        GeditWindow *window);
+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  (GtkAction   *action,
                                                         GeditWindow *window);
diff --git a/gedit/gedit-open-tool-button.c b/gedit/gedit-open-menu-button.c
similarity index 64%
rename from gedit/gedit-open-tool-button.c
rename to gedit/gedit-open-menu-button.c
index 5f849c5..8b72a27 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,9 +25,9 @@
 
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
-#include "gedit-open-tool-button.h"
+#include "gedit-open-menu-button.h"
 
-struct _GeditOpenToolButtonPrivate
+struct _GeditOpenMenuButtonPrivate
 {
        gint limit;
 };
@@ -38,10 +38,10 @@ enum
        PROP_LIMIT
 };
 
-G_DEFINE_TYPE (GeditOpenToolButton, gedit_open_tool_button, GTK_TYPE_MENU_TOOL_BUTTON)
+G_DEFINE_TYPE (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,23 +64,22 @@ 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);
 
        switch (prop_id)
        {
@@ -94,12 +93,12 @@ 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);
 
        switch (prop_id)
        {
@@ -113,38 +112,34 @@ 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 = G_TYPE_INSTANCE_GET_PRIVATE (button,
-                                                   GEDIT_TYPE_OPEN_TOOL_BUTTON,
-                                                   GeditOpenToolButtonPrivate);
+                                                   GEDIT_TYPE_OPEN_MENU_BUTTON,
+                                                   GeditOpenMenuButtonPrivate);
 
        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",
@@ -156,19 +151,19 @@ gedit_open_tool_button_class_init (GeditOpenToolButtonClass *klass)
                                                           G_PARAM_READWRITE |
                                                           G_PARAM_STATIC_STRINGS));
 
-       g_type_class_add_private (object_class, sizeof (GeditOpenToolButtonPrivate));
+       g_type_class_add_private (object_class, sizeof (GeditOpenMenuButtonPrivate));
 }
 
-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..10ca54d
--- /dev/null
+++ b/gedit/gedit-open-menu-button.h
@@ -0,0 +1,60 @@
+/*
+ * 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;
+typedef struct _GeditOpenMenuButtonPrivate     GeditOpenMenuButtonPrivate;
+
+struct _GeditOpenMenuButton
+{
+       GtkMenuButton parent;
+
+       GeditOpenMenuButtonPrivate *priv;
+};
+
+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-ui.h b/gedit/gedit-ui.h
index 410835b..d182fad 100644
--- a/gedit/gedit-ui.h
+++ b/gedit/gedit-ui.h
@@ -48,12 +48,6 @@ static const GtkActionEntry gedit_always_sensitive_menu_entries[] =
        { "Documents", NULL, N_("_Documents") },
        { "Help", NULL, N_("_Help") },
 
-       /* File menu */
-       { "FileNew", GTK_STOCK_NEW, NULL, "<control>N",
-         N_("Create a new document"), G_CALLBACK (_gedit_cmd_file_new) },
-       { "FileOpen", GTK_STOCK_OPEN, N_("_Open..."), "<control>O",
-         N_("Open a file"), G_CALLBACK (_gedit_cmd_file_open) },
-
        /* Edit menu */
        { "EditPreferences", GTK_STOCK_PREFERENCES, N_("Pr_eferences"), NULL,
          N_("Configure the application"), G_CALLBACK (_gedit_cmd_edit_preferences) },
@@ -72,18 +66,6 @@ static const GtkActionEntry gedit_always_sensitive_menu_entries[] =
 
 static const GtkActionEntry gedit_menu_entries[] =
 {
-       /* File menu */
-       { "FileSave", GTK_STOCK_SAVE, NULL, "<control>S",
-         N_("Save the current file"), G_CALLBACK (_gedit_cmd_file_save) },
-       { "FileSaveAs", GTK_STOCK_SAVE_AS, N_("Save _As..."), "<shift><control>S",
-         N_("Save the current file with a different name"), G_CALLBACK (_gedit_cmd_file_save_as) },
-       { "FileRevert", GTK_STOCK_REVERT_TO_SAVED, NULL, NULL,
-         N_("Revert to a saved version of the file"), G_CALLBACK (_gedit_cmd_file_revert) },
-       { "FilePrintPreview", GTK_STOCK_PRINT_PREVIEW, N_("Print Previe_w"),"<control><shift>P",
-         N_("Print preview"), G_CALLBACK (_gedit_cmd_file_print_preview) },
-        { "FilePrint", GTK_STOCK_PRINT, N_("_Print..."), "<control>P",
-         N_("Print the current page"), G_CALLBACK (_gedit_cmd_file_print) },
-
        /* Edit menu */
        { "EditUndo", GTK_STOCK_UNDO, NULL, "<control>Z",
          N_("Undo the last action"), G_CALLBACK (_gedit_cmd_edit_undo) },
@@ -103,25 +85,6 @@ static const GtkActionEntry gedit_menu_entries[] =
        /* View menu */
        { "ViewHighlightMode", NULL, N_("_Highlight Mode") },
 
-       /* Search menu */
-       { "SearchFind", GTK_STOCK_FIND, N_("_Find..."), "<control>F",
-         N_("Search for text"), G_CALLBACK (_gedit_cmd_search_find) },
-       { "SearchFindNext", NULL, N_("Find Ne_xt"), "<control>G",
-         N_("Search forwards for the same text"), G_CALLBACK (_gedit_cmd_search_find_next) },
-       { "SearchFindPrevious", NULL, N_("Find Pre_vious"), "<shift><control>G",
-         N_("Search backwards for the same text"), G_CALLBACK (_gedit_cmd_search_find_prev) },
-#ifndef OS_OSX
-       { "SearchReplace", GTK_STOCK_FIND_AND_REPLACE, N_("_Replace..."), "<control>H",
-         N_("Search for and replace text"), G_CALLBACK (_gedit_cmd_search_replace) },
-#else
-       { "SearchReplace", GTK_STOCK_FIND_AND_REPLACE, N_("_Replace..."), "<control><alt>F",
-         N_("Search for and replace text"), G_CALLBACK (_gedit_cmd_search_replace) },
-#endif
-       { "SearchClearHighlight", NULL, N_("_Clear Highlight"), "<shift><control>K",
-         N_("Clear highlighting of search matches"), G_CALLBACK (_gedit_cmd_search_clear_highlight) },
-       { "SearchGoToLine", GTK_STOCK_JUMP_TO, N_("Go to _Line..."), "<control>I",
-         N_("Go to a specific line"), G_CALLBACK (_gedit_cmd_search_goto_line) },
-
        /* Documents menu */
        { "FileSaveAll", GTK_STOCK_SAVE, N_("_Save All"), "<shift><control>L",
          N_("Save all open files"), G_CALLBACK (_gedit_cmd_file_save_all) },
@@ -141,13 +104,6 @@ static const GtkActionEntry gedit_menu_entries[] =
          N_("Move the current document to a new window"), G_CALLBACK 
(_gedit_cmd_documents_move_to_new_window) }
 };
 
-/* separate group, needs to be sensitive on OS X even when there are no tabs */
-static const GtkActionEntry gedit_close_menu_entries[] =
-{
-       { "FileClose", GTK_STOCK_CLOSE, NULL, "<control>W",
-         N_("Close the current file"), G_CALLBACK (_gedit_cmd_file_close) }
-};
-
 /* separate group, should be sensitive even when there are no tabs */
 static const GtkActionEntry gedit_quit_menu_entries[] =
 {
@@ -179,6 +135,22 @@ static const GtkToggleActionEntry gedit_panels_toggle_menu_entries[] =
          G_CALLBACK (_gedit_cmd_view_show_bottom_panel), FALSE }
 };
 
+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 },
+       { "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 }
+};
+
 G_END_DECLS
 
 #endif  /* __GEDIT_UI_H__  */
diff --git a/gedit/gedit-ui.xml b/gedit/gedit-ui.xml
index 19a8f7f..dc60df9 100644
--- a/gedit/gedit-ui.xml
+++ b/gedit/gedit-ui.xml
@@ -30,25 +30,13 @@
 
   <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>
 
@@ -89,30 +77,6 @@
       </menu>
     </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/>
@@ -158,28 +122,15 @@
   </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/>
@@ -187,8 +138,6 @@
     <toolitem action="EditCopy"/>
     <toolitem action="EditPaste"/>
     <separator/>
-    <toolitem action="SearchFind"/>
-    <toolitem action="SearchReplace"/>
     <separator expand="true"/>
     <toolitem action="LeaveFullscreen"/>
   </toolbar>
diff --git a/gedit/gedit-window-private.h b/gedit/gedit-window-private.h
index 87c6b3b..eb9481a 100644
--- a/gedit/gedit-window-private.h
+++ b/gedit/gedit-window-private.h
@@ -85,7 +85,6 @@ struct _GeditWindowPrivate
        GtkUIManager   *manager;
        GtkActionGroup *action_group;
        GtkActionGroup *always_sensitive_action_group;
-       GtkActionGroup *close_action_group;
        GtkActionGroup *quit_action_group;
        GtkActionGroup *panels_action_group;
        GtkActionGroup *languages_action_group;
@@ -94,11 +93,11 @@ struct _GeditWindowPrivate
        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;
 
+       /* 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 2708514..0e9acb4 100644
--- a/gedit/gedit-window.c
+++ b/gedit/gedit-window.c
@@ -52,7 +52,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"
@@ -98,9 +98,6 @@ enum
 
 G_DEFINE_TYPE(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,
@@ -233,16 +230,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);
@@ -437,64 +424,19 @@ gedit_window_class_init (GeditWindowClass *klass)
                                                             G_PARAM_READABLE |
                                                             G_PARAM_STATIC_STRINGS));
 
-       g_type_class_add_private (object_class, sizeof (GeditWindowPrivate));
-}
-
-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);
-       }
-}
+       /* Bind class to template */
+       gtk_widget_class_set_template_from_resource (widget_class,
+                                                    "/org/gnome/gedit/ui/gedit-window.ui");
+       gtk_widget_class_bind_child (widget_class, GeditWindowPrivate, headerbar);
+       gtk_widget_class_bind_child (widget_class, GeditWindowPrivate, open_menu);
+       gtk_widget_class_bind_child (widget_class, GeditWindowPrivate, hpaned);
+       gtk_widget_class_bind_child (widget_class, GeditWindowPrivate, side_panel);
+       gtk_widget_class_bind_child (widget_class, GeditWindowPrivate, vpaned);
+       gtk_widget_class_bind_child (widget_class, GeditWindowPrivate, multi_notebook);
+       gtk_widget_class_bind_child (widget_class, GeditWindowPrivate, bottom_panel);
+       gtk_widget_class_bind_child (widget_class, GeditWindowPrivate, statusbar);
 
-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);
-       }
+       g_type_class_add_private (object_class, sizeof (GeditWindowPrivate));
 }
 
 /* Returns TRUE if toolbar is visible */
@@ -661,6 +603,7 @@ set_sensitivity_according_to_tab (GeditWindow *window,
        GeditDocument *doc;
        GeditView *view;
        GtkAction *action;
+       GAction *gaction;
        gboolean b;
        gboolean state_normal;
        gboolean editable;
@@ -689,54 +632,42 @@ 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));
+       gaction = g_action_map_lookup_action (G_ACTION_MAP (window), "save");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (gaction),
+                                    (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));
+
+       gaction = g_action_map_lookup_action (G_ACTION_MAP (window), "save_as");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (gaction),
+                                    (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));
+
+       gaction = g_action_map_lookup_action (G_ACTION_MAP (window), "revert");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (gaction),
+                                    (state_normal ||
+                                     (state == GEDIT_TAB_STATE_EXTERNALLY_MODIFIED_NOTIFICATION)) &&
+                                    !gedit_document_is_untitled (doc));
+
+       gaction = g_action_map_lookup_action (G_ACTION_MAP (window), "print");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (gaction),
+                                    (state_normal ||
+                                    (state == GEDIT_TAB_STATE_SHOWING_PRINT_PREVIEW)) &&
+                                    !(lockdown & GEDIT_LOCKDOWN_PRINTING));
+
+       gaction = g_action_map_lookup_action (G_ACTION_MAP (window), "close");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (gaction),
+                                    (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");
@@ -783,42 +714,36 @@ set_sensitivity_according_to_tab (GeditWindow *window,
                                  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));
+       gaction = g_action_map_lookup_action (G_ACTION_MAP (window), "find");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (gaction),
+                                    (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);
+       gaction = g_action_map_lookup_action (G_ACTION_MAP (window), "replace");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (gaction),
+                                    state_normal &&
+                                    editable);
 
        b = gedit_document_get_can_search_again (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));
+       gaction = g_action_map_lookup_action (G_ACTION_MAP (window), "find_next");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (gaction),
+                                    (state_normal ||
+                                     state == GEDIT_TAB_STATE_EXTERNALLY_MODIFIED_NOTIFICATION) && b);
+
+       gaction = g_action_map_lookup_action (G_ACTION_MAP (window), "find_prev");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (gaction),
+                                    (state_normal ||
+                                     state == GEDIT_TAB_STATE_EXTERNALLY_MODIFIED_NOTIFICATION) && b);
+
+       gaction = g_action_map_lookup_action (G_ACTION_MAP (window), "clear_highlight");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (gaction),
+                                    (state_normal ||
+                                     state == GEDIT_TAB_STATE_EXTERNALLY_MODIFIED_NOTIFICATION) && b);
+
+       gaction = g_action_map_lookup_action (G_ACTION_MAP (window), "goto_line");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (gaction),
+                                    (state_normal ||
+                                     state == GEDIT_TAB_STATE_EXTERNALLY_MODIFIED_NOTIFICATION));
 
        action = gtk_action_group_get_action (window->priv->action_group,
                                              "ViewHighlightMode");
@@ -1220,207 +1145,6 @@ 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)
-{
-       GeditWindowPrivate *p = window->priv;
-       GtkRecentManager *recent_manager;
-       gint max_recents;
-       GList *actions, *l, *items;
-       GList *filtered_items = NULL;
-       gint i;
-
-       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)
 {
@@ -1448,49 +1172,30 @@ toolbar_visibility_changed (GtkWidget   *toolbar,
 }
 
 static void
-setup_toolbar_open_button (GeditWindow *window,
-                          GtkWidget   *toolbar)
+setup_toolbar_open_button (GeditWindow *window)
 {
-       GtkToolItem *open_button;
-       GtkWidget *recent_menu;
-       GtkAction *action;
+       GtkMenu *recent_menu;
 
-       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);
@@ -1526,19 +1231,7 @@ create_menu_bar_and_toolbar (GeditWindow *window,
        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);
 
@@ -1553,17 +1246,6 @@ create_menu_bar_and_toolbar (GeditWindow *window,
        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,
@@ -1598,30 +1280,6 @@ create_menu_bar_and_toolbar (GeditWindow *window,
                }
        }
 
-       /* 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);
-
        /* languages menu */
        action_group = gtk_action_group_new ("LanguagesActions");
        gtk_action_group_set_translation_domain (action_group, NULL);
@@ -1638,22 +1296,11 @@ create_menu_bar_and_toolbar (GeditWindow *window,
        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
@@ -1664,7 +1311,7 @@ create_menu_bar_and_toolbar (GeditWindow *window,
 #endif
        set_toolbar_visibility (window, NULL);
 
-       setup_toolbar_open_button (window, window->priv->toolbar);
+       setup_toolbar_open_button (window);
 
        gtk_container_foreach (GTK_CONTAINER (window->priv->toolbar),
                               (GtkCallback)set_non_homogeneus,
@@ -2141,13 +1788,10 @@ create_language_combo (GeditWindow *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
@@ -2155,12 +1799,6 @@ 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);
 
@@ -2314,7 +1952,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);
@@ -2382,42 +2022,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
@@ -2599,6 +2252,7 @@ static void
 set_sensitivity_according_to_window_state (GeditWindow *window)
 {
        GtkAction *action;
+       GAction *gaction;
        GeditLockdownMask lockdown;
        gint num_tabs;
 
@@ -2639,15 +2293,14 @@ set_sensitivity_according_to_window_state (GeditWindow *window)
                                                num_tabs > 0);
        }
 
-       if (!gtk_action_group_get_sensitive (window->priv->close_action_group))
+       gaction = g_action_map_lookup_action (G_ACTION_MAP (window), "close");
+       if (!g_action_get_enabled (gaction))
        {
 #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 (gaction), TRUE);
 #else
-               gtk_action_group_set_sensitive (window->priv->close_action_group,
-                                               num_tabs > 0);
+               g_simple_action_set_enabled (G_SIMPLE_ACTION (gaction), num_tabs > 0);
 #endif
        }
 }
@@ -3157,7 +2810,7 @@ fullscreen_controls_build (GeditWindow *window)
                                              "LeaveFullscreen");
        g_object_set (action, "is-important", TRUE, NULL);
 
-       setup_toolbar_open_button (window, toolbar);
+       //setup_toolbar_open_button (window, toolbar);
 
        gtk_container_foreach (GTK_CONTAINER (toolbar),
                               (GtkCallback)set_non_homogeneus,
@@ -3180,25 +2833,26 @@ can_search_again (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_can_search_again (doc);
+       enabled = gedit_document_get_can_search_again (doc);
+
+       action = g_action_map_lookup_action (G_ACTION_MAP (window),
+                                            "clear_highlight");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action), enabled);
 
+       /* FIXME
        action = gtk_action_group_get_action (window->priv->action_group,
                                              "SearchFindNext");
        gtk_action_set_sensitive (action, sensitive);
 
        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);
+       gtk_action_set_sensitive (action, sensitive);*/
 }
 
 static void
@@ -3329,6 +2983,7 @@ update_sensitivity_according_to_open_tabs (GeditWindow *window,
                                           gint         num_tabs)
 {
        GtkAction *action;
+       GAction *gaction;
 
        /* Set sensitivity */
        gtk_action_group_set_sensitive (window->priv->action_group,
@@ -3348,8 +3003,9 @@ update_sensitivity_according_to_open_tabs (GeditWindow *window,
 
        /* 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);
+       gaction = g_action_map_lookup_action (G_ACTION_MAP (window), "close");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (gaction),
+                                    num_tabs != 0);
 #endif
 }
 
@@ -3747,19 +3403,12 @@ side_panel_visibility_changed (GtkWidget   *side_panel,
 }
 
 static void
-create_side_panel (GeditWindow *window)
+setup_side_panel (GeditWindow *window)
 {
        GtkWidget *documents_panel;
 
        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),
@@ -3840,17 +3489,10 @@ bottom_panel_item_added (GeditPanel  *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_CALLBACK (bottom_panel_visibility_changed),
@@ -3993,7 +3635,6 @@ extension_removed (PeasExtensionSet *extensions,
 static void
 gedit_window_init (GeditWindow *window)
 {
-       GtkWidget *main_box;
        GtkTargetList *tl;
 
        gedit_debug (DEBUG_WINDOW);
@@ -4016,42 +3657,24 @@ 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 status bar */
+       setup_statusbar (window);
 
+       /* Setup main area */
        g_signal_connect (window->priv->multi_notebook,
                          "notebook-removed",
                          G_CALLBACK (on_notebook_removed),
@@ -4097,8 +3720,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. */
@@ -4116,9 +3739,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),
diff --git a/gedit/gedit-window.ui b/gedit/gedit-window.ui
new file mode 100644
index 0000000..7623bfc
--- /dev/null
+++ b/gedit/gedit-window.ui
@@ -0,0 +1,274 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.8 -->
+  <menu id="search-menu">
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">_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>
+  </menu>
+  <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">_Revert</attribute>
+        <attribute name="action">win.revert</attribute>
+      </item>
+    </section>
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">_Full Screen</attribute>
+        <attribute name="action">win.fullscreen</attribute>
+        <attribute name="accel">F11</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>
+    <property name="hide_titlebar_when_maximized">True</property>
+    <child>
+      <object class="GtkBox" id="main_box">
+        <property name="visible">True</property>
+        <property name="orientation">vertical</property>
+        <child>
+          <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="GtkBox" id="save_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="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>
+                </child>
+                <child>
+                  <object class="GtkMenuButton" id="find_menu">
+                    <property name="visible">True</property>
+                    <property name="menu_model">search-menu</property>
+                    <style>
+                      <class name="image-button"/>
+                    </style>
+                  </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>
+          </object>
+        </child>
+        <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>
+</interface>
diff --git a/gedit/gedit.gresource.xml b/gedit/gedit.gresource.xml
index 6938cb8..1c2bb7c 100644
--- a/gedit/gedit.gresource.xml
+++ b/gedit/gedit.gresource.xml
@@ -12,5 +12,6 @@
     <file preprocess="xml-stripblanks">gedit-progress-info-bar.ui</file>
     <file preprocess="xml-stripblanks">gedit-status-menu-button.ui</file>
     <file preprocess="xml-stripblanks">gedit-view-frame.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]