[nautilus/wip/gaction: 3/3] nautilus-general: Prototype port to gaction



commit 0e568ec9d2454be6eb27d1d44629cbb2fb05403b
Author: Carlos Soriano <carlos soriano89 gmail com>
Date:   Wed Oct 22 17:34:33 2014 +0200

    nautilus-general: Prototype port to gaction

 libnautilus-private/nautilus-ui-utilities.c |   96 ++++++++++
 libnautilus-private/nautilus-ui-utilities.h |    9 +
 src/nautilus-canvas-view.c                  |  258 +++++++++++++++++++--------
 src/nautilus-canvas-view.h                  |    7 +
 src/nautilus-main-menus.xml                 |  101 +++++++++++
 src/nautilus-sort-menu.xml                  |   41 +++++
 src/nautilus-toolbar-ui.xml                 |  133 ++++++++++++++
 src/nautilus-toolbar.c                      |  182 +++++++++----------
 src/nautilus-toolbar.h                      |   11 +-
 src/nautilus-view.c                         |   86 ++++++++-
 src/nautilus-view.h                         |   13 ++
 src/nautilus-window-menus.c                 |  256 ++++++++++++++++++++++++++
 src/nautilus-window-private.h               |    2 +
 src/nautilus-window-slot.c                  |   18 ++-
 src/nautilus-window.c                       |   70 ++++----
 src/nautilus-window.h                       |    3 +
 src/nautilus.gresource.xml                  |    3 +
 17 files changed, 1071 insertions(+), 218 deletions(-)
---
diff --git a/libnautilus-private/nautilus-ui-utilities.c b/libnautilus-private/nautilus-ui-utilities.c
index 6fcc3a4..c61aa77 100644
--- a/libnautilus-private/nautilus-ui-utilities.c
+++ b/libnautilus-private/nautilus-ui-utilities.c
@@ -29,6 +29,102 @@
 
 #include <gio/gio.h>
 #include <gtk/gtk.h>
+#include <string.h>
+
+static GMenuModel *
+find_gmenu_model (GMenuModel  *model,
+                   const gchar *section_id)
+{
+       gint i, n_items;
+       GMenuModel *section = NULL;
+
+       n_items = g_menu_model_get_n_items (model);
+
+       for (i = 0; i < n_items && !section; i++)
+       {
+               gchar *id = NULL;
+
+               if (g_menu_model_get_item_attribute (model, i, "id", "s", &id) &&
+                       strcmp (id, section_id) == 0)
+               {
+                       section = g_menu_model_get_item_link (model, i, G_MENU_LINK_SECTION);
+               }
+               else
+               {
+                       GMenuModel *subsection;
+                       GMenuModel *submenu;
+                       gint j, j_items;
+
+                       subsection = g_menu_model_get_item_link (model, i, G_MENU_LINK_SECTION);
+
+                       j_items = g_menu_model_get_n_items (subsection);
+
+                       for (j = 0; j < j_items && !section; j++)
+                       {
+                               submenu = g_menu_model_get_item_link (subsection, j, G_MENU_LINK_SUBMENU);
+                               if (submenu)
+                               {
+                                       section = find_gmenu_model (submenu, section_id);
+                               }
+                       }
+               }
+
+               g_free (id);
+       }
+
+       return section;
+}
+
+/*
+ * The original GMenu is modified adding to the section @section_name
+ * the items in @gmenu_to_merge.
+ * @gmenu_to_merge should be a list of menu items.
+ */
+void
+nautilus_gmenu_merge (GMenu *original,
+                       GMenu *gmenu_to_merge,
+                       const gchar *section_name)
+{
+       gint i, n_items;
+       GMenuModel *section;
+       GMenuItem *item;
+
+       g_return_if_fail (G_IS_MENU (original));
+       g_return_if_fail (G_IS_MENU (gmenu_to_merge));
+
+       section = find_gmenu_model (G_MENU_MODEL (original), section_name);
+
+       g_return_if_fail (section != NULL);
+
+       n_items = g_menu_model_get_n_items (G_MENU_MODEL (gmenu_to_merge));
+
+       for (i = 0; i < n_items; i++)
+       {
+               item = g_menu_item_new_from_model (G_MENU_MODEL (gmenu_to_merge), i);
+               g_menu_append_item (G_MENU (section), item);
+       }
+}
+
+/*
+ * The GMenu @menu is modified adding to the section @section_name
+ * the item @item.
+ */
+void
+nautilus_gmenu_add_item_in_section (GMenu *menu,
+                       GMenuItem *item,
+                       const gchar *section_name)
+{
+       GMenuModel *section;
+
+       g_return_if_fail (G_IS_MENU (menu));
+       g_return_if_fail (G_IS_MENU_ITEM (item));
+
+       section = find_gmenu_model (G_MENU_MODEL (menu), section_name);
+
+       g_return_if_fail (section != NULL);
+
+       g_menu_append_item (G_MENU (section), item);
+}
 
 void
 nautilus_ui_unmerge_ui (GtkUIManager *ui_manager,
diff --git a/libnautilus-private/nautilus-ui-utilities.h b/libnautilus-private/nautilus-ui-utilities.h
index 0341478..6a4a7e0 100644
--- a/libnautilus-private/nautilus-ui-utilities.h
+++ b/libnautilus-private/nautilus-ui-utilities.h
@@ -33,6 +33,15 @@ void        nautilus_ui_prepare_merge_ui           (GtkUIManager      *ui_manage
                                                    const char        *name,
                                                    guint             *merge_id,
                                                    GtkActionGroup   **action_group);
+
+void nautilus_gmenu_merge (GMenu *original,
+                       GMenu *gmenu_to_merge,
+                       const gchar *section_name);
+
+void nautilus_gmenu_add_item_in_section (GMenu *menu,
+                                       GMenuItem *item,
+                                       const gchar *section_name);
+
 GtkAction * nautilus_action_from_menu_item         (NautilusMenuItem  *item,
                                                    GtkWidget         *parent_widget);
 
diff --git a/src/nautilus-canvas-view.c b/src/nautilus-canvas-view.c
index c3dad37..9122a01 100644
--- a/src/nautilus-canvas-view.c
+++ b/src/nautilus-canvas-view.c
@@ -62,6 +62,9 @@
 #include <sys/wait.h>
 #include <unistd.h>
 
+
+static int counter = 0;
+
 enum 
 {
        PROP_SUPPORTS_AUTO_LAYOUT = 1,
@@ -76,7 +79,7 @@ static GParamSpec *properties[NUM_PROPERTIES] = { NULL, };
 typedef struct {
        const NautilusFileSortType sort_type;
        const char *metadata_text;
-       const char *action;
+       const char *action_target_name;
 } SortCriterion;
 
 typedef enum {
@@ -106,48 +109,49 @@ struct NautilusCanvasViewDetails
        gboolean supports_manual_layout;
        gboolean supports_scaling;
        gboolean supports_keep_aligned;
-};
 
+       GMenu   *view_menu;
+};
 
 /* Note that the first item in this list is the default sort,
  * and that the items show up in the menu in the order they
  * appear in this list.
  */
-static const SortCriterion sort_criteria[] = {
+static const SortCriterion gsort_criteria[] = {
        {
                NAUTILUS_FILE_SORT_BY_DISPLAY_NAME,
                "name",
-               "Sort by Name"
+               "sort-by-name"
        },
        {
                NAUTILUS_FILE_SORT_BY_SIZE,
                "size",
-               "Sort by Size"
+               "sort-by-size"
        },
        {
                NAUTILUS_FILE_SORT_BY_TYPE,
                "type",
-               "Sort by Type"
+               "sort-by-type"
        },
        {
                NAUTILUS_FILE_SORT_BY_MTIME,
                "modification date",
-               "Sort by Modification Date"
+               "sort-by-modification-date"
        },
        {
                NAUTILUS_FILE_SORT_BY_ATIME,
                "access date",
-               "Sort by Access Date"
+               "sort-by-access-date"
        },
        {
                NAUTILUS_FILE_SORT_BY_TRASHED_TIME,
                "trashed",
-               NAUTILUS_ACTION_SORT_TRASH_TIME
+               "sort-by-trash-time"
        },
        {
                NAUTILUS_FILE_SORT_BY_SEARCH_RELEVANCE,
                NULL,
-               NAUTILUS_ACTION_SORT_SEARCH_RELEVANCE,
+               "sort-by-search-relevance",
        }
 };
 
@@ -331,7 +335,7 @@ nautilus_canvas_view_clean_up_by_name (NautilusCanvasView *canvas_view)
        saved_sort_reversed = canvas_view->details->sort_reversed;
        
        set_sort_reversed (canvas_view, FALSE, FALSE);
-       set_sort_criterion (canvas_view, &sort_criteria[0], FALSE);
+       set_sort_criterion (canvas_view, &gsort_criteria[0], FALSE);
 
        nautilus_canvas_container_sort (canvas_container);
        nautilus_canvas_container_freeze_icon_positions (canvas_container);
@@ -347,25 +351,6 @@ nautilus_canvas_view_using_auto_layout (NautilusCanvasView *canvas_view)
 }
 
 static void
-action_sort_radio_callback (GtkAction *action,
-                           GtkRadioAction *current,
-                           NautilusCanvasView *view)
-{
-       NautilusFileSortType sort_type;
-       
-       sort_type = gtk_radio_action_get_current_value (current);
-       
-       /* Note that id might be a toggle item.
-        * Ignore non-sort ids so that they don't cause sorting.
-        */
-       if (sort_type == NAUTILUS_FILE_SORT_NONE) {
-               switch_to_manual_layout (view);
-       } else {
-               set_sort_criterion_by_sort_type (view, sort_type);
-       }
-}
-
-static void
 list_covers (NautilusCanvasIconData *data, gpointer callback_data)
 {
        GSList **file_list;
@@ -503,45 +488,11 @@ update_layout_menus (NautilusCanvasView *view)
        GtkAction *action;
        const char *action_name;
        NautilusFile *file;
-
-       if (view->details->canvas_action_group == NULL) {
-               return;
-       }
-
+       NautilusWindow *window;
+       
        is_auto_layout = nautilus_canvas_view_using_auto_layout (view);
        file = nautilus_view_get_directory_as_file (NAUTILUS_VIEW (view));
-
-       if (nautilus_canvas_view_supports_auto_layout (view)) {
-               /* Mark sort criterion. */
-               action_name = is_auto_layout ? view->details->sort->action : NAUTILUS_ACTION_MANUAL_LAYOUT;
-               action = gtk_action_group_get_action (view->details->canvas_action_group,
-                                                     action_name);
-               gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
-
-               action = gtk_action_group_get_action (view->details->canvas_action_group,
-                                                     NAUTILUS_ACTION_REVERSED_ORDER);
-               gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
-                                             view->details->sort_reversed);
-               gtk_action_set_sensitive (action, is_auto_layout);
-
-               action = gtk_action_group_get_action (view->details->canvas_action_group,
-                                                     NAUTILUS_ACTION_SORT_TRASH_TIME);
-
-               if (file != NULL && nautilus_file_is_in_trash (file)) {
-                       gtk_action_set_visible (action, TRUE);
-               } else {
-                       gtk_action_set_visible (action, FALSE);
-               }
-
-               action = gtk_action_group_get_action (view->details->canvas_action_group,
-                                                     NAUTILUS_ACTION_SORT_SEARCH_RELEVANCE);
-
-               if (file != NULL && nautilus_file_is_in_search (file)) {
-                       gtk_action_set_visible (action, TRUE);
-               } else {
-                       gtk_action_set_visible (action, FALSE);
-               }
-       }
+       window = NAUTILUS_VIEW_CLASS(nautilus_canvas_view_parent_class)->get_window (NAUTILUS_VIEW (view));
 
        action = gtk_action_group_get_action (view->details->canvas_action_group,
                                              NAUTILUS_ACTION_MANUAL_LAYOUT);
@@ -555,6 +506,8 @@ update_layout_menus (NautilusCanvasView *view)
        gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
                                      nautilus_canvas_container_is_keep_aligned (get_canvas_container 
(view)));
        gtk_action_set_sensitive (action, !is_auto_layout);
+
+       g_print ("END update_layout_menus\n");
 }
 
 
@@ -616,6 +569,8 @@ nautilus_canvas_view_set_directory_sort_by (NautilusCanvasView *canvas_view,
        default_sort_criterion = get_sort_criterion_by_sort_type (get_default_sort_order (file, NULL));
        g_return_if_fail (default_sort_criterion != NULL);
 
+       g_print ("nautilus_canvas_view_set_directory_sort_by %s\n", sort_by);
+
        nautilus_file_set_metadata
                (file, NAUTILUS_METADATA_KEY_ICON_VIEW_SORT_BY,
                 default_sort_criterion->metadata_text,
@@ -740,6 +695,7 @@ set_sort_reversed (NautilusCanvasView *canvas_view,
        }
        
        /* Update the layout menus to match the new sort-order setting. */
+       g_print("### reversed\n");
        update_layout_menus (canvas_view);
 
        return TRUE;
@@ -751,9 +707,24 @@ get_sort_criterion_by_metadata_text (const char *metadata_text)
        guint i;
 
        /* Figure out what the new sort setting should be. */
-       for (i = 0; i < G_N_ELEMENTS (sort_criteria); i++) {
-               if (g_strcmp0 (sort_criteria[i].metadata_text, metadata_text) == 0) {
-                       return &sort_criteria[i];
+       for (i = 0; i < G_N_ELEMENTS (gsort_criteria); i++) {
+               if (g_strcmp0 (gsort_criteria[i].metadata_text, metadata_text) == 0) {
+                       return &gsort_criteria[i];
+               }
+       }
+       return NULL;
+}
+
+static const SortCriterion *
+get_sort_criterion_by_action_target_name (const char *action_target_name)
+{
+       guint i;
+       g_print ("action name %s\n", action_target_name);
+       /* Figure out what the new sort setting should be. */
+       for (i = 0; i < G_N_ELEMENTS (gsort_criteria); i++) {
+               g_print ("gsor criteria %s\n", gsort_criteria[i].action_target_name);
+               if (g_strcmp0 (gsort_criteria[i].action_target_name, action_target_name) == 0) {
+                       return &gsort_criteria[i];
                }
        }
        return NULL;
@@ -765,13 +736,13 @@ get_sort_criterion_by_sort_type (NautilusFileSortType sort_type)
        guint i;
 
        /* Figure out what the new sort setting should be. */
-       for (i = 0; i < G_N_ELEMENTS (sort_criteria); i++) {
-               if (sort_type == sort_criteria[i].sort_type) {
-                       return &sort_criteria[i];
+       for (i = 0; i < G_N_ELEMENTS (gsort_criteria); i++) {
+               if (sort_type == gsort_criteria[i].sort_type) {
+                       return &gsort_criteria[i];
                }
        }
 
-       return &sort_criteria[0];
+       return &gsort_criteria[0];
 }
 
 #define DEFAULT_ZOOM_LEVEL(canvas_view) default_zoom_level
@@ -793,6 +764,7 @@ nautilus_canvas_view_begin_loading (NautilusView *view)
        NautilusCanvasView *canvas_view;
        GtkWidget *canvas_container;
        NautilusFile *file;
+       NautilusWindow *window;
        char *sort_name, *uri;
 
        g_return_if_fail (NAUTILUS_IS_CANVAS_VIEW (view));
@@ -833,7 +805,13 @@ nautilus_canvas_view_begin_loading (NautilusView *view)
                 nautilus_canvas_view_get_directory_auto_layout (canvas_view, file));
 
        /* e.g. keep aligned may have changed */
+       g_print ("### begin loading\n");
        update_layout_menus (canvas_view);
+
+       /* We could changed to a the trash directory or to searching, and then we
+        * need to update the menus */
+       window = NAUTILUS_VIEW_CLASS (nautilus_canvas_view_parent_class)->get_window (view);
+       nautilus_window_update_menus (window);
 }
 
 static void
@@ -1046,6 +1024,72 @@ action_keep_aligned_callback (GtkAction *action,
                                                  keep_aligned);
 }
 
+void
+nautilus_canvas_view_action_reversed_order (NautilusCanvasView *canvas_view,
+                                       const gboolean reversed_order)
+{
+       if (set_sort_reversed (canvas_view, reversed_order, TRUE)) {
+               nautilus_canvas_container_sort (get_canvas_container (canvas_view));
+               nautilus_canvas_view_reveal_selection (NAUTILUS_VIEW (canvas_view));
+       }
+}
+
+void
+nautilus_canvas_view_action_keep_aligned (NautilusCanvasView *canvas_view,
+                                       const gboolean keep_aligned)
+{
+       NautilusFile *file;
+
+       file = nautilus_view_get_directory_as_file (NAUTILUS_VIEW (canvas_view));
+       nautilus_canvas_view_set_directory_keep_aligned (canvas_view,
+                                                file,
+                                                keep_aligned);
+                                                     
+       nautilus_canvas_container_set_keep_aligned (get_canvas_container (canvas_view),
+                                                 keep_aligned);
+}
+
+static void
+action_sort_radio_callback (GtkAction *action,
+                           GtkRadioAction *current,
+                           NautilusCanvasView *view)
+{
+       NautilusFileSortType sort_type;
+       
+       sort_type = gtk_radio_action_get_current_value (current);
+       
+       /* Note that id might be a toggle item.
+        * Ignore non-sort ids so that they don't cause sorting.
+        */
+       if (sort_type == NAUTILUS_FILE_SORT_NONE) {
+               switch_to_manual_layout (view);
+       } else {
+               set_sort_criterion_by_sort_type (view, sort_type);
+       }
+}
+
+void
+nautilus_canvas_view_action_sort (NautilusCanvasView *canvas_view,
+                               const gchar* target_name)
+{
+       const SortCriterion *sort_criterion;
+       g_print ("nautilus_canvas_view_action_sort %s\n", target_name);
+       sort_criterion = get_sort_criterion_by_action_target_name (target_name);
+
+       g_assert (sort_criterion != NULL);
+       /* Note that id might be a toggle item.
+        * Ignore non-sort ids so that they don't cause sorting.
+        */
+       if (sort_criterion->sort_type == NAUTILUS_FILE_SORT_NONE) {
+               switch_to_manual_layout (canvas_view);
+       } else {
+               set_sort_criterion (canvas_view, sort_criterion, TRUE);
+
+               nautilus_canvas_container_sort (get_canvas_container (canvas_view));
+               nautilus_canvas_view_reveal_selection (NAUTILUS_VIEW (canvas_view));
+       }
+}
+
 static void
 switch_to_manual_layout (NautilusCanvasView *canvas_view)
 {
@@ -1053,7 +1097,7 @@ switch_to_manual_layout (NautilusCanvasView *canvas_view)
                return;
        }
 
-       canvas_view->details->sort = &sort_criteria[0];
+       canvas_view->details->sort = &gsort_criteria[0];
        
        nautilus_canvas_container_set_auto_layout
                (get_canvas_container (canvas_view), FALSE);
@@ -1076,7 +1120,7 @@ layout_changed_callback (NautilusCanvasContainer *container,
                         file,
                         nautilus_canvas_view_using_auto_layout (canvas_view));
        }
-
+       g_print("### layour changed \n");
        update_layout_menus (canvas_view);
 }
 
@@ -1152,6 +1196,56 @@ static const GtkRadioActionEntry arrange_radio_entries[] = {
 };
 
 static void
+update_view_menu (NautilusView *view)
+{
+       NautilusWindow *window;
+       GMenu *sort_menu, *main_view_menu;
+       GMenuItem *sort_trash_item, *sort_search_item, *reversed_order_item;
+       NautilusFile *file;
+
+
+       NAUTILUS_VIEW_CLASS (nautilus_canvas_view_parent_class)->update_view_menu (view);
+       
+       GtkBuilder *builder;
+       builder = gtk_builder_new_from_resource ("/org/gnome/nautilus/nautilus-sort-menu.xml");
+       sort_menu = g_object_ref (G_MENU (gtk_builder_get_object (builder, "sort-menu")));
+       g_object_unref (builder);
+
+       file = nautilus_view_get_directory_as_file (NAUTILUS_VIEW (view));
+       if (file != NULL && nautilus_file_is_in_trash (file)) {
+               sort_trash_item = g_menu_item_new ("Trash", "win.sort('sort-by-trash-time')");
+               g_menu_append_item (sort_menu, sort_trash_item);
+       }
+
+       if (file != NULL && nautilus_file_is_in_search (file)) {
+               sort_search_item = g_menu_item_new ("Search", "win.sort('sort-by-search-relevance')");
+               g_menu_append_item (sort_menu, sort_search_item);
+       }
+
+       window = NAUTILUS_VIEW_CLASS (nautilus_canvas_view_parent_class)->get_window (view);
+       main_view_menu = nautilus_window_get_view_menu (window);
+
+       nautilus_gmenu_merge (main_view_menu, sort_menu, "sort-menu");
+       reversed_order_item = g_menu_item_new ("Reversed Order", "win.reversed-order");
+       nautilus_gmenu_add_item_in_section (main_view_menu, reversed_order_item, "reversed-order");
+
+       /* Match actions state of the settings */
+       if (nautilus_canvas_view_supports_auto_layout (NAUTILUS_CANVAS_VIEW (view))) {
+               GAction *action = g_action_map_lookup_action (G_ACTION_MAP (window), "reversed-order");
+               g_action_change_state (action,
+                                       g_variant_new_boolean (NAUTILUS_CANVAS_VIEW 
(view)->details->sort_reversed));
+
+               action = g_action_map_lookup_action (G_ACTION_MAP (window), "sort");
+               g_action_change_state (action,
+                                       g_variant_new_string (NAUTILUS_CANVAS_VIEW 
(view)->details->sort->action_target_name));
+       }
+
+       GAction *keep_aligned = g_action_map_lookup_action (G_ACTION_MAP (window), "keep-aligned");
+       g_action_change_state (keep_aligned,
+                              g_variant_new_boolean (nautilus_canvas_container_is_keep_aligned 
(get_canvas_container (NAUTILUS_CANVAS_VIEW (view)))));
+}
+
+static void
 nautilus_canvas_view_merge_menus (NautilusView *view)
 {
        NautilusCanvasView *canvas_view;
@@ -1186,6 +1280,8 @@ nautilus_canvas_view_merge_menus (NautilusView *view)
                gtk_ui_manager_add_ui_from_resource (ui_manager, 
"/org/gnome/nautilus/nautilus-canvas-view-ui.xml", NULL);
 
        update_layout_menus (canvas_view);
+
+       g_print ("END nautilus_canvas_view_merge_menus\n");
 }
 
 static void
@@ -1238,6 +1334,8 @@ nautilus_canvas_view_reset_to_defaults (NautilusView *view)
 
        nautilus_canvas_container_sort (canvas_container);
 
+       g_print ("#### reset_to_defaults\n");
+
        update_layout_menus (canvas_view);
 
        nautilus_canvas_view_restore_default_zoom_level (view);
@@ -1335,6 +1433,7 @@ canvas_container_activate_callback (NautilusCanvasContainer *container,
                                  GList *file_list,
                                  NautilusCanvasView *canvas_view)
 {
+       g_print ("canvas_container_activate_callback\n");
        g_assert (NAUTILUS_IS_CANVAS_VIEW (canvas_view));
        g_assert (container == get_canvas_container (canvas_view));
 
@@ -1502,6 +1601,7 @@ nautilus_canvas_view_react_to_canvas_change_idle_callback (gpointer data)
 {        
         NautilusCanvasView *canvas_view;
         
+        g_print ("nautilus_canvas_view_react_to_canvas_change_idle_callback\n");
         g_assert (NAUTILUS_IS_CANVAS_VIEW (data));
         
         canvas_view = NAUTILUS_CANVAS_VIEW (data);
@@ -2077,6 +2177,7 @@ nautilus_canvas_view_class_init (NautilusCanvasViewClass *klass)
        nautilus_view_class->get_zoom_level = nautilus_canvas_view_get_zoom_level;
         nautilus_view_class->click_policy_changed = nautilus_canvas_view_click_policy_changed;
         nautilus_view_class->merge_menus = nautilus_canvas_view_merge_menus;
+        nautilus_view_class->update_view_menu = update_view_menu;
         nautilus_view_class->unmerge_menus = nautilus_canvas_view_unmerge_menus;
         nautilus_view_class->sort_directories_first_changed = 
nautilus_canvas_view_sort_directories_first_changed;
         nautilus_view_class->start_renaming_file = nautilus_canvas_view_start_renaming_file;
@@ -2124,10 +2225,13 @@ nautilus_canvas_view_init (NautilusCanvasView *canvas_view)
 {
        NautilusCanvasContainer *canvas_container;
 
+       GtkBuilder *builder;
+       GMenuModel *menu;
+
         g_return_if_fail (gtk_bin_get_child (GTK_BIN (canvas_view)) == NULL);
 
        canvas_view->details = g_new0 (NautilusCanvasViewDetails, 1);
-       canvas_view->details->sort = &sort_criteria[0];
+       canvas_view->details->sort = &gsort_criteria[0];
 
        canvas_container = create_canvas_container (canvas_view);
 
diff --git a/src/nautilus-canvas-view.h b/src/nautilus-canvas-view.h
index e2b77ed..d3884a7 100644
--- a/src/nautilus-canvas-view.h
+++ b/src/nautilus-canvas-view.h
@@ -67,4 +67,11 @@ NautilusView * nautilus_canvas_view_new (NautilusWindowSlot *slot);
 
 NautilusCanvasContainer * nautilus_canvas_view_get_canvas_container (NautilusCanvasView *view);
 
+void nautilus_canvas_view_action_reversed_order (NautilusCanvasView *canvas_view,
+                                                const gboolean reversed_order);
+void nautilus_canvas_view_action_keep_aligned (NautilusCanvasView *canvas_view,
+                                               const gboolean  keep_aligned);
+void nautilus_canvas_view_action_sort (NautilusCanvasView *canvas_view,
+                                       const gchar* action_name);
+
 #endif /* NAUTILUS_CANVAS_VIEW_H */
diff --git a/src/nautilus-main-menus.xml b/src/nautilus-main-menus.xml
new file mode 100644
index 0000000..7ef8142
--- /dev/null
+++ b/src/nautilus-main-menus.xml
@@ -0,0 +1,101 @@
+<?xml version="1.0"?>
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <menu id="view-menu">
+    <section>
+      <attribute name="display-hint">horizontal-buttons</attribute>
+      <item>
+        <attribute name="label" translatable="yes">Zoom Out</attribute>
+        <attribute name="action">win.view-mode</attribute>
+        <attribute name="target">grid</attribute>
+        <attribute name="verb-icon">view-grid-symbolic</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">Zoom In</attribute>
+        <attribute name="action">win.view-mode</attribute>
+        <attribute name="target">list</attribute>
+        <attribute name="verb-icon">view-list-symbolic</attribute>
+      </item>
+    </section>
+    <section>
+      <attribute name="display-hint">horizontal-buttons</attribute>
+      <item>
+        <attribute name="label" translatable="yes">Zoom Out</attribute>
+        <attribute name="action">win.zoom-out</attribute>
+        <attribute name="verb-icon">list-remove-symbolic</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">Zoom</attribute>
+        <attribute name="action">win.dummy</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">Zoom In</attribute>
+        <attribute name="action">win.zoom-in</attribute>
+        <attribute name="verb-icon">list-add-symbolic</attribute>
+      </item>
+    </section>
+    <section>
+      <attribute name="id">sort-menu</attribute>
+    </section>
+    <section>
+        <attribute name="id">reversed-order</attribute>
+    </section>
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">Show Sidebar</attribute>
+        <attribute name="action">win.show-sidebar</attribute>
+      </item>
+    </section>
+    <section>
+      <attribute name="id">extended-view-specific-menu</attribute>
+    </section>
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">Show Hidden Files</attribute>
+        <attribute name="action">win.show-hidden-files</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">Reload</attribute>
+        <attribute name="action">win.reload</attribute>
+      </item>
+    </section>
+  </menu>
+  <menu id="action-menu">
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">New Folder</attribute>
+        <attribute name="action">win.new-folder</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">New Tab</attribute>
+        <attribute name="action">win.new-tab</attribute>
+      </item>
+    </section>
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">Undo</attribute>
+        <attribute name="action">win.undo</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">Redo</attribute>
+        <attribute name="action">win.redo</attribute>
+      </item>
+    </section>
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">Select All</attribute>
+        <attribute name="action">win.select-all</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">Enter Location</attribute>
+        <attribute name="action">win.enter-location</attribute>
+      </item>
+    </section>
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">Bookmark this Location</attribute>
+        <attribute name="action">win.bookmark-current-location</attribute>
+      </item>
+    </section>
+  </menu>
+</interface>
\ No newline at end of file
diff --git a/src/nautilus-sort-menu.xml b/src/nautilus-sort-menu.xml
new file mode 100644
index 0000000..aa0f84f
--- /dev/null
+++ b/src/nautilus-sort-menu.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0"?>
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <menu id="sort-menu">
+    <item>
+      <attribute name="id">sort-label-item</attribute>
+      <attribute name="label" translatable="yes">Sort</attribute>
+      <attribute name="action">win.dummy</attribute>
+    </item>
+    <item>
+      <attribute name="id">sort-by-name-item</attribute>
+      <attribute name="label" translatable="yes">Name</attribute>
+      <attribute name="action">win.sort</attribute>
+      <attribute name="target">sort-by-name</attribute>
+    </item>
+    <item>
+      <attribute name="id">sort-by-size-item</attribute>
+      <attribute name="label" translatable="yes">Size</attribute>
+      <attribute name="action">win.sort</attribute>
+      <attribute name="target">sort-by-size</attribute>
+    </item>
+    <item>
+      <attribute name="id">sort-by-type-item</attribute>
+      <attribute name="label" translatable="yes">Type</attribute>
+      <attribute name="action">win.sort</attribute>
+      <attribute name="target">sort-by-type</attribute>
+    </item>
+    <item>
+      <attribute name="id">sort-by-modification-date-item</attribute>
+      <attribute name="label" translatable="yes">Modification Date</attribute>
+      <attribute name="action">win.sort</attribute>
+      <attribute name="target">sort-by-modification-date</attribute>
+    </item>
+    <item>
+      <attribute name="id">sort-by-access-date-item</attribute>
+      <attribute name="label" translatable="yes">Access Date</attribute>
+      <attribute name="action">win.sort</attribute>
+      <attribute name="target">sort-by-access-date</attribute>
+    </item>
+  </menu>
+</interface>
diff --git a/src/nautilus-toolbar-ui.xml b/src/nautilus-toolbar-ui.xml
new file mode 100644
index 0000000..e074792
--- /dev/null
+++ b/src/nautilus-toolbar-ui.xml
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.8 -->
+  <template class="NautilusToolbar" parent="GtkHeaderBar">
+    <property name="visible">True</property>
+    <property name="show-close-button">True</property>
+    <child>
+      <object class="GtkBox" id="navigation_box">
+        <property name="visible">True</property>
+        <property name="orientation">horizontal</property>
+        <style>
+          <class name="linked"/>
+          <class name="raised"/>
+        </style>
+        <child>
+          <object class="GtkButton" id="back_button">
+            <property name="visible">True</property>
+            <property name="sensitive">True</property>
+            <property name="action_name">win.back</property>
+            <style>
+              <class name="image-button"/>
+            </style>
+            <child>
+              <object class="GtkImage" id="back_icon">
+                <property name="visible">True</property>
+                <property name="icon-name">go-previous-symbolic</property>
+                <property name="icon-size">1</property>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="pack-type">start</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkButton" id="forward_button">
+            <property name="visible">True</property>
+            <property name="sensitive">True</property>
+            <property name="action_name">win.forward</property>
+            <style>
+              <class name="image-button"/>
+            </style>
+            <child>
+              <object class="GtkImage" id="forward_icon">
+                <property name="visible">True</property>
+                <property name="icon-name">go-next-symbolic</property>
+                <property name="icon-size">1</property>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="pack-type">start</property>
+          </packing>
+        </child>
+      </object>
+      <packing>
+        <property name="pack-type">start</property>
+      </packing>
+      </child>
+      <child>
+        <object class="GtkBox" id="path_bar_container">
+        </object>
+        <packing>
+            <property name="pack-type">start</property>
+        </packing>
+      </child>
+      <child>
+        <object class="GtkBox" id="location_entry_container">
+        </object>
+        <packing>
+          <property name="pack-type">start</property>
+        </packing>
+      </child>
+      <child>
+        <object class="GtkMenuButton" id="action_button">
+          <property name="visible">True</property>
+          <property name="sensitive">True</property>
+          <style>
+            <class name="image-button"/>
+          </style>
+          <child>
+            <object class="GtkImage" id="action_icon">
+              <property name="visible">True</property>
+              <property name="icon-name">open-menu-symbolic</property>
+              <property name="icon-size">1</property>
+            </object>
+          </child>
+        </object>
+        <packing>
+          <property name="pack-type">end</property>
+        </packing>
+      </child>
+      <child>
+        <object class="GtkMenuButton" id="view_button">
+          <property name="visible">True</property>
+          <property name="sensitive">True</property>
+          <style>
+            <class name="image-button"/>
+          </style>
+          <child>
+            <object class="GtkImage" id="view_icon">
+              <property name="visible">True</property>
+              <property name="icon-name">go-down-symbolic</property>
+              <property name="icon-size">1</property>
+            </object>
+          </child>
+        </object>
+        <packing>
+          <property name="pack-type">end</property>
+        </packing>
+      </child>
+      <child>
+        <object class="GtkToggleButton" id="search_button">
+          <property name="visible">True</property>
+          <property name="sensitive">True</property>
+          <property name="action_name">win.toggle-search</property>
+          <style>
+            <class name="image-button"/>
+          </style>
+          <child>
+            <object class="GtkImage" id="search_icon">
+              <property name="visible">True</property>
+              <property name="icon-name">edit-find-symbolic</property>
+              <property name="icon-size">1</property>
+            </object>
+          </child>
+        </object>
+        <packing>
+          <property name="pack-type">end</property>
+        </packing>
+      </child>
+  </template>
+</interface>
diff --git a/src/nautilus-toolbar.c b/src/nautilus-toolbar.c
index 642f524..0e56ba0 100644
--- a/src/nautilus-toolbar.c
+++ b/src/nautilus-toolbar.c
@@ -42,15 +42,22 @@ typedef enum {
        NAUTILUS_NAVIGATION_DIRECTION_FORWARD
 } NautilusNavigationDirection;
 
-struct _NautilusToolbarPriv {
+struct _NautilusToolbarPrivate {
        NautilusWindow *window;
 
+       GtkWidget *path_bar_container;
+       GtkWidget *location_entry_container;
        GtkWidget *path_bar;
        GtkWidget *location_entry;
 
        gboolean show_location_entry;
 
        guint popup_timeout_id;
+
+       GtkWidget *view_button;
+       GtkWidget *action_button;
+       GMenu *view_menu;
+       GMenu *action_menu;
 };
 
 enum {
@@ -61,7 +68,7 @@ enum {
 
 static GParamSpec *properties[NUM_PROPERTIES] = { NULL, };
 
-G_DEFINE_TYPE (NautilusToolbar, nautilus_toolbar, GTK_TYPE_HEADER_BAR);
+G_DEFINE_TYPE_WITH_PRIVATE(NautilusToolbar, nautilus_toolbar, GTK_TYPE_HEADER_BAR);
 
 static void unschedule_menu_popup_timeout (NautilusToolbar *self);
 
@@ -145,6 +152,25 @@ activate_forward_menu_item_callback (GtkMenuItem *menu_item, NautilusWindow *win
        activate_back_or_forward_menu_item (menu_item, window, FALSE);
 }
 
+void
+nautilus_toolbar_sync_navigation_buttons (NautilusToolbar *self)
+{
+       NautilusWindowSlot *active_slot;
+       GAction *action;
+       gboolean enabled;
+
+       /* Check if the back and forward buttons need enabling or disabling. */
+       active_slot = nautilus_window_get_active_slot (self->priv->window);
+
+        action = g_action_map_lookup_action (G_ACTION_MAP (self->priv->window), "back");
+        enabled = nautilus_window_slot_get_back_history (active_slot) != NULL;
+        g_simple_action_set_enabled (G_SIMPLE_ACTION (action), enabled);
+
+        action = g_action_map_lookup_action (G_ACTION_MAP (self->priv->window), "forward");
+        enabled = nautilus_window_slot_get_forward_history (active_slot) != NULL;
+        g_simple_action_set_enabled (G_SIMPLE_ACTION (action), enabled);
+}
+
 static void
 fill_menu (NautilusWindow *window,
           GtkWidget *menu,
@@ -378,106 +404,22 @@ gear_menu_key_press (GtkWidget *widget,
 }
 
 static void
-nautilus_toolbar_constructed (GObject *obj)
+nautilus_toolbar_init (NautilusToolbar *self)
 {
-       NautilusToolbar *self = NAUTILUS_TOOLBAR (obj);
-       GtkWidget *toolbar;
-       GtkWidget *button;
-       GtkWidget *menu;
-       GtkWidget *box;
-       GtkUIManager *ui_manager;
-
-       G_OBJECT_CLASS (nautilus_toolbar_parent_class)->constructed (obj);
-
-       toolbar = GTK_WIDGET (obj);
-
-       ui_manager = nautilus_window_get_ui_manager (self->priv->window);
-
-       /* Back and Forward */
-       box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-
-       /* Back */
-       button = toolbar_create_toolbutton (self, FALSE, FALSE, NAUTILUS_ACTION_BACK, NULL);
-       gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
-       gtk_action_set_icon_name (gtk_activatable_get_related_action (GTK_ACTIVATABLE (button)),
-                                 "go-previous-symbolic");
-       navigation_button_setup_menu (self, button, NAUTILUS_NAVIGATION_DIRECTION_BACK);
-       gtk_container_add (GTK_CONTAINER (box), button);
-
-       /* Forward */
-       button = toolbar_create_toolbutton (self, FALSE, FALSE, NAUTILUS_ACTION_FORWARD, NULL);
-       gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
-       gtk_action_set_icon_name (gtk_activatable_get_related_action (GTK_ACTIVATABLE (button)),
-                                 "go-next-symbolic");
-       navigation_button_setup_menu (self, button, NAUTILUS_NAVIGATION_DIRECTION_FORWARD);
-       gtk_container_add (GTK_CONTAINER (box), button);
-
-       gtk_style_context_add_class (gtk_widget_get_style_context (box),
-                                    GTK_STYLE_CLASS_RAISED);
-       gtk_style_context_add_class (gtk_widget_get_style_context (box),
-                                    GTK_STYLE_CLASS_LINKED);
-
-       gtk_header_bar_pack_start (GTK_HEADER_BAR (toolbar), box);
+       self->priv = nautilus_toolbar_get_instance_private (self);
+       gtk_widget_init_template (GTK_WIDGET (self));
 
        self->priv->path_bar = g_object_new (NAUTILUS_TYPE_PATH_BAR, NULL);
-       gtk_header_bar_pack_start (GTK_HEADER_BAR (toolbar), self->priv->path_bar);
+       gtk_container_add (GTK_CONTAINER (self->priv->path_bar_container),
+                                         self->priv->path_bar);
 
-       /* entry-like location bar */
        self->priv->location_entry = nautilus_location_entry_new ();
-       gtk_header_bar_pack_start (GTK_HEADER_BAR (toolbar), self->priv->location_entry);
-
-       /* Action Menu */
-       button = toolbar_create_toolbutton (self, TRUE, FALSE, "open-menu-symbolic", _("Location options"));
-       gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
-       menu = gtk_ui_manager_get_widget (ui_manager, "/ActionMenu");
-       gtk_widget_set_halign (menu, GTK_ALIGN_END);
-       gtk_menu_button_set_popup (GTK_MENU_BUTTON (button), menu);
-       gtk_actionable_set_action_name (GTK_ACTIONABLE (button), "win.gear-menu");
-        g_signal_connect (menu, "key-press-event", G_CALLBACK (gear_menu_key_press), self);
-
-       gtk_header_bar_pack_end (GTK_HEADER_BAR (toolbar), button);
-
-       /* View buttons */
-       box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-
-       button = toolbar_create_toolbutton (self, FALSE, TRUE, NAUTILUS_ACTION_VIEW_LIST, NULL);
-       gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
-       gtk_container_add (GTK_CONTAINER (box), button);
-       button = toolbar_create_toolbutton (self, FALSE, TRUE, NAUTILUS_ACTION_VIEW_GRID, NULL);
-       gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
-       gtk_container_add (GTK_CONTAINER (box), button);
-       button = toolbar_create_toolbutton (self, TRUE, FALSE, "go-down-symbolic", _("View options"));
-       gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
-       gtk_container_add (GTK_CONTAINER (box), button);
-       menu = gtk_ui_manager_get_widget (ui_manager, "/ViewMenu");
-       gtk_menu_button_set_popup (GTK_MENU_BUTTON (button), menu);
-
-       gtk_style_context_add_class (gtk_widget_get_style_context (box),
-                                    GTK_STYLE_CLASS_RAISED);
-       gtk_style_context_add_class (gtk_widget_get_style_context (box),
-                                    GTK_STYLE_CLASS_LINKED);
-
-       gtk_header_bar_pack_end (GTK_HEADER_BAR (toolbar), box);
-
-       /* search */
-       button = toolbar_create_toolbutton (self, FALSE, TRUE, NAUTILUS_ACTION_SEARCH, NULL);
-       gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
-       gtk_widget_set_margin_start (button, 76);
-       gtk_header_bar_pack_end (GTK_HEADER_BAR (toolbar), button);
-
-       g_signal_connect_swapped (nautilus_preferences,
-                                 "changed::" NAUTILUS_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY,
-                                 G_CALLBACK (toolbar_update_appearance), self);
-
-       gtk_widget_show_all (toolbar);
-       toolbar_update_appearance (self);
-}
+       gtk_container_add (GTK_CONTAINER (self->priv->location_entry_container),
+                                         self->priv->location_entry);
 
-static void
-nautilus_toolbar_init (NautilusToolbar *self)
-{
-       self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, NAUTILUS_TYPE_TOOLBAR,
-                                                 NautilusToolbarPriv);
+       gtk_widget_show_all (GTK_WIDGET (self));
+
+       toolbar_update_appearance (self);
 }
 
 static void
@@ -535,7 +477,9 @@ static void
 nautilus_toolbar_class_init (NautilusToolbarClass *klass)
 {
        GObjectClass *oclass;
+       GtkWidgetClass *widget_class;
 
+       widget_class = GTK_WIDGET_CLASS (klass);
        oclass = G_OBJECT_CLASS (klass);
        oclass->get_property = nautilus_toolbar_get_property;
        oclass->set_property = nautilus_toolbar_set_property;
@@ -556,10 +500,54 @@ nautilus_toolbar_class_init (NautilusToolbarClass *klass)
                                      FALSE,
                                      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
        
-       g_type_class_add_private (klass, sizeof (NautilusToolbarClass));
        g_object_class_install_properties (oclass, NUM_PROPERTIES, properties);
+
+       gtk_widget_class_set_template_from_resource (widget_class,
+                                                       "/org/gnome/nautilus/nautilus-toolbar-ui.xml");
+
+       gtk_widget_class_bind_template_child_private (widget_class, NautilusToolbar, view_button);
+       gtk_widget_class_bind_template_child_private (widget_class, NautilusToolbar, action_button);
+       gtk_widget_class_bind_template_child_private (widget_class, NautilusToolbar, path_bar_container);
+       gtk_widget_class_bind_template_child_private (widget_class, NautilusToolbar, 
location_entry_container);
+}
+
+void
+nautilus_toolbar_update_menus (NautilusToolbar *self)
+{
+       gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (self->priv->view_button),
+                                       G_MENU_MODEL (self->priv->view_menu));
+       gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (self->priv->action_button),
+                                       G_MENU_MODEL (self->priv->action_menu));
+}
+
+void
+nautilus_toolbar_reset_menus (NautilusToolbar *self)
+{
+       if (self->priv->view_menu != NULL)
+               g_object_unref (self->priv->view_menu);
+       if (self->priv->action_menu != NULL)
+               g_object_unref (self->priv->action_menu);
+       
+       GtkBuilder *builder;
+       builder = gtk_builder_new_from_resource ("/org/gnome/nautilus/nautilus-main-menus.xml");
+       self->priv->view_menu = g_object_ref (G_MENU (gtk_builder_get_object (builder, "view-menu")));
+       self->priv->action_menu = g_object_ref (G_MENU (gtk_builder_get_object (builder, "action-menu")));
+       g_object_unref (builder);
 }
 
+GMenu *
+nautilus_toolbar_get_view_menu (NautilusToolbar *self)
+{
+       return self->priv->view_menu;
+}
+
+GMenu *
+nautilus_toolbar_get_action_menu (NautilusToolbar *self)
+{
+       return self->priv->action_menu;
+}
+
+
 GtkWidget *
 nautilus_toolbar_new (NautilusWindow *window)
 {
diff --git a/src/nautilus-toolbar.h b/src/nautilus-toolbar.h
index 2a8d2dd..09b95ff 100644
--- a/src/nautilus-toolbar.h
+++ b/src/nautilus-toolbar.h
@@ -42,7 +42,7 @@
        (G_TYPE_INSTANCE_GET_CLASS ((obj), NAUTILUS_TYPE_TOOLBAR, NautilusToolbarClass))
 
 typedef struct _NautilusToolbar NautilusToolbar;
-typedef struct _NautilusToolbarPriv NautilusToolbarPriv;
+typedef struct _NautilusToolbarPrivate NautilusToolbarPrivate;
 typedef struct _NautilusToolbarClass NautilusToolbarClass;
 
 typedef enum {
@@ -54,7 +54,7 @@ struct _NautilusToolbar {
        GtkHeaderBar parent;
 
        /* private */
-       NautilusToolbarPriv *priv;
+       NautilusToolbarPrivate *priv;
 };
 
 struct _NautilusToolbarClass {
@@ -73,4 +73,11 @@ void nautilus_toolbar_set_show_main_bar (NautilusToolbar *self,
 void nautilus_toolbar_set_show_location_entry (NautilusToolbar *self,
                                               gboolean show_location_entry);
 
+void nautilus_toolbar_update_menus (NautilusToolbar *self);
+void nautilus_toolbar_reset_menus (NautilusToolbar *self);
+GMenu * nautilus_toolbar_get_view_menu (NautilusToolbar *self);
+GMenu * nautilus_toolbar_get_action_menu (NautilusToolbar *self);
+
+void nautilus_toolbar_sync_navigation_buttons (NautilusToolbar *self);
+
 #endif /* __NAUTILUS_TOOLBAR_H__ */
diff --git a/src/nautilus-view.c b/src/nautilus-view.c
index 20590c4..53ed6ab 100644
--- a/src/nautilus-view.c
+++ b/src/nautilus-view.c
@@ -36,6 +36,7 @@
 #include "nautilus-mime-actions.h"
 #include "nautilus-previewer.h"
 #include "nautilus-properties-window.h"
+#include "nautilus-window.h"
 
 #if ENABLE_EMPTY_VIEW
 #include "nautilus-empty-view.h"
@@ -281,8 +282,6 @@ static void     load_directory                                 (NautilusView
                                                                NautilusDirectory    *directory);
 static void     nautilus_view_merge_menus                      (NautilusView      *view);
 static void     nautilus_view_unmerge_menus                    (NautilusView      *view);
-static void     nautilus_view_set_show_hidden_files           (NautilusView      *view,
-                                                              gboolean           show_hidden);
 static void     clipboard_changed_callback                     (NautilusClipboardMonitor *monitor,
                                                                NautilusView      *view);
 static void     open_one_in_new_window                         (gpointer              data,
@@ -2197,7 +2196,7 @@ action_show_hidden_files_callback (GtkAction *action,
 
        view = NAUTILUS_VIEW (callback_data);
 
-       nautilus_view_set_show_hidden_files
+       nautilus_view_action_show_hidden_files
                (view, gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
 }
 
@@ -2245,7 +2244,7 @@ show_hidden_files_changed_callback (gpointer callback_data)
        preference_value =
                g_settings_get_boolean (gtk_filechooser_preferences, NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES);
 
-       nautilus_view_set_show_hidden_files (view, preference_value);
+       nautilus_view_action_show_hidden_files (view, preference_value);
 }
 
 static gboolean
@@ -2442,7 +2441,10 @@ slot_active (NautilusWindowSlot *slot,
 
        view->details->active = TRUE;
 
+       g_print ("slot active\n");
+
        nautilus_view_merge_menus (view);
+       nautilus_window_update_menus (nautilus_view_get_window (view));
        schedule_update_menus (view);
 }
 
@@ -2454,6 +2456,7 @@ slot_inactive (NautilusWindowSlot *slot,
                return;
        }
 
+       g_print ("slot inactive\n");
        view->details->active = FALSE;
 
        nautilus_view_unmerge_menus (view);
@@ -2716,7 +2719,7 @@ static void
 real_unmerge_menus (NautilusView *view)
 {
        GtkUIManager *ui_manager;
-
+       g_print(" real unmerge menus\n");
        ui_manager = nautilus_view_get_ui_manager (view);
        if (ui_manager == NULL) {
                return;
@@ -7083,8 +7086,8 @@ nautilus_view_get_show_hidden_files (NautilusView *view)
        return view->details->show_hidden_files;
 }
 
-static void
-nautilus_view_set_show_hidden_files (NautilusView *view,
+void
+nautilus_view_action_show_hidden_files (NautilusView *view,
                                     gboolean show_hidden)
 {
        if (view->details->ignore_hidden_file_preferences) {
@@ -7099,6 +7102,54 @@ nautilus_view_set_show_hidden_files (NautilusView *view,
        }
 }
 
+void
+nautilus_view_action_new_folder (NautilusView *view)
+{
+        g_assert (NAUTILUS_IS_VIEW (view));
+
+       nautilus_view_new_folder (view, FALSE);
+}
+
+void
+nautilus_view_action_new_tab (NautilusView *view)
+{
+       GList *selection;
+       GtkWindow *window;
+
+       selection = nautilus_view_get_selection (view);
+
+       window = nautilus_view_get_containing_window (view);
+
+       if (nautilus_view_confirm_multiple (window, g_list_length (selection), TRUE)) {
+               nautilus_view_activate_files (view,
+                                             selection,
+                                             NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB,
+                                             FALSE);
+       }
+
+       nautilus_file_list_free (selection);
+}
+
+void
+nautilus_view_action_undo (NautilusView *view)
+{
+       real_action_undo (view);
+}
+
+void
+nautilus_view_action_redo (NautilusView *view)
+{
+       real_action_redo (view);
+}
+
+void
+nautilus_view_action_select_all (NautilusView *view)
+{
+       g_assert (NAUTILUS_IS_VIEW (view));
+
+       nautilus_view_select_all (view);
+}
+
 static const GtkActionEntry directory_view_entries[] = {
   /* name, stock id, label */  { NAUTILUS_ACTION_NEW_DOCUMENTS, "document-new", N_("New _Document") },
   /* name, stock id, label */  { NAUTILUS_ACTION_OPEN_WITH, NULL, N_("Open Wit_h"),
@@ -7408,6 +7459,20 @@ pre_activate (NautilusView *view,
        }
 }
 
+void
+nautilus_view_update_view_menu (NautilusView *view)
+{
+       g_assert(NAUTILUS_IS_VIEW (view));
+
+       NAUTILUS_VIEW_CLASS (G_OBJECT_GET_CLASS (view))->update_view_menu (view);
+}
+
+static void
+real_update_view_menu (NautilusView *view)
+{
+       g_print("real_update_view_menu \n");
+}
+
 static void
 real_merge_menus (NautilusView *view)
 {
@@ -7416,6 +7481,8 @@ real_merge_menus (NautilusView *view)
        GtkAction *action;
        char *tooltip;
 
+       g_print("real merge menus\n");
+
        ui_manager = nautilus_view_get_ui_manager (view);
 
        action_group = gtk_action_group_new ("DirViewActions");
@@ -9671,7 +9738,6 @@ nautilus_view_parent_set (GtkWidget *widget,
 {
        NautilusView *view;
        GtkWidget *parent;
-
        view = NAUTILUS_VIEW (widget);
 
        parent = gtk_widget_get_parent (widget);
@@ -9689,6 +9755,8 @@ nautilus_view_parent_set (GtkWidget *widget,
                        view->details->active = TRUE;
 
                        nautilus_view_merge_menus (view);
+                       g_print("parent set \n");
+                       nautilus_window_update_menus (nautilus_view_get_window (view));
                        schedule_update_menus (view);
                }
        } else {
@@ -9827,9 +9895,11 @@ nautilus_view_class_init (NautilusViewClass *klass)
        klass->using_manual_layout = real_using_manual_layout;
         klass->merge_menus = real_merge_menus;
         klass->unmerge_menus = real_unmerge_menus;
+        klass->get_window = nautilus_view_get_window;
         klass->update_menus = real_update_menus;
        klass->trash = real_trash;
        klass->delete = real_delete;
+       klass->update_view_menu = real_update_view_menu;
 
        copied_files_atom = gdk_atom_intern ("x-special/gnome-copied-files", FALSE);
 
diff --git a/src/nautilus-view.h b/src/nautilus-view.h
index 98f3d57..755e266 100644
--- a/src/nautilus-view.h
+++ b/src/nautilus-view.h
@@ -295,6 +295,10 @@ struct NautilusViewClass {
         /* Signals used only for keybindings */
         gboolean (* trash)                         (NautilusView *view);
         gboolean (* delete)                        (NautilusView *view);
+
+        void   (*update_view_menu)              (NautilusView *view);
+
+        NautilusWindow * (*get_window)         (NautilusView *view);
 };
 
 /* GObject support */
@@ -410,5 +414,14 @@ void              nautilus_view_grab_focus                 (NautilusView      *v
 void              nautilus_view_update_menus               (NautilusView      *view);
 
 gboolean          nautilus_view_get_show_hidden_files      (NautilusView      *view);
+void nautilus_view_action_show_hidden_files (NautilusView *view,
+                                       gboolean show_hidden);
+void nautilus_view_update_view_menu (NautilusView *view);
+
+void nautilus_view_action_new_folder (NautilusView *view);
+void nautilus_view_action_new_tab (NautilusView *view);
+void nautilus_view_action_undo (NautilusView *view);
+void nautilus_view_action_redo (NautilusView *view);
+void nautilus_view_action_select_all (NautilusView *view);
 
 #endif /* NAUTILUS_VIEW_H */
diff --git a/src/nautilus-window-menus.c b/src/nautilus-window-menus.c
index 999d163..4dd8f67 100644
--- a/src/nautilus-window-menus.c
+++ b/src/nautilus-window-menus.c
@@ -39,6 +39,8 @@
 #include "nautilus-window-private.h"
 #include "nautilus-desktop-window.h"
 #include "nautilus-properties-window.h"
+#include "nautilus-view.h"
+#include "nautilus-toolbar.h"
 
 #include <gtk/gtk.h>
 #include <gio/gio.h>
@@ -494,6 +496,25 @@ static const GtkRadioActionEntry view_radio_entries[] = {
 };
 
 static void
+action_back (GSimpleAction *action,
+               GVariant      *state,
+               gpointer       user_data) 
+{
+       nautilus_window_back_or_forward (NAUTILUS_WINDOW (user_data), 
+                                        TRUE, 0, nautilus_event_get_window_open_flags ());
+}
+
+static void
+action_forward (GSimpleAction *action,
+               GVariant      *state,
+               gpointer       user_data) 
+{
+       nautilus_window_back_or_forward (NAUTILUS_WINDOW (user_data), 
+                                        FALSE, 0, nautilus_event_get_window_open_flags ());
+}
+
+
+static void
 action_toggle_state (GSimpleAction *action,
                     GVariant *parameter,
                     gpointer user_data)
@@ -506,16 +527,251 @@ action_toggle_state (GSimpleAction *action,
        g_variant_unref (state);
 }
 
+static void
+action_zoom_in (GSimpleAction *action,
+               GVariant      *parameter,
+               gpointer       user_data) 
+{
+
+       nautilus_view_bump_zoom_level (get_current_view (user_data), 1);
+}
+
+static void
+action_zoom_out (GSimpleAction *action,
+               GVariant      *parameter,
+               gpointer       user_data) 
+{
+       nautilus_view_bump_zoom_level (get_current_view (user_data), -1);
+}
+
+static void
+action_zoom_normal (GSimpleAction *action,
+               GVariant      *parameter,
+               gpointer       user_data) 
+{
+       nautilus_view_restore_default_zoom_level (get_current_view (user_data));
+}
+
+static void
+action_reversed_order (GSimpleAction *action,
+                       GVariant      *state,
+                       gpointer       user_data)
+{
+       nautilus_canvas_view_action_reversed_order (NAUTILUS_CANVAS_VIEW (get_current_view (user_data)),
+                                                   g_variant_get_boolean (state));
+       g_simple_action_set_state (action, state);
+}
+
+static void
+action_keep_aligned (GSimpleAction *action,
+                       GVariant      *state,
+                       gpointer       user_data)
+{
+       nautilus_canvas_view_action_keep_aligned (NAUTILUS_CANVAS_VIEW (get_current_view (user_data)),
+                                                 g_variant_get_boolean (state));
+       g_simple_action_set_state (action, state);
+}
+
+static void
+action_sort_order_changed (GSimpleAction *action,
+                       GVariant      *value,
+                       gpointer       user_data)
+{
+       nautilus_canvas_view_action_sort (NAUTILUS_CANVAS_VIEW (get_current_view (user_data)),
+                                         g_variant_get_string (value, NULL));
+       g_simple_action_set_state (action, value);
+}
+
+static void
+action_show_hidden_files (GSimpleAction *action,
+               GVariant      *state,
+               gpointer       user_data) 
+{
+
+       nautilus_view_action_show_hidden_files (NAUTILUS_VIEW (get_current_view (user_data)),
+                                       g_variant_get_boolean (state));
+       g_simple_action_set_state (action, state);
+}
+
+static void
+action_show_sidebar (GSimpleAction *action,
+                       GVariant      *state,
+                       gpointer       user_data) 
+{
+       NautilusWindow *window;
+
+       window = NAUTILUS_WINDOW (user_data);
+
+       if (g_variant_get_boolean (state)) {
+               nautilus_window_show_sidebar (window);
+       } else {
+               nautilus_window_hide_sidebar (window);
+       }
+
+       g_simple_action_set_state (action, state);
+}
+
+static void
+action_reload (GSimpleAction *action,
+               GVariant      *state,
+               gpointer       user_data) 
+{
+       NautilusWindowSlot *slot;
+
+       slot = nautilus_window_get_active_slot (NAUTILUS_WINDOW (user_data));
+       nautilus_window_slot_queue_reload (slot);
+}
+
+static void
+action_new_folder (GSimpleAction *action,
+               GVariant      *state,
+               gpointer       user_data) 
+{
+       nautilus_view_action_new_folder (NAUTILUS_VIEW (get_current_view (user_data)));
+}
+
+static void
+action_new_tab (GSimpleAction *action,
+               GVariant      *state,
+               gpointer       user_data) 
+{
+       nautilus_window_new_tab (NAUTILUS_WINDOW (user_data));
+}
+
+static void
+action_undo (GSimpleAction *action,
+               GVariant      *state,
+               gpointer       user_data) 
+{
+       nautilus_view_action_undo (NAUTILUS_VIEW (get_current_view (user_data)));
+}
+
+static void
+action_redo (GSimpleAction *action,
+               GVariant      *state,
+               gpointer       user_data) 
+{
+       nautilus_view_action_redo (NAUTILUS_VIEW (get_current_view (user_data)));
+}
+
+static void
+action_select_all (GSimpleAction *action,
+               GVariant      *state,
+               gpointer       user_data) 
+{
+       nautilus_view_action_select_all (NAUTILUS_VIEW (get_current_view (user_data)));
+}
+
+
+static void
+action_enter_location (GSimpleAction *action,
+               GVariant      *state,
+               gpointer       user_data) 
+{
+       g_action_group_activate_action (G_ACTION_GROUP (g_application_get_default ()),
+                                       "enter-location", NULL);
+}
+
+static void
+action_bookmark_current_location (GSimpleAction *action,
+                       GVariant      *state,
+                       gpointer       user_data) 
+{
+       NautilusWindow *window = user_data;
+       NautilusApplication *app = NAUTILUS_APPLICATION (g_application_get_default ());
+       NautilusWindowSlot *slot;
+
+       slot = nautilus_window_get_active_slot (window);
+       nautilus_bookmark_list_append (nautilus_application_get_bookmarks (app),
+                                      nautilus_window_slot_get_bookmark (slot));
+}
+
+static void
+action_toggle_search (GSimpleAction *action,
+                       GVariant      *state,
+                       gpointer       user_data)
+{
+       NautilusWindowSlot *slot;
+
+       slot = nautilus_window_get_active_slot (NAUTILUS_WINDOW (user_data));
+       nautilus_window_slot_set_search_visible (slot, g_variant_get_boolean (state));
+
+       g_simple_action_set_state (action, state);
+}
+
+static void
+action_view_mode (GSimpleAction *action,
+               GVariant      *value,
+               gpointer       user_data)
+{
+       const gchar *name;
+       NautilusWindowSlot *slot;
+
+       name =  g_variant_get_string (value, NULL);
+       slot = nautilus_window_get_active_slot (NAUTILUS_WINDOW (user_data));
+
+       if (g_strcmp0 (name, "list") == 0) {
+               nautilus_window_slot_set_content_view (slot, NAUTILUS_LIST_VIEW_ID);
+       } else if (g_strcmp0 (name, "grid") == 0) {
+               nautilus_window_slot_set_content_view (slot, NAUTILUS_CANVAS_VIEW_ID);
+       }
+
+       g_simple_action_set_state (action, value);
+}
+
 const GActionEntry win_entries[] = {
+       { "back",  action_back },
+       { "forward",  action_forward },
        { "gear-menu", action_toggle_state, NULL, "false", NULL },
+       { "zoom-in",  action_zoom_in },
+       { "zoom-out", action_zoom_out },
+       { "zoom-normal", action_zoom_normal },
+       { "show-hidden-files", NULL, NULL, "true", action_show_hidden_files },
+       { "show-sidebar", NULL, NULL, "false", action_show_sidebar },
+       { "reversed-order", NULL, NULL, "false", action_reversed_order },
+       { "keep-aligned", NULL, NULL, "true", action_keep_aligned },
+       { "reload", action_reload },
+       { "sort", NULL, "s", "'sort-by-name'", action_sort_order_changed },
+       { "new-folder", action_new_folder },
+       { "new-tab", action_new_tab },
+       { "undo", action_undo },
+       { "redo", action_redo },
+       { "select-all", action_select_all },
+       { "enter-location", action_enter_location },
+       { "bookmark-current-location", action_bookmark_current_location },
+       { "toggle-search", NULL, NULL, "false", action_toggle_search },
+       { "view-mode", NULL, "s", "'grid'", action_view_mode },
 };
 
 void 
 nautilus_window_initialize_actions (NautilusWindow *window)
 {
+       gboolean show_sidebar;
+
        g_action_map_add_action_entries (G_ACTION_MAP (window),
                                         win_entries, G_N_ELEMENTS (win_entries),
                                         window);
+
+       show_sidebar = g_settings_get_boolean (nautilus_window_state, 
NAUTILUS_WINDOW_STATE_START_WITH_SIDEBAR);
+       GAction *action = g_action_map_lookup_action (G_ACTION_MAP (window), "show-sidebar");
+       g_action_change_state (action, g_variant_new_boolean (show_sidebar));
+}
+
+void
+nautilus_window_reset_menus (NautilusWindow *window)
+{
+       NautilusView *active_view;
+       NautilusWindowSlot *active_slot;
+
+       g_print ("##### Reseting menus\n");
+
+       active_slot = nautilus_window_get_active_slot (window);
+       active_view =  nautilus_window_slot_get_view (active_slot);
+
+       nautilus_toolbar_reset_menus (NAUTILUS_TOOLBAR (window->details->toolbar));
+       nautilus_view_update_view_menu (active_view);
+
+       nautilus_toolbar_update_menus (NAUTILUS_TOOLBAR (window->details->toolbar));
 }
 
 /**
diff --git a/src/nautilus-window-private.h b/src/nautilus-window-private.h
index 5531d8e..fd12397 100644
--- a/src/nautilus-window-private.h
+++ b/src/nautilus-window-private.h
@@ -112,4 +112,6 @@ void               nautilus_window_initialize_menus                      (Nautil
 
 void               nautilus_window_update_show_hide_menu_items           (NautilusWindow     *window);
 
+void               nautilus_window_reset_menus           (NautilusWindow     *window);
+
 #endif /* NAUTILUS_WINDOW_PRIVATE_H */
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index ea2ff71..4350136 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -1357,6 +1357,21 @@ got_file_info_for_view_selection_callback (NautilusFile *file,
        nautilus_profile_end (NULL);
 }
 
+static void
+menus_updated_cb (NautilusView *view,
+                 NautilusWindowSlot *slot)
+{
+       NautilusWindow *window;
+       
+       window = nautilus_window_slot_get_window (slot);
+
+       if (NAUTILUS_IS_DESKTOP_WINDOW (window)) {
+               return;
+       }
+
+       //nautilus_window_update_menus (window, view);
+}
+
 /* Load a view into the window, either reusing the old one or creating
  * a new one. This happens when you want to load a new location, or just
  * switch to a different view.
@@ -1401,9 +1416,10 @@ create_content_view (NautilusWindowSlot *slot,
         } else {
                 /* create a new content view */
                view = nautilus_view_new (view_id, slot);
-
+               g_signal_connect (view, "menus-updated", G_CALLBACK (menus_updated_cb), slot);
                 slot->details->new_content_view = view;
                nautilus_window_slot_connect_new_content_view (slot);
+               g_print("NEW VIEW CONNECTED######\n");
         }
 
        /* Forward search selection and state before loading the new model */
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 124fc57..ef533c3 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -42,7 +42,7 @@
 #include "nautilus-toolbar.h"
 #include "nautilus-window-slot.h"
 #include "nautilus-list-view.h"
-#include "nautilus-canvas-view.h"
+#include "nautilus-view.h"
 
 #include <eel/eel-debug.h>
 #include <eel/eel-gtk-extensions.h>
@@ -452,8 +452,6 @@ nautilus_window_set_initial_window_geometry (NautilusWindow *window)
        GdkScreen *screen;
        guint max_width_for_screen, max_height_for_screen;
        guint default_width, default_height;
-       gboolean show_sidebar;
-       GtkAction *action;
 
        screen = gtk_window_get_screen (GTK_WINDOW (window));
        
@@ -468,17 +466,6 @@ nautilus_window_set_initial_window_geometry (NautilusWindow *window)
                                          max_width_for_screen), 
                                     MIN (default_height, 
                                          max_height_for_screen));
-
-       show_sidebar = g_settings_get_boolean (nautilus_window_state, 
NAUTILUS_WINDOW_STATE_START_WITH_SIDEBAR);
-       action = gtk_action_group_get_action (window->details->main_action_group,
-                                             NAUTILUS_ACTION_SHOW_HIDE_SIDEBAR);
-       gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), show_sidebar);
-
-       if (show_sidebar) {
-               nautilus_window_show_sidebar (window);
-       } else {
-               nautilus_window_hide_sidebar (window);
-       }
 }
 
 static gboolean
@@ -1012,10 +999,8 @@ nautilus_window_sync_bookmarks (NautilusWindow *window)
 void
 nautilus_window_sync_location_widgets (NautilusWindow *window)
 {
-       NautilusWindowSlot *slot, *active_slot;
+       NautilusWindowSlot *slot;
        GFile *location;
-       GtkActionGroup *action_group;
-       GtkAction *action;
 
        slot = window->details->active_slot;
        location = nautilus_window_slot_get_location (slot);
@@ -1036,15 +1021,7 @@ nautilus_window_sync_location_widgets (NautilusWindow *window)
 
        nautilus_window_sync_up_button (window);
 
-       /* Check if the back and forward buttons need enabling or disabling. */
-       active_slot = nautilus_window_get_active_slot (window);
-       action_group = nautilus_window_get_main_action_group (window);
-
-       action = gtk_action_group_get_action (action_group, NAUTILUS_ACTION_BACK);
-       gtk_action_set_sensitive (action, nautilus_window_slot_get_back_history (active_slot) != NULL);
-
-       action = gtk_action_group_get_action (action_group, NAUTILUS_ACTION_FORWARD);
-       gtk_action_set_sensitive (action, nautilus_window_slot_get_forward_history (active_slot) != NULL);
+       nautilus_toolbar_sync_navigation_buttons (NAUTILUS_TOOLBAR (window->details->toolbar));
 
        nautilus_window_sync_bookmarks (window);
 }
@@ -1271,6 +1248,26 @@ notebook_popup_menu_cb (GtkWidget *widget,
        return TRUE;
 }
 
+GMenu *
+nautilus_window_get_view_menu (NautilusWindow *window)
+{
+
+       return nautilus_toolbar_get_view_menu (NAUTILUS_TOOLBAR (window->details->toolbar));
+}
+
+GMenu *
+nautilus_window_get_action_menu (NautilusWindow *window)
+{
+
+       return nautilus_toolbar_get_action_menu (NAUTILUS_TOOLBAR (window->details->toolbar));
+}
+
+void
+nautilus_window_update_menus (NautilusWindow *window)
+{
+       nautilus_window_reset_menus (window);
+}
+
 static GtkWidget *
 create_toolbar (NautilusWindow *window)
 {
@@ -1459,13 +1456,6 @@ nautilus_window_constructed (GObject *self)
        gtk_widget_show (grid);
        gtk_container_add (GTK_CONTAINER (window), grid);
 
-       nautilus_window_initialize_menus (window);
-       nautilus_window_initialize_actions (window);
-
-       /* Register to menu provider extension signal managing menu updates */
-       g_signal_connect_object (nautilus_signaller_get_current (), "popup-menu-changed",
-                        G_CALLBACK (nautilus_window_load_extension_menus), window, G_CONNECT_SWAPPED);
-
        window->details->toolbar = create_toolbar (window);
        gtk_window_set_titlebar (GTK_WINDOW (window), window->details->toolbar);
 
@@ -1484,6 +1474,16 @@ nautilus_window_constructed (GObject *self)
        window->details->notebook = create_notebook (window);
        nautilus_window_set_initial_window_geometry (window);
 
+       /* Is required that the UI is constructed before initializating the actions, since
+        * some actions trigger UI widgets to show/hide. */
+       nautilus_window_initialize_menus (window);
+       nautilus_window_initialize_actions (window);
+
+       /* Register to menu provider extension signal managing menu updates */
+       g_signal_connect_object (nautilus_signaller_get_current (), "popup-menu-changed",
+                        G_CALLBACK (nautilus_window_load_extension_menus), window, G_CONNECT_SWAPPED);
+
+
        slot = nautilus_window_open_slot (window, 0);
        nautilus_window_set_active_slot (window, slot);
 
@@ -1492,6 +1492,8 @@ nautilus_window_constructed (GObject *self)
                                          G_CALLBACK (nautilus_window_sync_bookmarks), window);
 
        nautilus_profile_end (NULL);
+
+       g_print("construction ended\n");
 }
 
 static void
@@ -2108,6 +2110,8 @@ nautilus_window_init (NautilusWindow *window)
 
        window->details = G_TYPE_INSTANCE_GET_PRIVATE (window, NAUTILUS_TYPE_WINDOW, NautilusWindowDetails);
 
+       g_print("priv set\n");
+
        window->details->slots = NULL;
        window->details->active_slot = NULL;
 
diff --git a/src/nautilus-window.h b/src/nautilus-window.h
index f95eede..d617602 100644
--- a/src/nautilus-window.h
+++ b/src/nautilus-window.h
@@ -122,6 +122,7 @@ void                 nautilus_window_grab_focus            (NautilusWindow *wind
 
 void     nautilus_window_hide_sidebar         (NautilusWindow *window);
 void     nautilus_window_show_sidebar         (NautilusWindow *window);
+void     nautilus_window_update_menus         (NautilusWindow *window);
 void     nautilus_window_back_or_forward      (NautilusWindow *window,
                                                gboolean        back,
                                                guint           distance,
@@ -134,5 +135,7 @@ gboolean nautilus_window_disable_chrome_mapping (GValue *value,
 
 NautilusWindowOpenFlags nautilus_event_get_window_open_flags   (void);
 void     nautilus_window_show_about_dialog    (NautilusWindow *window);
+GMenu * nautilus_window_get_view_menu (NautilusWindow *window);
+GMenu * nautilus_window_get_action_menu (NautilusWindow *window);
 
 #endif
diff --git a/src/nautilus.gresource.xml b/src/nautilus.gresource.xml
index 37a5bbf..2e58ca8 100644
--- a/src/nautilus.gresource.xml
+++ b/src/nautilus.gresource.xml
@@ -9,6 +9,9 @@
     <file>nautilus-list-view-ui.xml</file>
     <file>nautilus-shell-ui.xml</file>
     <file>nautilus-app-menu.ui</file>
+    <file>nautilus-sort-menu.xml</file>
+    <file>nautilus-main-menus.xml</file>
+    <file>nautilus-toolbar-ui.xml</file>
     <file alias="icons/thumbnail_frame.png">../icons/thumbnail_frame.png</file>
     <file alias="icons/filmholes.png">../icons/filmholes.png</file>
     <file alias="icons/knob.png">../icons/knob.png</file>


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