[nautilus/wip/gaction] general:port to gaction



commit 05a86f5c7bb403bd0d1784699a1acdd2035e8be3
Author: Carlos Soriano <carlos soriano89 gmail com>
Date:   Thu Nov 6 16:34:19 2014 +0100

    general:port to gaction

 libnautilus-private/nautilus-canvas-container.c    |    4 -
 .../nautilus-file-conflict-dialog.c                |    8 +-
 libnautilus-private/nautilus-icon-info.c           |    8 -
 libnautilus-private/nautilus-icon-info.h           |   16 +-
 libnautilus-private/nautilus-ui-utilities.c        |   96 ++
 libnautilus-private/nautilus-ui-utilities.h        |    9 +
 .../org.gnome.nautilus.gschema.xml.in              |   10 +-
 src/nautilus-bookmarks-window.c                    |    2 +-
 src/nautilus-canvas-view-container.c               |   18 +-
 src/nautilus-canvas-view.c                         |  333 +++++--
 src/nautilus-desktop-canvas-view.c                 |   95 ++-
 src/nautilus-list-model.c                          |   16 -
 src/nautilus-list-view.c                           |   81 ++-
 src/nautilus-main-menus.xml                        |  117 +++
 src/nautilus-toolbar-ui.xml                        |  133 +++
 src/nautilus-toolbar-view-menu.xml                 |  207 ++++
 src/nautilus-toolbar.c                             |  293 ++++--
 src/nautilus-toolbar.h                             |   12 +-
 src/nautilus-view-right-click-menus.xml            |  103 ++
 src/nautilus-view.c                                |  985 +++++++++++++++-----
 src/nautilus-view.h                                |   18 +-
 src/nautilus-window-menus.c                        |  129 +++
 src/nautilus-window-private.h                      |    2 +
 src/nautilus-window-slot.c                         |    2 +-
 src/nautilus-window.c                              |   56 +-
 src/nautilus-window.h                              |    1 +
 src/nautilus.gresource.xml                         |    4 +
 27 files changed, 2195 insertions(+), 563 deletions(-)
---
diff --git a/libnautilus-private/nautilus-canvas-container.c b/libnautilus-private/nautilus-canvas-container.c
index 03c8e7d..8c92748 100644
--- a/libnautilus-private/nautilus-canvas-container.c
+++ b/libnautilus-private/nautilus-canvas-container.c
@@ -5192,11 +5192,7 @@ get_text_ellipsis_limit_for_zoom (char **strs,
 
 static const char * zoom_level_names[] = {
        "smallest",
-       "smaller",
-       "small",
        "standard",
-       "large",
-       "larger",
        "largest"
 };
 
diff --git a/libnautilus-private/nautilus-file-conflict-dialog.c 
b/libnautilus-private/nautilus-file-conflict-dialog.c
index 7fcb2d6..c6c1115 100644
--- a/libnautilus-private/nautilus-file-conflict-dialog.c
+++ b/libnautilus-private/nautilus-file-conflict-dialog.c
@@ -74,7 +74,7 @@ file_icons_changed (NautilusFile *file,
        GdkPixbuf *pixbuf;
 
        pixbuf = nautilus_file_get_icon_pixbuf (fcd->details->destination,
-                                               NAUTILUS_ICON_SIZE_LARGE,
+                                               NAUTILUS_ICON_SIZE_STANDARD,
                                                TRUE,
                                                gtk_widget_get_scale_factor (fcd->details->dest_image),
                                                NAUTILUS_FILE_ICON_FLAGS_USE_THUMBNAILS);
@@ -83,7 +83,7 @@ file_icons_changed (NautilusFile *file,
        g_object_unref (pixbuf);
 
        pixbuf = nautilus_file_get_icon_pixbuf (fcd->details->source,
-                                               NAUTILUS_ICON_SIZE_LARGE,
+                                               NAUTILUS_ICON_SIZE_STANDARD,
                                                TRUE,
                                                gtk_widget_get_scale_factor (fcd->details->src_image),
                                                NAUTILUS_FILE_ICON_FLAGS_USE_THUMBNAILS);
@@ -219,7 +219,7 @@ file_list_ready_cb (GList *files,
 
        /* Set up file icons */
        pixbuf = nautilus_file_get_icon_pixbuf (dest,
-                                               NAUTILUS_ICON_SIZE_LARGE,
+                                               NAUTILUS_ICON_SIZE_STANDARD,
                                                TRUE,
                                                gtk_widget_get_scale_factor (fcd->details->titles_vbox),
                                                NAUTILUS_FILE_ICON_FLAGS_USE_THUMBNAILS);
@@ -230,7 +230,7 @@ file_list_ready_cb (GList *files,
        g_object_unref (pixbuf);
 
        pixbuf = nautilus_file_get_icon_pixbuf (src,
-                                               NAUTILUS_ICON_SIZE_LARGE,
+                                               NAUTILUS_ICON_SIZE_STANDARD,
                                                TRUE,
                                                gtk_widget_get_scale_factor (fcd->details->titles_vbox),
                                                NAUTILUS_FILE_ICON_FLAGS_USE_THUMBNAILS);
diff --git a/libnautilus-private/nautilus-icon-info.c b/libnautilus-private/nautilus-icon-info.c
index c272803..5fa8b0d 100644
--- a/libnautilus-private/nautilus-icon-info.c
+++ b/libnautilus-private/nautilus-icon-info.c
@@ -580,16 +580,8 @@ nautilus_get_icon_size_for_zoom_level (NautilusZoomLevel zoom_level)
        switch (zoom_level) {
        case NAUTILUS_ZOOM_LEVEL_SMALLEST:
                return NAUTILUS_ICON_SIZE_SMALLEST;
-       case NAUTILUS_ZOOM_LEVEL_SMALLER:
-               return NAUTILUS_ICON_SIZE_SMALLER;
-       case NAUTILUS_ZOOM_LEVEL_SMALL:
-               return NAUTILUS_ICON_SIZE_SMALL;
        case NAUTILUS_ZOOM_LEVEL_STANDARD:
                return NAUTILUS_ICON_SIZE_STANDARD;
-       case NAUTILUS_ZOOM_LEVEL_LARGE:
-               return NAUTILUS_ICON_SIZE_LARGE;
-       case NAUTILUS_ZOOM_LEVEL_LARGER:
-               return NAUTILUS_ICON_SIZE_LARGER;
        case NAUTILUS_ZOOM_LEVEL_LARGEST:
                return NAUTILUS_ICON_SIZE_LARGEST;
        }
diff --git a/libnautilus-private/nautilus-icon-info.h b/libnautilus-private/nautilus-icon-info.h
index e8446ec..652e099 100644
--- a/libnautilus-private/nautilus-icon-info.h
+++ b/libnautilus-private/nautilus-icon-info.h
@@ -12,12 +12,8 @@ G_BEGIN_DECLS
 /* Names for Nautilus's different zoom levels, from tiniest items to largest items */
 typedef enum {
        NAUTILUS_ZOOM_LEVEL_SMALLEST,
-       NAUTILUS_ZOOM_LEVEL_SMALLER,
-       NAUTILUS_ZOOM_LEVEL_SMALL,
        NAUTILUS_ZOOM_LEVEL_STANDARD,
-       NAUTILUS_ZOOM_LEVEL_LARGE,
-       NAUTILUS_ZOOM_LEVEL_LARGER,
-       NAUTILUS_ZOOM_LEVEL_LARGEST
+       NAUTILUS_ZOOM_LEVEL_LARGEST,
 } NautilusZoomLevel;
 
 #define NAUTILUS_ZOOM_LEVEL_N_ENTRIES (NAUTILUS_ZOOM_LEVEL_LARGEST + 1)
@@ -28,13 +24,9 @@ typedef enum {
  * be square. Since individual icons can be stretched,
  * each icon is not constrained to this nominal size.
  */
-#define NAUTILUS_ICON_SIZE_SMALLEST    16
-#define NAUTILUS_ICON_SIZE_SMALLER     24
-#define NAUTILUS_ICON_SIZE_SMALL       32
-#define NAUTILUS_ICON_SIZE_STANDARD    48
-#define NAUTILUS_ICON_SIZE_LARGE       72
-#define NAUTILUS_ICON_SIZE_LARGER      96
-#define NAUTILUS_ICON_SIZE_LARGEST     192
+#define NAUTILUS_ICON_SIZE_SMALLEST    64
+#define NAUTILUS_ICON_SIZE_STANDARD    96
+#define NAUTILUS_ICON_SIZE_LARGEST     128
 
 /* Maximum size of an icon that the icon factory will ever produce */
 #define NAUTILUS_ICON_MAXIMUM_SIZE     320
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/libnautilus-private/org.gnome.nautilus.gschema.xml.in 
b/libnautilus-private/org.gnome.nautilus.gschema.xml.in
index ba344a2..1148898 100644
--- a/libnautilus-private/org.gnome.nautilus.gschema.xml.in
+++ b/libnautilus-private/org.gnome.nautilus.gschema.xml.in
@@ -33,12 +33,8 @@
 
   <enum id="org.gnome.nautilus.ZoomLevel">
     <value nick="smallest" value="0"/>
-    <value nick="smaller" value="1"/>
-    <value nick="small" value="2"/>
-    <value nick="standard" value="3"/>
-    <value nick="large" value="4"/>
-    <value nick="larger" value="5"/>
-    <value nick="largest" value="6"/>
+    <value nick="standard" value="1"/>
+    <value nick="largest" value="2"/>
   </enum>
 
   <enum id="org.gnome.nautilus.TabPosition">
@@ -213,7 +209,7 @@
 
   <schema id="org.gnome.nautilus.list-view" path="/org/gnome/nautilus/list-view/" gettext-domain="nautilus">
     <key name="default-zoom-level" enum="org.gnome.nautilus.ZoomLevel">
-      <default>'small'</default>
+      <default>'smallest'</default>
       <_summary>Default list zoom level</_summary>
       <_description>Default zoom level used by the list view.</_description>
     </key>
diff --git a/src/nautilus-bookmarks-window.c b/src/nautilus-bookmarks-window.c
index ad4393b..9a1329c 100644
--- a/src/nautilus-bookmarks-window.c
+++ b/src/nautilus-bookmarks-window.c
@@ -743,7 +743,7 @@ nautilus_bookmarks_window_constructed (GObject *object)
        gtk_tree_view_append_column (self->priv->tree_view,
                                     GTK_TREE_VIEW_COLUMN (col));
        gtk_tree_view_column_set_fixed_width (GTK_TREE_VIEW_COLUMN (col),
-                                             NAUTILUS_ICON_SIZE_SMALLER);
+                                             NAUTILUS_ICON_SIZE_SMALLEST);
 
        rend = gtk_cell_renderer_text_new ();
        g_object_set (rend,
diff --git a/src/nautilus-canvas-view-container.c b/src/nautilus-canvas-view-container.c
index 09e3ce6..77df2f0 100644
--- a/src/nautilus-canvas-view-container.c
+++ b/src/nautilus-canvas-view-container.c
@@ -218,13 +218,9 @@ nautilus_canvas_view_container_get_icon_text_attribute_names (NautilusCanvasCont
        int piece_count;
 
        const int pieces_by_level[] = {
-               0,      /* NAUTILUS_ZOOM_LEVEL_SMALLEST */
-               0,      /* NAUTILUS_ZOOM_LEVEL_SMALLER */
-               0,      /* NAUTILUS_ZOOM_LEVEL_SMALL */
+               1,      /* NAUTILUS_ZOOM_LEVEL_SMALLEST */
                1,      /* NAUTILUS_ZOOM_LEVEL_STANDARD */
-               2,      /* NAUTILUS_ZOOM_LEVEL_LARGE */
-               2,      /* NAUTILUS_ZOOM_LEVEL_LARGER */
-               3       /* NAUTILUS_ZOOM_LEVEL_LARGEST */
+               1       /* NAUTILUS_ZOOM_LEVEL_LARGEST */
        };
 
        piece_count = pieces_by_level[nautilus_canvas_container_get_zoom_level (container)];
@@ -262,14 +258,8 @@ nautilus_canvas_view_container_get_icon_text (NautilusCanvasContainer *container
 
        use_additional = (additional_text != NULL);
 
-       /* In the smallest zoom mode, no text is drawn. */
-       if (nautilus_canvas_container_get_zoom_level (container) == NAUTILUS_ZOOM_LEVEL_SMALLEST &&
-            !include_invisible) {
-               *editable_text = NULL;
-       } else {
-               /* Strip the suffix for nautilus object xml files. */
-               *editable_text = nautilus_file_get_display_name (file);
-       }
+       /* Strip the suffix for nautilus object xml files. */
+       *editable_text = nautilus_file_get_display_name (file);
 
        if (!use_additional) {
                return;
diff --git a/src/nautilus-canvas-view.c b/src/nautilus-canvas-view.c
index c3dad37..99fc75f 100644
--- a/src/nautilus-canvas-view.c
+++ b/src/nautilus-canvas-view.c
@@ -30,6 +30,7 @@
 #include "nautilus-desktop-canvas-view.h"
 #include "nautilus-error-reporting.h"
 #include "nautilus-view-dnd.h"
+#include "nautilus-toolbar.h"
 
 #include <stdlib.h>
 #include <eel/eel-vfs-extensions.h>
@@ -62,6 +63,9 @@
 #include <sys/wait.h>
 #include <unistd.h>
 
+
+static int counter = 0;
+
 enum 
 {
        PROP_SUPPORTS_AUTO_LAYOUT = 1,
@@ -76,7 +80,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 +110,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"
+               "name"
        },
        {
                NAUTILUS_FILE_SORT_BY_SIZE,
                "size",
-               "Sort by Size"
+               "size"
        },
        {
                NAUTILUS_FILE_SORT_BY_TYPE,
                "type",
-               "Sort by Type"
+               "type"
        },
        {
                NAUTILUS_FILE_SORT_BY_MTIME,
                "modification date",
-               "Sort by Modification Date"
+               "modification-date"
        },
        {
                NAUTILUS_FILE_SORT_BY_ATIME,
                "access date",
-               "Sort by Access Date"
+               "access-date"
        },
        {
                NAUTILUS_FILE_SORT_BY_TRASHED_TIME,
                "trashed",
-               NAUTILUS_ACTION_SORT_TRASH_TIME
+               "trash-time"
        },
        {
                NAUTILUS_FILE_SORT_BY_SEARCH_RELEVANCE,
                NULL,
-               NAUTILUS_ACTION_SORT_SEARCH_RELEVANCE,
+               "search-relevance",
        }
 };
 
@@ -171,6 +176,9 @@ static void                 update_layout_menus                       (NautilusC
 static NautilusFileSortType get_default_sort_order                    (NautilusFile         *file,
                                                                       gboolean             *reversed);
 static void                 nautilus_canvas_view_clear                  (NautilusView         *view);
+static void action_keep_aligned (GSimpleAction *action,
+                               GVariant      *state,
+                               gpointer       user_data);
 
 G_DEFINE_TYPE (NautilusCanvasView, nautilus_canvas_view, NAUTILUS_TYPE_VIEW);
 
@@ -331,7 +339,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 +355,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 +492,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_get_window (NAUTILUS_VIEW (view));
 
        action = gtk_action_group_get_action (view->details->canvas_action_group,
                                              NAUTILUS_ACTION_MANUAL_LAYOUT);
@@ -751,9 +706,22 @@ 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;
+       /* Figure out what the new sort setting should be. */
+       for (i = 0; i < G_N_ELEMENTS (gsort_criteria); i++) {
+               if (g_strcmp0 (gsort_criteria[i].action_target_name, action_target_name) == 0) {
+                       return &gsort_criteria[i];
                }
        }
        return NULL;
@@ -765,13 +733,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 +761,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 +802,15 @@ 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 the trash directory or to searching, and then we
+        * need to update the menus */
+       window = nautilus_view_get_window (view);
+
+       nautilus_view_update_right_click_menus(view);
+       nautilus_view_update_toolbar_menus(view);
 }
 
 static void
@@ -902,10 +879,6 @@ nautilus_canvas_view_set_zoom_level (NautilusCanvasView *view,
        nautilus_canvas_container_set_zoom_level (canvas_container, new_level);
 
        g_signal_emit_by_name (view, "zoom-level-changed");
-       
-       if (nautilus_view_get_active (NAUTILUS_VIEW (view))) {
-               nautilus_view_update_menus (NAUTILUS_VIEW (view));
-       }
 }
 
 static void
@@ -933,6 +906,8 @@ nautilus_canvas_view_zoom_to_level (NautilusView *view,
 
        canvas_view = NAUTILUS_CANVAS_VIEW (view);
        nautilus_canvas_view_set_zoom_level (canvas_view, zoom_level, FALSE);
+
+       NAUTILUS_VIEW_CLASS (nautilus_canvas_view_parent_class)->zoom_to_level (view, zoom_level);
 }
 
 static void
@@ -1047,13 +1022,32 @@ action_keep_aligned_callback (GtkAction *action,
 }
 
 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
 switch_to_manual_layout (NautilusCanvasView *canvas_view)
 {
        if (!nautilus_canvas_view_using_auto_layout (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 +1070,6 @@ layout_changed_callback (NautilusCanvasContainer *container,
                         file,
                         nautilus_canvas_view_using_auto_layout (canvas_view));
        }
-
        update_layout_menus (canvas_view);
 }
 
@@ -1103,6 +1096,81 @@ nautilus_canvas_view_start_renaming_file (NautilusView *view,
                (get_canvas_container (NAUTILUS_CANVAS_VIEW (view)), select_all);
 }
 
+static void
+action_sort_order_changed (GSimpleAction *action,
+                       GVariant      *value,
+                       gpointer       user_data)
+{
+       gchar *target_name;
+       const SortCriterion *sort_criterion;
+
+       g_assert (NAUTILUS_IS_CANVAS_VIEW (user_data));
+
+       target_name = g_variant_get_string (value, NULL);
+       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 (user_data);
+       } else {
+               set_sort_criterion (user_data, sort_criterion, TRUE);
+
+               nautilus_canvas_container_sort (get_canvas_container (user_data));
+               nautilus_canvas_view_reveal_selection (NAUTILUS_VIEW (user_data));
+       }
+
+       g_simple_action_set_state (action, value);
+}
+
+static void
+action_keep_aligned (GSimpleAction *action,
+               GVariant      *state,
+               gpointer       user_data)
+{
+       NautilusFile *file;
+       NautilusCanvasView *canvas_view;
+       gboolean keep_aligned;
+
+       canvas_view = NAUTILUS_CANVAS_VIEW (user_data);
+       file = nautilus_view_get_directory_as_file (NAUTILUS_VIEW (canvas_view));
+       keep_aligned = g_variant_get_boolean (state);
+
+       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);
+
+       g_simple_action_set_state (action, state);
+}
+
+static void
+action_reversed_order (GSimpleAction *action,
+                       GVariant      *state,
+                       gpointer       user_data)
+{
+       gboolean reversed_order;
+
+       g_assert (NAUTILUS_IS_CANVAS_VIEW (user_data));
+
+       reversed_order = g_variant_get_boolean (state);
+       if (set_sort_reversed (user_data, reversed_order, TRUE)) {
+               nautilus_canvas_container_sort (get_canvas_container (user_data));
+               nautilus_canvas_view_reveal_selection (NAUTILUS_VIEW (user_data));
+       }
+
+       g_simple_action_set_state (action, state);
+}
+
+const GActionEntry canvas_view_entries[] = {
+       { "keep-aligned", NULL, NULL, "true", action_keep_aligned },
+       { "reversed-order", NULL, NULL, "false", action_reversed_order },
+       { "sort", NULL, "s", "'name'", action_sort_order_changed },
+};
+
 static const GtkToggleActionEntry canvas_view_toggle_entries[] = {
   /* name, stock id */      { "Reversed Order", NULL,
   /* label, accelerator */    N_("Re_versed Order"), NULL,
@@ -1152,6 +1220,81 @@ static const GtkRadioActionEntry arrange_radio_entries[] = {
 };
 
 static void
+nautilus_canvas_view_update_actions_state (NautilusView *view)
+{
+       GActionGroup *view_action_group;
+       NautilusWindow *window;
+       GAction *action;
+       gboolean keep_aligned;  
+       NautilusCanvasView *canvas_view;
+
+       canvas_view = NAUTILUS_CANVAS_VIEW (view);
+       window = nautilus_view_get_window (view);
+
+       NAUTILUS_VIEW_CLASS (nautilus_canvas_view_parent_class)->update_actions_state (view);
+
+       view_action_group = NAUTILUS_VIEW_CLASS(nautilus_canvas_view_parent_class)->get_action_group (view);
+       if (nautilus_canvas_view_supports_auto_layout (canvas_view)) {
+               action = g_action_map_lookup_action (G_ACTION_MAP (view_action_group), "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 (view_action_group), "sort");
+               g_action_change_state (action,
+                                       g_variant_new_string (NAUTILUS_CANVAS_VIEW 
(view)->details->sort->action_target_name));
+       }
+
+       action = g_action_map_lookup_action (G_ACTION_MAP (view_action_group), "keep-aligned");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
+                                    canvas_view->details->supports_keep_aligned);
+       if (canvas_view->details->supports_keep_aligned)
+       {
+               keep_aligned = nautilus_canvas_container_is_keep_aligned (get_canvas_container (canvas_view));
+               g_action_change_state (action, g_variant_new_boolean (keep_aligned));
+       }
+
+       /* Make sure the button is checked on the correct view mode, since this function
+        * could be called for a change in the active slot i.e. when changing the tab */
+       action = G_SIMPLE_ACTION (g_action_map_lookup_action (G_ACTION_MAP (window), "view-mode"));
+       g_simple_action_set_state (G_SIMPLE_ACTION (action), g_variant_new_string ("grid"));
+}
+
+static void
+nautilus_canvas_view_update_right_click_menus (NautilusView *view)
+{
+       NAUTILUS_VIEW_CLASS (nautilus_canvas_view_parent_class)->update_right_click_menus (view);
+}
+
+
+static void
+nautilus_canvas_view_update_toolbar_menus (NautilusView *view)
+{
+       NautilusFile *file;
+       NautilusToolbar *toolbar;
+       NautilusCanvasContainer *canvas_container;
+       NautilusZoomLevel zoom_level;
+
+       NAUTILUS_VIEW_CLASS (nautilus_canvas_view_parent_class)->update_toolbar_menus (view);
+
+       toolbar = NAUTILUS_TOOLBAR (nautilus_window_get_toolbar (nautilus_view_get_window (view)));
+
+       nautilus_toolbar_view_menu_widget_show_element (toolbar, "sort_menu");
+       
+       file = nautilus_view_get_directory_as_file (NAUTILUS_VIEW (view));
+       if (file != NULL && nautilus_file_is_in_trash (file))
+               nautilus_toolbar_view_menu_widget_show_element (toolbar, "sort_trash_time");
+
+       if (file != NULL && nautilus_file_is_in_search (file))
+               nautilus_toolbar_view_menu_widget_show_element (toolbar, "sort_search_relevance");
+
+       canvas_container = get_canvas_container (NAUTILUS_CANVAS_VIEW (view));
+       zoom_level = nautilus_canvas_container_get_zoom_level (canvas_container);
+
+       nautilus_toolbar_view_menu_widget_set_zoom_level (toolbar,
+                                                         (gdouble) (zoom_level));
+}
+
+static void
 nautilus_canvas_view_merge_menus (NautilusView *view)
 {
        NautilusCanvasView *canvas_view;
@@ -1207,7 +1350,7 @@ nautilus_canvas_view_unmerge_menus (NautilusView *view)
 }
 
 static void
-nautilus_canvas_view_update_menus (NautilusView *view)
+nautilus_canvas_view_update_menus_old (NautilusView *view)
 {
        NautilusCanvasView *canvas_view;
        GtkAction *action;
@@ -1215,7 +1358,7 @@ nautilus_canvas_view_update_menus (NautilusView *view)
 
         canvas_view = NAUTILUS_CANVAS_VIEW (view);
 
-       NAUTILUS_VIEW_CLASS (nautilus_canvas_view_parent_class)->update_menus(view);
+       NAUTILUS_VIEW_CLASS (nautilus_canvas_view_parent_class)->update_right_click_menus(view);
 
        editable = nautilus_view_is_editable (view);
        action = gtk_action_group_get_action (canvas_view->details->canvas_action_group,
@@ -1510,7 +1653,7 @@ nautilus_canvas_view_react_to_canvas_change_idle_callback (gpointer data)
        /* Rebuild the menus since some of them (e.g. Restore Stretched Icons)
         * may be different now.
         */
-       nautilus_view_update_menus (NAUTILUS_VIEW (canvas_view));
+       nautilus_canvas_view_update_right_click_menus (NAUTILUS_VIEW (canvas_view));
 
         /* Don't call this again (unless rescheduled) */
         return FALSE;
@@ -1869,13 +2012,6 @@ create_canvas_container (NautilusCanvasView *canvas_view)
                                 G_CALLBACK (icon_rename_started_cb), canvas_view, 0);
        g_signal_connect_object (canvas_container, "icon-rename-ended",
                                 G_CALLBACK (icon_rename_ended_cb), canvas_view, 0);
-       g_signal_connect_object (canvas_container, "icon-stretch-started",
-                                G_CALLBACK (nautilus_view_update_menus), canvas_view,
-                                G_CONNECT_SWAPPED);
-       g_signal_connect_object (canvas_container, "icon-stretch-ended",
-                                G_CALLBACK (nautilus_view_update_menus), canvas_view,
-                                G_CONNECT_SWAPPED);
-
        g_signal_connect_object (canvas_container, "get-stored-layout-timestamp",
                                 G_CALLBACK (get_stored_layout_timestamp), canvas_view, 0);
        g_signal_connect_object (canvas_container, "store-layout-timestamp",
@@ -2077,10 +2213,12 @@ 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_right_click_menus = nautilus_canvas_view_update_right_click_menus;
+       nautilus_view_class->update_toolbar_menus = nautilus_canvas_view_update_toolbar_menus;
+       nautilus_view_class->update_actions_state = nautilus_canvas_view_update_actions_state;
         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;
-        nautilus_view_class->update_menus = nautilus_canvas_view_update_menus;
        nautilus_view_class->using_manual_layout = nautilus_canvas_view_using_manual_layout;
        nautilus_view_class->widget_to_file_operation_position = 
nautilus_canvas_view_widget_to_file_operation_position;
        nautilus_view_class->get_view_id = nautilus_canvas_view_get_id;
@@ -2124,10 +2262,15 @@ nautilus_canvas_view_init (NautilusCanvasView *canvas_view)
 {
        NautilusCanvasContainer *canvas_container;
 
+       GtkBuilder *builder;
+       GMenuModel *menu;
+       GActionGroup *view_action_group;
+       GAction *action;
+
         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);
 
@@ -2164,6 +2307,12 @@ nautilus_canvas_view_init (NautilusCanvasView *canvas_view)
                g_signal_connect (nautilus_clipboard_monitor_get (),
                                  "clipboard-info",
                                  G_CALLBACK (canvas_view_notify_clipboard_info), canvas_view);
+
+       view_action_group = NAUTILUS_VIEW_CLASS(nautilus_canvas_view_parent_class)->get_action_group 
(NAUTILUS_VIEW (canvas_view));
+       g_action_map_add_action_entries (G_ACTION_MAP (view_action_group),
+                                       canvas_view_entries,
+                                       G_N_ELEMENTS (canvas_view_entries),
+                                       canvas_view);
 }
 
 NautilusView *
diff --git a/src/nautilus-desktop-canvas-view.c b/src/nautilus-desktop-canvas-view.c
index c6971f5..72679e7 100644
--- a/src/nautilus-desktop-canvas-view.c
+++ b/src/nautilus-desktop-canvas-view.c
@@ -77,7 +77,7 @@ struct NautilusDesktopCanvasViewDetails
 
 static void     default_zoom_level_changed                        (gpointer                user_data);
 static void     real_merge_menus                                  (NautilusView        *view);
-static void     real_update_menus                                 (NautilusView        *view);
+static void     real_update_right_click_menus                                 (NautilusView        *view);
 static void     nautilus_desktop_canvas_view_update_canvas_container_fonts  (NautilusDesktopCanvasView      
*view);
 static void     font_changed_callback                             (gpointer                callback_data);
 
@@ -263,7 +263,7 @@ nautilus_desktop_canvas_view_dispose (GObject *object)
                                              font_changed_callback,
                                              canvas_view);
        g_signal_handlers_disconnect_by_func (gnome_lockdown_preferences,
-                                             nautilus_view_update_menus,
+                                             nautilus_view_update_right_click_menus,
                                              canvas_view);
 
        G_OBJECT_CLASS (nautilus_desktop_canvas_view_parent_class)->dispose (object);
@@ -279,7 +279,7 @@ nautilus_desktop_canvas_view_class_init (NautilusDesktopCanvasViewClass *class)
        G_OBJECT_CLASS (class)->dispose = nautilus_desktop_canvas_view_dispose;
 
        vclass->merge_menus = real_merge_menus;
-       vclass->update_menus = real_update_menus;
+       vclass->update_right_click_menus = real_update_right_click_menus;
        vclass->get_view_id = real_get_id;
 
        g_type_class_add_private (class, sizeof (NautilusDesktopCanvasViewDetails));
@@ -517,7 +517,7 @@ nautilus_desktop_canvas_view_init (NautilusDesktopCanvasView *desktop_canvas_vie
 
        g_signal_connect_swapped (gnome_lockdown_preferences,
                                  "changed::" NAUTILUS_PREFERENCES_LOCKDOWN_COMMAND_LINE,
-                                 G_CALLBACK (nautilus_view_update_menus),
+                                 G_CALLBACK (nautilus_view_update_right_click_menus),
                                  desktop_canvas_view);
 }
 
@@ -638,23 +638,96 @@ trash_link_is_selection (NautilusView *view)
 }
 
 static void
-real_update_menus (NautilusView *view)
+action_change_background (GSimpleAction *action,
+                       GVariant      *state,
+                       gpointer       user_data)
+{
+       const gchar *control_center_cmd, *params;
+
+        g_assert (NAUTILUS_VIEW (user_data));
+
+       control_center_cmd = get_control_center_command (&params);
+       if (control_center_cmd == NULL) {
+               return;
+       }
+
+       nautilus_launch_application_from_command (gtk_widget_get_screen (GTK_WIDGET (user_data)),
+                                                 control_center_cmd,
+                                                 FALSE,
+                                                 params, NULL);
+}
+
+static void
+action_empty_trash_conditional (GSimpleAction *action,
+                               GVariant      *state,
+                               gpointer       user_data)
+{
+        g_assert (NAUTILUS_IS_VIEW (user_data));
+
+       nautilus_file_operations_empty_trash (GTK_WIDGET (user_data));
+}
+
+static void
+action_organize_desktop_by_name (GSimpleAction *action,
+               GVariant       *state,
+               gpointer       user_data)
+{
+       nautilus_canvas_view_clean_up_by_name (NAUTILUS_CANVAS_VIEW (user_data));
+}
+
+const GActionEntry gdesktop_view_entries[] = {
+       { "empty-trash-conditional", action_empty_trash_conditional },
+       { "change-background", action_change_background },
+       { "organize-desktop-by-name", action_organize_desktop_by_name },
+};
+
+static void
+real_update_right_click_menus (NautilusView *view)
 {
        NautilusDesktopCanvasView *desktop_view;
         NautilusCanvasContainer *canvas_container;
        gboolean include_empty_trash;
        char *label;
-       GtkAction *action;
+       GSimpleAction *action;
         int selection_count;
+        GActionGroup *view_action_group;
 
        g_assert (NAUTILUS_IS_DESKTOP_CANVAS_VIEW (view));
 
-       NAUTILUS_VIEW_CLASS (nautilus_desktop_canvas_view_parent_class)->update_menus (view);
+       g_print ("------------------------------------DESKTOP UPDATING MENUS\n");
+
+       NAUTILUS_VIEW_CLASS (nautilus_desktop_canvas_view_parent_class)->update_right_click_menus (view);
 
        desktop_view = NAUTILUS_DESKTOP_CANVAS_VIEW (view);
+       view_action_group = NAUTILUS_VIEW_CLASS (nautilus_desktop_canvas_view_parent_class)->get_action_group 
(view);
+
+       g_action_map_add_action_entries (G_ACTION_MAP (view_action_group),
+                               gdesktop_view_entries,
+                               G_N_ELEMENTS (gdesktop_view_entries),
+                               view);
+
+       action = g_action_map_lookup_action (G_ACTION_MAP (view_action_group), "keep-aligned");
+       g_simple_action_set_enabled (action, TRUE);
+
+       action = g_action_map_lookup_action (G_ACTION_MAP (view_action_group), "organize-desktop-by-name");
+       g_simple_action_set_enabled (action, TRUE);
+
+       action = g_action_map_lookup_action (G_ACTION_MAP (view_action_group), "change-background");
+       g_simple_action_set_enabled (action, TRUE);
+
+
+
+
+
+
+
+
+
+
+
 
        /* Empty Trash */
-       include_empty_trash = trash_link_is_selection (view);
+/*     include_empty_trash = trash_link_is_selection (view);
        action = gtk_action_group_get_action (desktop_view->details->desktop_action_group,
                                              NAUTILUS_ACTION_EMPTY_TRASH_CONDITIONAL);
        gtk_action_set_visible (action,
@@ -668,7 +741,7 @@ real_update_menus (NautilusView *view)
        }
 
        /* Stretch */
-        selection_count = nautilus_view_get_selection_count (view);
+/*        selection_count = nautilus_view_get_selection_count (view);
         canvas_container = get_canvas_container (desktop_view);
 
        action = gtk_action_group_get_action (desktop_view->details->desktop_action_group,
@@ -680,7 +753,7 @@ real_update_menus (NautilusView *view)
        gtk_action_set_visible (action, TRUE);
 
        /* Unstretch */
-       action = gtk_action_group_get_action (desktop_view->details->desktop_action_group,
+/*     action = gtk_action_group_get_action (desktop_view->details->desktop_action_group,
                                              NAUTILUS_ACTION_UNSTRETCH);
        g_object_set (action, "label",
                      (selection_count > 1)
@@ -690,7 +763,7 @@ real_update_menus (NautilusView *view)
        gtk_action_set_sensitive (action,
                                  canvas_container != NULL
                                  && nautilus_canvas_container_is_stretched (canvas_container));
-       gtk_action_set_visible (action, TRUE);
+       gtk_action_set_visible (action, TRUE);*/
 }
 
 static const GtkActionEntry desktop_view_entries[] = {
diff --git a/src/nautilus-list-model.c b/src/nautilus-list-model.c
index 7da5150..a681cfa 100644
--- a/src/nautilus-list-model.c
+++ b/src/nautilus-list-model.c
@@ -1252,16 +1252,8 @@ nautilus_list_model_get_zoom_level_from_column_id (int column)
        switch (column) {
        case NAUTILUS_LIST_MODEL_SMALLEST_ICON_COLUMN:
                return NAUTILUS_ZOOM_LEVEL_SMALLEST;
-       case NAUTILUS_LIST_MODEL_SMALLER_ICON_COLUMN:
-               return NAUTILUS_ZOOM_LEVEL_SMALLER;
-       case NAUTILUS_LIST_MODEL_SMALL_ICON_COLUMN:
-               return NAUTILUS_ZOOM_LEVEL_SMALL;
        case NAUTILUS_LIST_MODEL_STANDARD_ICON_COLUMN:
                return NAUTILUS_ZOOM_LEVEL_STANDARD;
-       case NAUTILUS_LIST_MODEL_LARGE_ICON_COLUMN:
-               return NAUTILUS_ZOOM_LEVEL_LARGE;
-       case NAUTILUS_LIST_MODEL_LARGER_ICON_COLUMN:
-               return NAUTILUS_ZOOM_LEVEL_LARGER;
        case NAUTILUS_LIST_MODEL_LARGEST_ICON_COLUMN:
                return NAUTILUS_ZOOM_LEVEL_LARGEST;
        }
@@ -1275,16 +1267,8 @@ nautilus_list_model_get_column_id_from_zoom_level (NautilusZoomLevel zoom_level)
        switch (zoom_level) {
        case NAUTILUS_ZOOM_LEVEL_SMALLEST:
                return NAUTILUS_LIST_MODEL_SMALLEST_ICON_COLUMN;
-       case NAUTILUS_ZOOM_LEVEL_SMALLER:
-               return NAUTILUS_LIST_MODEL_SMALLER_ICON_COLUMN;
-       case NAUTILUS_ZOOM_LEVEL_SMALL:
-               return NAUTILUS_LIST_MODEL_SMALL_ICON_COLUMN;
        case NAUTILUS_ZOOM_LEVEL_STANDARD:
                return NAUTILUS_LIST_MODEL_STANDARD_ICON_COLUMN;
-       case NAUTILUS_ZOOM_LEVEL_LARGE:
-               return NAUTILUS_LIST_MODEL_LARGE_ICON_COLUMN;
-       case NAUTILUS_ZOOM_LEVEL_LARGER:
-               return NAUTILUS_LIST_MODEL_LARGER_ICON_COLUMN;
        case NAUTILUS_ZOOM_LEVEL_LARGEST:
                return NAUTILUS_LIST_MODEL_LARGEST_ICON_COLUMN;
        }
diff --git a/src/nautilus-list-view.c b/src/nautilus-list-view.c
index b361734..e9204db 100644
--- a/src/nautilus-list-view.c
+++ b/src/nautilus-list-view.c
@@ -30,6 +30,7 @@
 #include "nautilus-list-model.h"
 #include "nautilus-error-reporting.h"
 #include "nautilus-view-dnd.h"
+#include "nautilus-toolbar.h"
 
 #include <string.h>
 #include <eel/eel-vfs-extensions.h>
@@ -2310,7 +2311,7 @@ get_default_zoom_level (void) {
 
        if (default_zoom_level <  NAUTILUS_ZOOM_LEVEL_SMALLEST
            || NAUTILUS_ZOOM_LEVEL_LARGEST < default_zoom_level) {
-               default_zoom_level = NAUTILUS_ZOOM_LEVEL_SMALL;
+               default_zoom_level = NAUTILUS_ZOOM_LEVEL_SMALLEST;
        }
 
        return default_zoom_level;
@@ -3068,7 +3069,7 @@ nautilus_list_view_unmerge_menus (NautilusView *view)
 }
 
 static void
-nautilus_list_view_update_menus (NautilusView *view)
+nautilus_list_view_update_right_click_menus (NautilusView *view)
 {
        NautilusListView *list_view;
 
@@ -3079,9 +3080,45 @@ nautilus_list_view_update_menus (NautilusView *view)
                return;
        }
 
-       NAUTILUS_VIEW_CLASS (nautilus_list_view_parent_class)->update_menus (view);
+       NAUTILUS_VIEW_CLASS (nautilus_list_view_parent_class)->update_right_click_menus (view);
 }
 
+static void
+nautilus_list_view_update_actions_state (NautilusView *view)
+{
+       NautilusWindow *window;
+       GSimpleAction *action;
+
+       NAUTILUS_VIEW_CLASS (nautilus_list_view_parent_class)->update_actions_state (view);
+
+       window = nautilus_view_get_window (view);
+       /* Make sure the button is checked on the correct view mode, since this function
+        * could be called for a change in the active slot i.e. when changing the tab */
+       action = G_SIMPLE_ACTION (g_action_map_lookup_action (G_ACTION_MAP (window), "view-mode"));
+       g_simple_action_set_state (action, g_variant_new_string ("list"));
+}
+
+static void
+nautilus_list_view_update_toolbar_menus (NautilusView *view)
+{
+       NautilusListView *list_view;
+       NautilusToolbar *toolbar;
+
+        list_view = NAUTILUS_LIST_VIEW (view);
+
+       /* don't update if the menus aren't ready */
+       if (!list_view->details->menus_ready) {
+               return;
+       }
+
+       NAUTILUS_VIEW_CLASS (nautilus_list_view_parent_class)->update_toolbar_menus (view);
+
+       toolbar = NAUTILUS_TOOLBAR (nautilus_window_get_toolbar (nautilus_view_get_window (view)));
+       nautilus_toolbar_view_menu_widget_set_zoom_level (toolbar,
+                                                         (gdouble) list_view->details->zoom_level);
+}
+
+
 /* Reset sort criteria and zoom level to match defaults */
 static void
 nautilus_list_view_reset_to_defaults (NautilusView *view)
@@ -3145,10 +3182,25 @@ nautilus_list_view_set_zoom_level (NautilusListView *view,
                                             GTK_CELL_RENDERER (view->details->pixbuf_cell),
                                             "surface", column,
                                             NULL);
+       set_up_pixbuf_size (view);
 
-       nautilus_view_update_menus (NAUTILUS_VIEW (view));
+       /* Zoom level changed, notify the toolbar zoom widget about it */
+       //nautilus_view_update_toolbar_menus (NAUTILUS_VIEW (view));
+}
 
-       set_up_pixbuf_size (view);
+static void
+nautilus_list_view_zoom_to_level (NautilusView *view,
+                                 NautilusZoomLevel zoom_level)
+{
+       NautilusListView *list_view;
+
+       g_return_if_fail (NAUTILUS_IS_LIST_VIEW (view));
+
+       list_view = NAUTILUS_LIST_VIEW (view);
+
+       nautilus_list_view_set_zoom_level (list_view, zoom_level, FALSE);
+
+       NAUTILUS_VIEW_CLASS (nautilus_list_view_parent_class)->zoom_to_level (view, zoom_level);
 }
 
 static void
@@ -3164,7 +3216,7 @@ nautilus_list_view_bump_zoom_level (NautilusView *view, int zoom_increment)
 
        if (new_level >= NAUTILUS_ZOOM_LEVEL_SMALLEST &&
            new_level <= NAUTILUS_ZOOM_LEVEL_LARGEST) {
-               nautilus_list_view_set_zoom_level (list_view, new_level, FALSE);
+               nautilus_list_view_zoom_to_level (view, new_level);
        }
 }
 
@@ -3181,19 +3233,6 @@ nautilus_list_view_get_zoom_level (NautilusView *view)
 }
 
 static void
-nautilus_list_view_zoom_to_level (NautilusView *view,
-                                 NautilusZoomLevel zoom_level)
-{
-       NautilusListView *list_view;
-
-       g_return_if_fail (NAUTILUS_IS_LIST_VIEW (view));
-
-       list_view = NAUTILUS_LIST_VIEW (view);
-
-       nautilus_list_view_set_zoom_level (list_view, zoom_level, FALSE);
-}
-
-static void
 nautilus_list_view_restore_default_zoom_level (NautilusView *view)
 {
        NautilusListView *list_view;
@@ -3600,7 +3639,9 @@ nautilus_list_view_class_init (NautilusListViewClass *class)
        nautilus_view_class->remove_file = nautilus_list_view_remove_file;
        nautilus_view_class->merge_menus = nautilus_list_view_merge_menus;
        nautilus_view_class->unmerge_menus = nautilus_list_view_unmerge_menus;
-       nautilus_view_class->update_menus = nautilus_list_view_update_menus;
+       nautilus_view_class->update_right_click_menus = nautilus_list_view_update_right_click_menus;
+       nautilus_view_class->update_toolbar_menus = nautilus_list_view_update_toolbar_menus;
+       nautilus_view_class->update_actions_state = nautilus_list_view_update_actions_state;
        nautilus_view_class->reset_to_defaults = nautilus_list_view_reset_to_defaults;
        nautilus_view_class->restore_default_zoom_level = nautilus_list_view_restore_default_zoom_level;
        nautilus_view_class->reveal_selection = nautilus_list_view_reveal_selection;
diff --git a/src/nautilus-main-menus.xml b/src/nautilus-main-menus.xml
new file mode 100644
index 0000000..6ed6a66
--- /dev/null
+++ b/src/nautilus-main-menus.xml
@@ -0,0 +1,117 @@
+<?xml version="1.0"?>
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <menu id="action-menu">
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">New Folder</attribute>
+        <attribute name="action">view.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">view.undo</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">Redo</attribute>
+        <attribute name="action">view.redo</attribute>
+      </item>
+    </section>
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">Select All</attribute>
+        <attribute name="action">view.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>
+  <menu id="background-menu">
+    <section>
+      <attribute name="id">templates-menu</attribute>
+    </section>
+    <item>
+      <attribute name="label" translatable="yes">New Folder</attribute>
+      <attribute name="action">view.new-folder</attribute>
+    </item>
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">Paste</attribute>
+        <attribute name="action">view.paste</attribute>
+      </item>
+    </section>
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">Mount Volume</attribute>
+        <attribute name="action">view.mount-volume</attribute>
+        <attribute name="hidden-when">action-disabled</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">Unmount Volume</attribute>
+        <attribute name="action">view.unmount-volume</attribute>
+        <attribute name="hidden-when">action-disabled</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">Eject Volume</attribute>
+        <attribute name="action">view.eject-volume</attribute>
+        <attribute name="hidden-when">action-disabled</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">Stop Volume</attribute>
+        <attribute name="action">view.stop-volume</attribute>
+        <attribute name="hidden-when">action-disabled</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">Poll</attribute>
+        <attribute name="action">view.poll</attribute>
+        <attribute name="hidden-when">action-disabled</attribute>
+      </item>
+    </section>
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">Select All</attribute>
+        <attribute name="action">view.select-all</attribute>
+      </item>
+    </section>
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">Properties</attribute>
+        <attribute name="action">view.properties</attribute>
+      </item>
+    </section>
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">Keep aligned</attribute>
+        <attribute name="action">view.keep-aligned</attribute>
+        <attribute name="hidden-when">action-disabled</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">Organize Desktop by Name</attribute>
+        <attribute name="action">view.organize-desktop-by-name</attribute>
+        <attribute name="hidden-when">action-disabled</attribute>
+      </item>
+    </section>
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">Change Background</attribute>
+        <attribute name="action">view.change-background</attribute>
+        <attribute name="hidden-when">action-disabled</attribute>
+      </item>
+    </section>
+  </menu>
+  <menu id="selection-menu">
+  </menu>
+</interface>
\ No newline at end of file
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-view-menu.xml b/src/nautilus-toolbar-view-menu.xml
new file mode 100644
index 0000000..38af5aa
--- /dev/null
+++ b/src/nautilus-toolbar-view-menu.xml
@@ -0,0 +1,207 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <object class ="GtkPopoverMenu" id="view_menu_widget">
+    <child>
+      <object class="GtkBox">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="border_width">9</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">6</property>
+        <property name="width_request">200</property>
+        <child>
+          <object class="GtkBox" id="views_box">
+            <property name="visible">True</property>
+            <property name="orientation">horizontal</property>
+            <style>
+                <class name="linked"/>
+            </style>
+            <child>
+              <object class="GtkModelButton" id="grid_button">
+                <property name="visible">True</property>
+                <property name="text">Grid</property>
+                <property name="action-name">win.view-mode</property>
+                <property name="action-target">'grid'</property>
+                <property name="iconic">True</property>
+                <property name="centered">True</property>
+                <property name="icon">icon_grid</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkModelButton" id="list_button">
+                <property name="visible">True</property>
+                <property name="text">List</property>
+                <property name="action-name">win.view-mode</property>
+                <property name="action-target">'list'</property>
+                <property name="iconic">True</property>
+                <property name="centered">True</property>
+                <property name="icon">icon_list</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+        </child>
+        <child>
+          <object class="GtkScale" id="zoom_level_scale">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="draw_value">False</property>
+            <property name="has_origin">False</property>
+            <property name="adjustment">zoom_adjustment</property>
+            <property name="round_digits">0</property>
+            <property name="restrict_to_fill_level">False</property>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkBox" id="sort_menu">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="orientation">vertical</property>
+            <child>
+              <object class="GtkSeparator">
+                <property name="visible">True</property>
+                <property name="orientation">horizontal</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkLabel" id="sort_label">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="halign">start</property>
+                <property name="label" translatable="yes">Sort</property>
+                <style>
+                  <class name="separator"/>
+                </style>
+              </object>
+            </child>
+            <child>
+              <object class="GtkModelButton" id="sort_name">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="text" translatable="yes">Name</property>
+                <property name="action-name">view.sort</property>
+                <property name="action-target">'name'</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkModelButton" id="sort_size">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="text" translatable="yes">Size</property>
+                <property name="action-name">view.sort</property>
+                <property name="action-target">'size'</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkModelButton" id="sort_type">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="text" translatable="yes">Type</property>
+                <property name="action-name">view.sort</property>
+                <property name="action-target">'type'</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkModelButton" id="sort_modification_date">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="text" translatable="yes">Modification Date</property>
+                <property name="action-name">view.sort</property>
+                <property name="action-target">'modification-date'</property>
+              </object>
+            </child>
+              <child>
+              <object class="GtkModelButton" id="sort_access_date">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="text" translatable="yes">Access Date</property>
+                <property name="action-name">view.sort</property>
+                <property name="action-target">'access-date'</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkModelButton" id="sort_trash_time">
+                <property name="visible">False</property>
+                <property name="can_focus">True</property>
+                <property name="text" translatable="yes">Trash Time</property>
+                <property name="action-name">view.sort</property>
+                <property name="action-target">'trash-time'</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkModelButton" id="sort_search_relevance">
+                <property name="visible">False</property>
+                <property name="can_focus">True</property>
+                <property name="text" translatable="yes">Search Relevance</property>
+                <property name="action-name">view.sort</property>
+                <property name="action-target">'search-relevance'</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkSeparator">
+                <property name="visible">True</property>
+                <property name="orientation">horizontal</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkModelButton" id="reversed_order">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="text" translatable="yes">Reverse order</property>
+                <property name="action-name">view.reversed-order</property>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child>
+          <object class="GtkSeparator">
+            <property name="visible">True</property>
+            <property name="orientation">horizontal</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkModelButton" id="show_hidden_files">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="text" translatable="yes">Show Hidden Files</property>
+            <property name="action-name">view.show-hidden-files</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkModelButton" id="reload">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="text" translatable="yes">Reload</property>
+            <property name="action-name">win.reload</property>
+          </object>
+        </child>
+      </object>
+    </child>
+  </object>
+  <object class="GThemedIcon" id="icon_grid">
+    <property name="name">view-grid-symbolic</property>
+  </object>
+  <object class="GThemedIcon" id="icon_list">
+    <property name="name">view-list-symbolic</property>
+  </object>
+  <object class="GtkAdjustment" id="zoom_adjustment">
+    <property name="lower">0</property>
+    <property name="upper">2</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">1</property>
+    <property name="value">1</property>
+  </object>
+</interface>
\ No newline at end of file
diff --git a/src/nautilus-toolbar.c b/src/nautilus-toolbar.c
index 642f524..603f5fe 100644
--- a/src/nautilus-toolbar.c
+++ b/src/nautilus-toolbar.c
@@ -42,15 +42,28 @@ 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;
+
+       gdouble scale_zoom_level;
+       gboolean skip_next_zoom_change;
+
+       GtkWidget *view_button;
+       GtkWidget *action_button;
+
+       GtkWidget *view_menu_widget;
+       GtkAdjustment *zoom_adjustment;
+       GtkWidget *zoom_level_scale;
+       GMenu *action_menu;
 };
 
 enum {
@@ -61,9 +74,14 @@ 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);
+static gboolean show_widget_recursive (GtkWidget *widget,
+                               gchar *id);
+
+static gboolean hide_widget_recursive (GtkWidget *widget,
+                               gchar *id);
 
 static void
 toolbar_update_appearance (NautilusToolbar *self)
@@ -145,6 +163,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,
@@ -377,107 +414,81 @@ gear_menu_key_press (GtkWidget *widget,
         return FALSE;
 }
 
-static void
-nautilus_toolbar_constructed (GObject *obj)
+static gint
+transform_zoom_level_for_ui (gint zoom_level)
 {
-       NautilusToolbar *self = NAUTILUS_TOOLBAR (obj);
-       GtkWidget *toolbar;
-       GtkWidget *button;
-       GtkWidget *menu;
-       GtkWidget *box;
-       GtkUIManager *ui_manager;
+       return (gint) floor (zoom_level / 2);
+}
 
-       G_OBJECT_CLASS (nautilus_toolbar_parent_class)->constructed (obj);
+static gint
+transform_zoom_level_for_backend (gint zoom_level)
+{
+       return zoom_level * 2;
+}
 
-       toolbar = GTK_WIDGET (obj);
+static void
+zoom_level_changed (GtkRange *range,
+                   NautilusToolbar *self)
+{
+       NautilusWindowSlot *slot;
+       NautilusView *view;
+       gdouble zoom_level;
+       GActionGroup *view_action_group;
+       GAction *action;
+       gint transformed_level;
 
-       ui_manager = nautilus_window_get_ui_manager (self->priv->window);
+       zoom_level = gtk_range_get_value (range);
+       slot = nautilus_window_get_active_slot (self->priv->window);
+       view = nautilus_window_slot_get_current_view (slot);
 
-       /* Back and Forward */
-       box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+       view_action_group = nautilus_view_get_action_group (view);
 
-       /* 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);
+       zoom_level = gtk_range_get_value (range);
 
-       /* 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);
+       action = g_action_map_lookup_action (G_ACTION_MAP (view_action_group), "zoom-to-level");
+       g_action_change_state (action,
+                              g_variant_new_int32 ((gint) zoom_level));
+}
 
-       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);
+static void
+nautilus_toolbar_init (NautilusToolbar *self)
+{
+       GtkBuilder *builder;
+       GMenu *action_menu;
 
-       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);
+       gtk_container_add (GTK_CONTAINER (self->priv->location_entry_container),
+                                         self->priv->location_entry);
+
+       builder = gtk_builder_new_from_resource ("/org/gnome/nautilus/nautilus-toolbar-view-menu.xml");
+       self->priv->view_menu_widget = g_object_ref (GTK_WIDGET (gtk_builder_get_object (builder, 
"view_menu_widget")));
+       self->priv->zoom_level_scale = g_object_ref (GTK_WIDGET (gtk_builder_get_object (builder, 
"zoom_level_scale")));
+       self->priv->zoom_adjustment = g_object_ref (GTK_ADJUSTMENT (gtk_builder_get_object (builder, 
"zoom_adjustment")));
+       gtk_menu_button_set_popover (GTK_MENU_BUTTON (self->priv->view_button),
+                                    self->priv->view_menu_widget);
+       g_object_unref (builder);
+
+       builder = gtk_builder_new_from_resource ("/org/gnome/nautilus/nautilus-main-menus.xml");
+       action_menu = g_object_ref (G_MENU (gtk_builder_get_object (builder, "action-menu")));
+       gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (self->priv->action_button),
+                                       G_MENU_MODEL (action_menu));
+       g_object_unref (builder);
+
+       g_signal_connect(self->priv->zoom_level_scale, "value-changed",
+                        G_CALLBACK(zoom_level_changed),
+                        self);
+
+       gtk_widget_show_all (GTK_WIDGET (self));
        toolbar_update_appearance (self);
-}
 
-static void
-nautilus_toolbar_init (NautilusToolbar *self)
-{
-       self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, NAUTILUS_TYPE_TOOLBAR,
-                                                 NautilusToolbarPriv);
+       self->priv->skip_next_zoom_change = FALSE;
 }
 
 static void
@@ -535,11 +546,12 @@ 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;
-       oclass->constructed = nautilus_toolbar_constructed;
        oclass->dispose = nautilus_toolbar_dispose;
 
        properties[PROP_WINDOW] =
@@ -556,8 +568,109 @@ 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);
+}
+
+static gboolean
+hide_widget_recursive (GtkWidget *widget,
+               gchar *id)
+{
+       GList *children;
+       GList *child;
+       GtkWidget *widget_child;
+       gboolean found = FALSE;
+
+       if (g_strcmp0 (gtk_buildable_get_name (GTK_BUILDABLE (widget)), id) == 0)
+       {
+               gtk_widget_hide (widget);
+               return TRUE;
+       }
+
+       if (GTK_IS_CONTAINER (widget))
+       {
+               children = gtk_container_get_children (GTK_CONTAINER (widget));
+               for (child = children; child != NULL && !found; child = child->next)
+               {
+                       found = hide_widget_recursive (child->data, id);
+               }
+       }
+
+       return found;
+}
+
+void
+nautilus_toolbar_reset_menus (NautilusToolbar *self)
+{
+       NautilusWindowSlot *slot;
+       NautilusView *view;
+       GActionGroup *view_action_group;
+
+       /* Map view actions to the view menu and action menu */
+       slot = nautilus_window_get_active_slot (self->priv->window);
+       view = nautilus_window_slot_get_current_view (slot);
+       view_action_group = nautilus_view_get_action_group (view);
+       gtk_widget_insert_action_group (GTK_WIDGET (self),
+                                       "view",
+                                       G_ACTION_GROUP (view_action_group));
+       //gtk_widget_show_all (self->priv->view_menu_widget);
+       hide_widget_recursive (GTK_WIDGET (self->priv->view_menu_widget), "sort_menu");
+       hide_widget_recursive (GTK_WIDGET (self->priv->view_menu_widget), "sort_trash_time");
+       hide_widget_recursive (GTK_WIDGET (self->priv->view_menu_widget), "sort_search_relevance");
+}
+
+void
+nautilus_toolbar_view_menu_widget_show_element (NautilusToolbar *self,
+                               gchar *id)
+{
+       g_assert (NAUTILUS_IS_TOOLBAR (self));
+
+       show_widget_recursive (GTK_WIDGET (self->priv->view_menu_widget), id);
+}
+
+static gboolean
+show_widget_recursive (GtkWidget *widget,
+               gchar *id)
+{
+       GList *children;
+       GList *child;
+       GtkWidget *widget_child;
+       gboolean found = FALSE;
+
+       if (g_strcmp0 (gtk_buildable_get_name (GTK_BUILDABLE (widget)), id) == 0)
+       {
+               gtk_widget_show (widget);
+               return TRUE;
+       }
+
+       if (GTK_IS_CONTAINER (widget))
+       {
+               children = gtk_container_get_children (GTK_CONTAINER (widget));
+               for (child = children; child != NULL && !found; child = child->next)
+               {
+                       found = show_widget_recursive (child->data, id);
+               }
+       }
+
+       return found;
+}
+
+void nautilus_toolbar_view_menu_widget_set_zoom_level (NautilusToolbar *self,
+                                               gdouble level)
+{
+       gint transformed_level;
+
+       g_assert (NAUTILUS_IS_TOOLBAR (self));
+
+       gtk_adjustment_set_value (GTK_ADJUSTMENT (self->priv->zoom_adjustment),
+                                 level);
 }
 
 GtkWidget *
diff --git a/src/nautilus-toolbar.h b/src/nautilus-toolbar.h
index 2a8d2dd..ad6616f 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,12 @@ 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_reset_menus (NautilusToolbar *self);
+
+void nautilus_toolbar_sync_navigation_buttons (NautilusToolbar *self);
+void nautilus_toolbar_view_menu_widget_show_element (NautilusToolbar *self,
+                                               gchar *id);
+void nautilus_toolbar_view_menu_widget_set_zoom_level (NautilusToolbar *self,
+                                               gdouble level);
+
 #endif /* __NAUTILUS_TOOLBAR_H__ */
diff --git a/src/nautilus-view-right-click-menus.xml b/src/nautilus-view-right-click-menus.xml
new file mode 100755
index 0000000..116aa30
--- /dev/null
+++ b/src/nautilus-view-right-click-menus.xml
@@ -0,0 +1,103 @@
+<?xml version="1.0"?>
+<interface>
+  <menu id="background-menu">
+    <section>
+      <attribute name="id">templates-menu</attribute>
+    </section>
+    <item>
+      <attribute name="label" translatable="yes">New Folder</attribute>
+      <attribute name="action">view.new-folder</attribute>
+    </item>
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">Paste</attribute>
+        <attribute name="action">view.paste</attribute>
+      </item>
+    </section>
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">Mount Volume</attribute>
+        <attribute name="action">view.mount-volume</attribute>
+        <attribute name="hidden-when">action-disabled</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">Unmount Volume</attribute>
+        <attribute name="action">view.unmount-volume</attribute>
+        <attribute name="hidden-when">action-disabled</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">Eject Volume</attribute>
+        <attribute name="action">view.eject-volume</attribute>
+        <attribute name="hidden-when">action-disabled</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">Stop Volume</attribute>
+        <attribute name="action">view.stop-volume</attribute>
+        <attribute name="hidden-when">action-disabled</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">Poll</attribute>
+        <attribute name="action">view.poll</attribute>
+        <attribute name="hidden-when">action-disabled</attribute>
+      </item>
+    </section>
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">Select All</attribute>
+        <attribute name="action">view.select-all</attribute>
+      </item>
+    </section>
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">Properties</attribute>
+        <attribute name="action">view.properties</attribute>
+      </item>
+    </section>
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">Keep aligned</attribute>
+        <attribute name="action">view.keep-aligned</attribute>
+        <attribute name="hidden-when">action-disabled</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">Organize Desktop by Name</attribute>
+        <attribute name="action">view.organize-desktop-by-name</attribute>
+        <attribute name="hidden-when">action-disabled</attribute>
+      </item>
+    </section>
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">Change Background</attribute>
+        <attribute name="action">view.change-background</attribute>
+        <attribute name="hidden-when">action-disabled</attribute>
+      </item>
+    </section>
+  </menu>
+  <menu id="selection-menu">
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">Open Item Location</attribute>
+        <attribute name="action">view.open-item-location</attribute>
+        <attribute name="hidden-when">action-disabled</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">Open</attribute>
+        <attribute name="action">view.open-item</attribute>
+        <attribute name="hidden-when">action-disabled</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">Open In New Window</attribute>
+        <attribute name="action">view.open-item-new-window</attribute>
+        <attribute name="hidden-when">action-disabled</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">Open In New Tab</attribute>
+        <attribute name="action">view.open-item-new-tab</attribute>
+        <attribute name="hidden-when">action-disabled</attribute>
+      </item>
+    </section>
+    <section>
+
+    </section>
+  </menu>
+</interface>
\ No newline at end of file
diff --git a/src/nautilus-view.c b/src/nautilus-view.c
old mode 100644
new mode 100755
index 17d5d49..120c81d
--- a/src/nautilus-view.c
+++ b/src/nautilus-view.c
@@ -36,6 +36,8 @@
 #include "nautilus-mime-actions.h"
 #include "nautilus-previewer.h"
 #include "nautilus-properties-window.h"
+#include "nautilus-window.h"
+#include "nautilus-toolbar.h"
 
 #if ENABLE_EMPTY_VIEW
 #include "nautilus-empty-view.h"
@@ -188,7 +190,7 @@ struct NautilusViewDetails
        guint extensions_menu_merge_id;
        
        guint display_selection_idle_id;
-       guint update_menus_timeout_id;
+       guint update_right_click_menus_timeout_id;
        guint update_status_idle_id;
        guint reveal_selection_idle_id;
 
@@ -259,6 +261,11 @@ struct NautilusViewDetails
        GList *subdirectory_list;
 
        GdkPoint context_menu_position;
+
+       GMenu *selection_menu;
+       GMenu *background_menu;
+
+       GActionGroup *view_action_group;
 };
 
 typedef struct {
@@ -280,14 +287,12 @@ 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,
                                                                gpointer              callback_data);
-static void     schedule_update_menus                          (NautilusView      *view);
-static void     remove_update_menus_timeout_callback           (NautilusView      *view);
+static void     schedule_update_right_click_menus                          (NautilusView      *view);
+static void     remove_update_right_click_menus_timeout_callback           (NautilusView      *view);
 static void     schedule_update_status                          (NautilusView      *view);
 static void     remove_update_status_idle_callback             (NautilusView *view); 
 static void     reset_update_interval                          (NautilusView      *view);
@@ -311,6 +316,36 @@ static gboolean file_list_all_are_folders                      (GList *file_list
 
 static void unschedule_pop_up_location_context_menu (NautilusView *view);
 
+static void action_new_folder (GSimpleAction *action,
+                               GVariant      *state,
+                               gpointer       user_data);
+static void action_new_tab (GSimpleAction *action,
+                               GVariant      *state,
+                               gpointer       user_data);
+static void action_undo (GSimpleAction *action,
+                               GVariant      *state,
+                               gpointer       user_data);
+static void action_redo (GSimpleAction *action,
+                               GVariant      *state,
+                               gpointer       user_data);
+static void action_select_all (GSimpleAction *action,
+                               GVariant      *state,
+                               gpointer       user_data);
+static void action_zoom_in (GSimpleAction *action,
+                               GVariant      *state,
+                               gpointer       user_data);
+static void action_zoom_out (GSimpleAction *action,
+                               GVariant      *state,
+                               gpointer       user_data);
+static void action_zoom_normal (GSimpleAction *action,
+                               GVariant      *state,
+                               gpointer       user_data);
+static void action_show_hidden_files (GSimpleAction *action,
+                               GVariant      *state,
+                               gpointer       user_data);
+static void real_zoom_to_level (NautilusView *view,
+                               NautilusZoomLevel *zoom_level);
+
 G_DEFINE_TYPE (NautilusView, nautilus_view, GTK_TYPE_SCROLLED_WINDOW);
 
 /* virtual methods (public and non-public) */
@@ -334,7 +369,8 @@ nautilus_view_unmerge_menus (NautilusView *view)
 {
        g_return_if_fail (NAUTILUS_IS_VIEW (view));
 
-       NAUTILUS_VIEW_CLASS (G_OBJECT_GET_CLASS (view))->unmerge_menus (view);}
+       NAUTILUS_VIEW_CLASS (G_OBJECT_GET_CLASS (view))->unmerge_menus (view);
+}
 
 static char *
 real_get_backing_uri (NautilusView *view)
@@ -576,6 +612,13 @@ nautilus_view_bump_zoom_level (NautilusView *view,
        NAUTILUS_VIEW_CLASS (G_OBJECT_GET_CLASS (view))->bump_zoom_level (view, zoom_increment);
 }
 
+static void
+real_zoom_to_level (NautilusView *view,
+               NautilusZoomLevel *zoom_level)
+{
+       nautilus_view_update_toolbar_menus (view);
+}
+
 /**
  * nautilus_view_zoom_to_level:
  *
@@ -715,13 +758,13 @@ nautilus_view_get_selection (NautilusView *view)
 }
 
 /**
- * nautilus_view_update_menus:
+ * nautilus_view_update_right_click_menus:
  * 
  * Update the sensitivity and wording of dynamic menu items.
  * @view: NautilusView in question.
  */
 void
-nautilus_view_update_menus (NautilusView *view)
+nautilus_view_update_right_click_menus_old (NautilusView *view)
 {
        g_return_if_fail (NAUTILUS_IS_VIEW (view));
 
@@ -729,7 +772,7 @@ nautilus_view_update_menus (NautilusView *view)
                return;
        }
 
-       NAUTILUS_VIEW_CLASS (G_OBJECT_GET_CLASS (view))->update_menus (view);
+       NAUTILUS_VIEW_CLASS (G_OBJECT_GET_CLASS (view))->update_right_click_menus (view);
 }
 
 typedef struct {
@@ -902,7 +945,7 @@ create_templates_parameters_free (CreateTemplateParameters *parameters)
        g_free (parameters);
 }                            
 
-static NautilusWindow *
+NautilusWindow *
 nautilus_view_get_window (NautilusView  *view)
 {
        return nautilus_window_slot_get_window (view->details->slot);
@@ -1075,6 +1118,8 @@ nautilus_view_activate_file (NautilusView *view,
        g_free (path);
 }
 
+/********* ACTIONS *********/
+
 static void
 action_open_callback (GtkAction *action,
                      gpointer callback_data)
@@ -1086,6 +1131,17 @@ action_open_callback (GtkAction *action,
 }
 
 static void
+action_open_item (GSimpleAction *action,
+               GVariant      *state,
+               gpointer       user_data)
+{
+       NautilusView *view;
+
+       view = NAUTILUS_VIEW (user_data);
+       nautilus_view_activate_selection (view);
+}
+
+static void
 action_open_close_parent_callback (GtkAction *action,
                                   gpointer callback_data)
 {
@@ -1132,6 +1188,36 @@ action_open_item_location_callback (GtkAction *action,
        nautilus_file_list_free (selection);
 }
 
+static void
+action_open_item_location (GSimpleAction *action,
+                       GVariant      *state,
+                       gpointer       user_data)
+{
+       NautilusView *view;
+       GList *selection;
+       NautilusFile *item;
+       GFile *activation_location;
+       NautilusFile *activation_file;
+       NautilusFile *location;
+
+       view = NAUTILUS_VIEW (user_data);
+       selection = nautilus_view_get_selection (view);
+
+       if (!selection)
+               return;
+
+       item = NAUTILUS_FILE (selection->data);
+       activation_location = nautilus_file_get_activation_location (item);
+       activation_file = nautilus_file_get (activation_location);
+       location = nautilus_file_get_parent (activation_file);
+
+       nautilus_view_activate_file (view, location, 0);
+
+       nautilus_file_unref (location);
+       nautilus_file_unref (activation_file);
+       g_object_unref (activation_location);
+       nautilus_file_list_free (selection);
+}
 
 static void
 action_open_alternate_callback (GtkAction *action,
@@ -1177,6 +1263,30 @@ action_open_new_tab_callback (GtkAction *action,
 }
 
 static void
+action_open_item_new_tab (GSimpleAction *action,
+                       GVariant      *state,
+                       gpointer       user_data)
+{
+       NautilusView *view;
+       GList *selection;
+       GtkWindow *window;
+
+       view = NAUTILUS_VIEW (user_data);
+       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);
+}
+
+static void
 app_chooser_dialog_response_cb (GtkDialog *dialog,
                                gint response_id,
                                gpointer user_data)
@@ -1400,6 +1510,20 @@ action_select_all_callback (GtkAction *action,
 }
 
 static void
+action_select_all (GSimpleAction *action,
+               GVariant      *state,
+               gpointer       user_data)
+{
+       NautilusView *view;
+
+       g_assert (NAUTILUS_IS_VIEW (user_data));
+
+       view = NAUTILUS_VIEW (user_data);
+
+       nautilus_view_select_all (view);
+}
+
+static void
 action_invert_selection_callback (GtkAction *action,
                                  gpointer callback_data)
 {
@@ -1537,7 +1661,7 @@ action_save_search_callback (GtkAction *action,
                nautilus_search_directory_save_search (search);
 
                /* Save search is disabled */
-               schedule_update_menus (directory_view);
+               schedule_update_right_click_menus (directory_view);
        }
 }
 
@@ -2086,6 +2210,16 @@ action_new_folder_callback (GtkAction *action,
 }
 
 static void
+action_new_folder (GSimpleAction *action,
+               GVariant      *state,
+               gpointer       user_data)
+{
+       g_assert (NAUTILUS_IS_VIEW (user_data));
+
+       nautilus_view_new_folder (NAUTILUS_VIEW (user_data), FALSE);
+}
+
+static void
 action_new_folder_with_selection_callback (GtkAction *action,
                                           gpointer callback_data)
 {                
@@ -2170,6 +2304,22 @@ all_selected_items_in_trash (GList *selection)
 }
 
 static void
+nautilus_view_set_show_hidden_files (NautilusView *view,
+                                    gboolean show_hidden)
+{
+       if (view->details->ignore_hidden_file_preferences) {
+               return;
+       }
+
+       if (show_hidden != view->details->show_hidden_files) {
+               view->details->show_hidden_files = show_hidden;
+               if (view->details->model != NULL) {
+                       load_directory (view, view->details->model);
+               }
+       }
+}
+
+static void
 action_show_hidden_files_callback (GtkAction *action,
                                   gpointer callback_data)
 {
@@ -2182,6 +2332,262 @@ action_show_hidden_files_callback (GtkAction *action,
 }
 
 static void
+action_show_hidden_files (GSimpleAction *action,
+                       GVariant      *state,
+                       gpointer       user_data)
+{
+       gboolean show_hidden;
+       NautilusView *view;
+
+       g_assert (NAUTILUS_IS_VIEW (user_data));
+
+       view = NAUTILUS_VIEW (user_data);
+       show_hidden = g_variant_get_boolean (state);
+
+       nautilus_view_set_show_hidden_files (view, show_hidden);
+
+       g_simple_action_set_state (action, state);
+}
+
+static void
+action_new_tab (GSimpleAction *action,
+               GVariant      *state,
+               gpointer       user_data)
+{
+       GList *selection;
+       GtkWindow *window;
+
+       g_assert (NAUTILUS_IS_VIEW (user_data));
+
+
+       selection = nautilus_view_get_selection (user_data);
+
+       window = nautilus_view_get_containing_window (user_data);
+
+       if (nautilus_view_confirm_multiple (window, g_list_length (selection), TRUE)) {
+               nautilus_view_activate_files (user_data,
+                                             selection,
+                                             NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB,
+                                             FALSE);
+       }
+
+       nautilus_file_list_free (selection);
+}
+
+static void
+action_undo (GSimpleAction *action,
+               GVariant      *state,
+               gpointer       user_data)
+{
+       GtkWidget *toplevel;
+       NautilusView *view;
+
+       g_assert (NAUTILUS_IS_VIEW (user_data));
+
+       view = NAUTILUS_VIEW (user_data);
+       toplevel = gtk_widget_get_toplevel (GTK_WIDGET (view));
+       nautilus_file_undo_manager_undo (GTK_WINDOW (toplevel));
+}
+
+static void
+action_redo (GSimpleAction *action,
+               GVariant      *state,
+               gpointer       user_data)
+{
+       GtkWidget *toplevel;
+       NautilusView *view;
+
+       g_assert (NAUTILUS_IS_VIEW (user_data));
+
+       view = NAUTILUS_VIEW (user_data);
+       toplevel = gtk_widget_get_toplevel (GTK_WIDGET (view));
+       nautilus_file_undo_manager_redo (GTK_WINDOW (toplevel));
+}
+
+static void
+action_zoom_in (GSimpleAction *action,
+               GVariant      *state,
+               gpointer       user_data) 
+{
+       NautilusView *view;
+
+       g_assert (NAUTILUS_IS_VIEW (user_data));
+
+       view = NAUTILUS_VIEW (user_data);
+
+       nautilus_view_bump_zoom_level (view, 1);
+}
+
+static void
+action_zoom_out (GSimpleAction *action,
+               GVariant      *state,
+               gpointer       user_data) 
+{
+       NautilusView *view;
+
+       g_assert (NAUTILUS_IS_VIEW (user_data));
+
+       view = NAUTILUS_VIEW (user_data);
+
+       nautilus_view_bump_zoom_level (view, -1);
+}
+
+static void
+action_zoom_normal (GSimpleAction *action,
+               GVariant      *state,
+               gpointer       user_data) 
+{
+       NautilusView *view;
+
+       g_assert (NAUTILUS_IS_VIEW (user_data));
+
+       view = NAUTILUS_VIEW (user_data);
+
+       nautilus_view_restore_default_zoom_level (view);
+}
+
+static void
+action_zoom_to_level (GSimpleAction *action,
+               GVariant      *state,
+               gpointer       user_data)
+{
+       NautilusView *view;
+       gdouble zoom_value;
+
+       g_assert (NAUTILUS_IS_VIEW (user_data));
+
+       view = NAUTILUS_VIEW (user_data);
+       zoom_value = g_variant_get_int32 (state);
+
+       nautilus_view_zoom_to_level (view, zoom_value);
+}
+
+
+static void
+action_location_open_alternate_callback (GtkAction *action,
+                                        gpointer   callback_data)
+{
+       NautilusView *view;
+       NautilusFile *file;
+
+       view = NAUTILUS_VIEW (callback_data);
+
+       file = view->details->location_popup_directory_as_file;
+       if (file == NULL) {
+               return;
+       }
+       nautilus_view_activate_file (view,
+                                    file,
+                                    NAUTILUS_WINDOW_OPEN_FLAG_NEW_WINDOW);
+}
+
+static void
+action_open_item_new_window (GSimpleAction *action,
+                       GVariant      *state,
+                       gpointer       user_data)
+{
+       NautilusView *view;
+       GList *selection;
+       GtkWindow *window;
+
+       view = NAUTILUS_VIEW (user_data);
+       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_WINDOW,
+                                             FALSE);
+       }
+
+       nautilus_file_list_free (selection);
+}
+
+static void
+paste_clipboard_data (NautilusView *view,
+                     GtkSelectionData *selection_data,
+                     char *destination_uri)
+{
+       gboolean cut;
+       GList *item_uris;
+
+       cut = FALSE;
+       item_uris = nautilus_clipboard_get_uri_list_from_selection_data (selection_data, &cut,
+                                                                        copied_files_atom);
+
+       if (item_uris != NULL && destination_uri != NULL) {
+               nautilus_view_move_copy_items (view, item_uris, NULL, destination_uri,
+                                              cut ? GDK_ACTION_MOVE : GDK_ACTION_COPY,
+                                              0, 0);
+
+               /* If items are cut then remove from clipboard */
+               if (cut) {
+                       gtk_clipboard_clear (nautilus_clipboard_get (GTK_WIDGET (view)));
+               }
+
+               g_list_free_full (item_uris, g_free);
+       }
+}
+
+static void
+paste_clipboard_received_callback (GtkClipboard     *clipboard,
+                                  GtkSelectionData *selection_data,
+                                  gpointer          data)
+{
+       NautilusView *view;
+       char *view_uri;
+
+       view = NAUTILUS_VIEW (data);
+
+       view_uri = nautilus_view_get_backing_uri (view);
+
+       if (view->details->slot != NULL) {
+               paste_clipboard_data (view, selection_data, view_uri);
+       }
+
+       g_free (view_uri);
+
+       g_object_unref (view);
+}
+
+static void
+action_paste_files_callback (GtkAction *action,
+                            gpointer callback_data)
+{
+       NautilusView *view;
+
+       view = NAUTILUS_VIEW (callback_data);
+
+       g_object_ref (view);
+       gtk_clipboard_request_contents (nautilus_clipboard_get (GTK_WIDGET (view)),
+                                       copied_files_atom,
+                                       paste_clipboard_received_callback,
+                                       view);
+}
+
+static void
+action_paste_files (GSimpleAction *action,
+               GVariant      *state,
+               gpointer       user_data)
+{
+       NautilusView *view;
+
+       g_assert (NAUTILUS_IS_VIEW (user_data));
+
+       view = NAUTILUS_VIEW (user_data);
+
+       g_object_ref (view);
+       gtk_clipboard_request_contents (nautilus_clipboard_get (GTK_WIDGET (view)),
+                                       copied_files_atom,
+                                       paste_clipboard_received_callback,
+                                       view);
+}
+
+/*************** END ACTIONS **********************/
+
+static void
 click_policy_changed_callback (gpointer callback_data)
 {
        NautilusView *view;
@@ -2310,7 +2716,7 @@ scripts_added_or_changed_callback (NautilusDirectory *directory,
 
        view->details->scripts_invalid = TRUE;
        if (view->details->active) {
-               schedule_update_menus (view);
+               schedule_update_right_click_menus (view);
        }
 }
 
@@ -2325,7 +2731,7 @@ templates_added_or_changed_callback (NautilusDirectory *directory,
 
        view->details->templates_invalid = TRUE;
        if (view->details->active) {
-               schedule_update_menus (view);
+               schedule_update_right_click_menus (view);
        }
 }
 
@@ -2422,8 +2828,14 @@ slot_active (NautilusWindowSlot *slot,
 
        view->details->active = TRUE;
 
+       g_print ("slot active\n");
+
        nautilus_view_merge_menus (view);
-       schedule_update_menus (view);
+
+       nautilus_view_update_right_click_menus(view);
+       nautilus_view_update_toolbar_menus (view);
+
+       schedule_update_right_click_menus (view);
 }
 
 static void
@@ -2434,10 +2846,11 @@ slot_inactive (NautilusWindowSlot *slot,
                return;
        }
 
+       g_print ("slot inactive\n");
        view->details->active = FALSE;
 
        nautilus_view_unmerge_menus (view);
-       remove_update_menus_timeout_callback (view);
+       remove_update_right_click_menus_timeout_callback (view);
 }
 
 void
@@ -2599,104 +3012,10 @@ have_bulk_rename_tool ()
 }
 
 static void
-nautilus_view_init (NautilusView *view)
-{
-       AtkObject *atk_object;
-       NautilusDirectory *scripts_directory;
-       NautilusDirectory *templates_directory;
-       char *templates_uri;
-
-       nautilus_profile_start (NULL);
-
-       view->details = G_TYPE_INSTANCE_GET_PRIVATE (view, NAUTILUS_TYPE_VIEW,
-                                                    NautilusViewDetails);
-
-       /* Default to true; desktop-icon-view sets to false */
-       view->details->show_foreign_files = TRUE;
-
-       view->details->non_ready_files =
-               g_hash_table_new_full (file_and_directory_hash,
-                                      file_and_directory_equal,
-                                      (GDestroyNotify)file_and_directory_free,
-                                      NULL);
-
-       gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (view),
-                                       GTK_POLICY_AUTOMATIC,
-                                       GTK_POLICY_AUTOMATIC);
-       gtk_scrolled_window_set_hadjustment (GTK_SCROLLED_WINDOW (view), NULL);
-       gtk_scrolled_window_set_vadjustment (GTK_SCROLLED_WINDOW (view), NULL);
-
-       gtk_style_context_set_junction_sides (gtk_widget_get_style_context (GTK_WIDGET (view)),
-                                             GTK_JUNCTION_TOP | GTK_JUNCTION_LEFT);
-
-       if (set_up_scripts_directory_global ()) {
-               scripts_directory = nautilus_directory_get_by_uri (scripts_directory_uri);
-               add_directory_to_scripts_directory_list (view, scripts_directory);
-               nautilus_directory_unref (scripts_directory);
-       } else {
-               g_warning ("Ignoring scripts directory, it may be a broken link\n");
-       }
-
-       if (nautilus_should_use_templates_directory ()) {
-               templates_uri = nautilus_get_templates_directory_uri ();
-               templates_directory = nautilus_directory_get_by_uri (templates_uri);
-               g_free (templates_uri);
-               add_directory_to_templates_directory_list (view, templates_directory);
-               nautilus_directory_unref (templates_directory);
-       }
-       update_templates_directory (view);
-
-       view->details->sort_directories_first =
-               g_settings_get_boolean (nautilus_preferences, NAUTILUS_PREFERENCES_SORT_DIRECTORIES_FIRST);
-       view->details->show_hidden_files =
-               g_settings_get_boolean (gtk_filechooser_preferences, NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES);
-
-       g_signal_connect_object (nautilus_trash_monitor_get (), "trash-state-changed",
-                                G_CALLBACK (nautilus_view_trash_state_changed_callback), view, 0);
-
-       /* React to clipboard changes */
-       g_signal_connect_object (nautilus_clipboard_monitor_get (), "clipboard-changed",
-                                G_CALLBACK (clipboard_changed_callback), view, 0);
-
-       /* Register to menu provider extension signal managing menu updates */
-       g_signal_connect_object (nautilus_signaller_get_current (), "popup-menu-changed",
-                                G_CALLBACK (schedule_update_menus), view, G_CONNECT_SWAPPED);
-
-       gtk_widget_show (GTK_WIDGET (view));
-
-       g_signal_connect_swapped (nautilus_preferences,
-                                 "changed::" NAUTILUS_PREFERENCES_ENABLE_DELETE,
-                                 G_CALLBACK (schedule_update_menus), view);
-       g_signal_connect_swapped (nautilus_preferences,
-                                 "changed::" NAUTILUS_PREFERENCES_CLICK_POLICY,
-                                 G_CALLBACK (click_policy_changed_callback),
-                                 view);
-       g_signal_connect_swapped (nautilus_preferences,
-                                 "changed::" NAUTILUS_PREFERENCES_SORT_DIRECTORIES_FIRST, 
-                                 G_CALLBACK (sort_directories_first_changed_callback), view);
-       g_signal_connect_swapped (gtk_filechooser_preferences,
-                                 "changed::" NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES, 
-                                 G_CALLBACK (show_hidden_files_changed_callback), view);
-       g_signal_connect_swapped (gnome_lockdown_preferences,
-                                 "changed::" NAUTILUS_PREFERENCES_LOCKDOWN_COMMAND_LINE,
-                                 G_CALLBACK (schedule_update_menus), view);
-
-       g_signal_connect_object (nautilus_file_undo_manager_get (), "undo-changed",
-                                G_CALLBACK (undo_manager_changed_cb), view, 0);
-
-       /* Accessibility */
-       atk_object = gtk_widget_get_accessible (GTK_WIDGET (view));
-       atk_object_set_name (atk_object, _("Content View"));
-       atk_object_set_description (atk_object, _("View of the current folder"));
-
-       nautilus_profile_end (NULL);
-}
-
-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;
@@ -2747,7 +3066,7 @@ nautilus_view_destroy (GtkWidget *object)
                                                   view->details->subdirectory_list->data);
        }
 
-       remove_update_menus_timeout_callback (view);
+       remove_update_right_click_menus_timeout_callback (view);
        remove_update_status_idle_callback (view);
 
        if (view->details->display_selection_idle_id != 0) {
@@ -2789,7 +3108,7 @@ nautilus_view_finalize (GObject *object)
        view = NAUTILUS_VIEW (object);
 
        g_signal_handlers_disconnect_by_func (nautilus_preferences,
-                                             schedule_update_menus, view);
+                                             schedule_update_right_click_menus, view);
        g_signal_handlers_disconnect_by_func (nautilus_preferences,
                                              click_policy_changed_callback, view);
        g_signal_handlers_disconnect_by_func (nautilus_preferences,
@@ -2800,7 +3119,7 @@ nautilus_view_finalize (GObject *object)
                                              nautilus_view_display_selection_info, view);
 
        g_signal_handlers_disconnect_by_func (gnome_lockdown_preferences,
-                                             schedule_update_menus, view);
+                                             schedule_update_right_click_menus, view);
 
        unschedule_pop_up_location_context_menu (view);
        if (view->details->location_popup_event != NULL) {
@@ -3042,7 +3361,8 @@ done_loading (NautilusView *view,
         * is no NautilusWindow any more.
         */
        if (window != NULL) {
-               schedule_update_menus (view);
+               g_print ("done_loading\n");
+               schedule_update_right_click_menus (view);
                schedule_update_status (view);
                reset_update_interval (view);
 
@@ -3294,7 +3614,7 @@ copy_move_done_callback (GHashTable *debuting_files,
                                               G_CONNECT_AFTER);
                }
                /* Schedule menu update for undo items */
-               schedule_update_menus (directory_view);
+               schedule_update_right_click_menus (directory_view);
        }
 
        copy_move_done_data_free (copy_move_done_data);
@@ -3555,27 +3875,25 @@ display_selection_info_idle_callback (gpointer data)
 }
 
 static void
-remove_update_menus_timeout_callback (NautilusView *view) 
+remove_update_right_click_menus_timeout_callback (NautilusView *view) 
 {
-       if (view->details->update_menus_timeout_id != 0) {
-               g_source_remove (view->details->update_menus_timeout_id);
-               view->details->update_menus_timeout_id = 0;
+       if (view->details->update_right_click_menus_timeout_id != 0) {
+               g_source_remove (view->details->update_right_click_menus_timeout_id);
+               view->details->update_right_click_menus_timeout_id = 0;
        }
 }
 
 static void
-update_menus_if_pending (NautilusView *view)
+update_right_click_menus_if_pending (NautilusView *view)
 {
-       if (view->details->update_menus_timeout_id == 0) {
-               return;
-       }
+       remove_update_right_click_menus_timeout_callback (view);
+       g_print ("update_menus if pending \n");
 
-       remove_update_menus_timeout_callback (view);
-       nautilus_view_update_menus (view);
+       nautilus_view_update_right_click_menus(view);
 }
 
 static gboolean
-update_menus_timeout_callback (gpointer data)
+update_right_click_menus_timeout_callback (gpointer data)
 {
        NautilusView *view;
 
@@ -3583,8 +3901,9 @@ update_menus_timeout_callback (gpointer data)
 
        g_object_ref (G_OBJECT (view));
 
-       view->details->update_menus_timeout_id = 0;
-       nautilus_view_update_menus (view);
+       view->details->update_right_click_menus_timeout_id = 0;
+       g_print("update_menus_timeout_callback\n");
+       nautilus_view_update_right_click_menus(view);
 
        g_object_unref (G_OBJECT (view));
 
@@ -3806,7 +4125,7 @@ files_changed_callback (NautilusDirectory *directory,
        /* A change in MIME type could affect the Open with menu, for
         * one thing, so we need to update menus when files change.
         */
-       schedule_update_menus (view);
+       schedule_update_right_click_menus (view);
 }
 
 static void
@@ -4381,7 +4700,7 @@ get_x_content_async_callback (const char **content,
        view = NAUTILUS_VIEW (user_data);
 
        if (view->details->slot != NULL) {
-               schedule_update_menus (view);
+               schedule_update_right_click_menus (view);
        }
        g_object_unref (view);
 }
@@ -6046,53 +6365,6 @@ action_move_to_callback (GtkAction *action,
        copy_or_move_selection (view, TRUE);
 }
 
-static void
-paste_clipboard_data (NautilusView *view,
-                     GtkSelectionData *selection_data,
-                     char *destination_uri)
-{
-       gboolean cut;
-       GList *item_uris;
-
-       cut = FALSE;
-       item_uris = nautilus_clipboard_get_uri_list_from_selection_data (selection_data, &cut,
-                                                                        copied_files_atom);
-
-       if (item_uris != NULL && destination_uri != NULL) {
-               nautilus_view_move_copy_items (view, item_uris, NULL, destination_uri,
-                                              cut ? GDK_ACTION_MOVE : GDK_ACTION_COPY,
-                                              0, 0);
-
-               /* If items are cut then remove from clipboard */
-               if (cut) {
-                       gtk_clipboard_clear (nautilus_clipboard_get (GTK_WIDGET (view)));
-               }
-
-               g_list_free_full (item_uris, g_free);
-       }
-}
-
-static void
-paste_clipboard_received_callback (GtkClipboard     *clipboard,
-                                  GtkSelectionData *selection_data,
-                                  gpointer          data)
-{
-       NautilusView *view;
-       char *view_uri;
-
-       view = NAUTILUS_VIEW (data);
-
-       view_uri = nautilus_view_get_backing_uri (view);
-
-       if (view->details->slot != NULL) {
-               paste_clipboard_data (view, selection_data, view_uri);
-       }
-
-       g_free (view_uri);
-
-       g_object_unref (view);
-}
-
 typedef struct {
        NautilusView *view;
        NautilusFile *target;
@@ -6125,21 +6397,6 @@ paste_into_clipboard_received_callback (GtkClipboard     *clipboard,
 }
 
 static void
-action_paste_files_callback (GtkAction *action,
-                            gpointer callback_data)
-{
-       NautilusView *view;
-
-       view = NAUTILUS_VIEW (callback_data);
-
-       g_object_ref (view);
-       gtk_clipboard_request_contents (nautilus_clipboard_get (GTK_WIDGET (view)),
-                                       copied_files_atom,
-                                       paste_clipboard_received_callback,
-                                       view);
-}
-
-static void
 paste_into (NautilusView *view,
            NautilusFile *target)
 {
@@ -6909,24 +7166,6 @@ action_location_detect_media_callback (GtkAction *action,
 }
 
 static void
-action_location_open_alternate_callback (GtkAction *action,
-                                        gpointer   callback_data)
-{
-       NautilusView *view;
-       NautilusFile *file;
-
-       view = NAUTILUS_VIEW (callback_data);
-
-       file = view->details->location_popup_directory_as_file;
-       if (file == NULL) {
-               return;
-       }
-       nautilus_view_activate_file (view,
-                                    file,
-                                    NAUTILUS_WINDOW_OPEN_FLAG_NEW_WINDOW);
-}
-
-static void
 action_location_open_in_new_tab_callback (GtkAction *action,
                                          gpointer   callback_data)
 {
@@ -7063,21 +7302,23 @@ nautilus_view_get_show_hidden_files (NautilusView *view)
        return view->details->show_hidden_files;
 }
 
-static void
-nautilus_view_set_show_hidden_files (NautilusView *view,
-                                    gboolean show_hidden)
-{
-       if (view->details->ignore_hidden_file_preferences) {
-               return;
-       }
-
-       if (show_hidden != view->details->show_hidden_files) {
-               view->details->show_hidden_files = show_hidden;
-               if (view->details->model != NULL) {
-                       load_directory (view, view->details->model);
-               }
-       }
-}
+const GActionEntry view_entries[] = {
+       { "new-folder", action_new_folder },
+       { "select-all", action_select_all },
+       { "paste", action_paste_files },
+       { "zoom-in",  action_zoom_in },
+       { "zoom-out", action_zoom_out },
+       { "zoom-to-level", NULL, NULL, "1", action_zoom_to_level },
+       { "zoom-normal", action_zoom_normal },
+       { "undo", action_undo },
+       { "redo", action_redo },
+       { "show-hidden-files", NULL, NULL, "true", action_show_hidden_files },
+       /* Selection menu */
+       { "open-item-location", action_open_item_location },
+       { "open-item", action_open_item },
+       { "open-item-new-window", action_open_item_new_window },
+       { "open-item-new-tab", action_open_item_new_tab },
+};
 
 static const GtkActionEntry directory_view_entries[] = {
   /* name, stock id, label */  { NAUTILUS_ACTION_NEW_DOCUMENTS, "document-new", N_("New _Document") },
@@ -7396,6 +7637,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");
@@ -8364,7 +8607,7 @@ can_trash_all (GList *files)
 }
 
 static void
-real_update_menus (NautilusView *view)
+real_update_menus_old (NautilusView *view)
 {
        GList *selection, *l;
        gint selection_count;
@@ -8762,6 +9005,148 @@ real_update_menus (NautilusView *view)
        gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), view->details->show_hidden_files);
 }
 
+GActionGroup *
+nautilus_view_get_action_group (NautilusView *view)
+{
+       g_assert (NAUTILUS_IS_VIEW (view));
+
+       return view->details->view_action_group;
+}
+
+static void
+real_update_actions_state (NautilusView *view)
+{
+       GActionGroup *view_action_group;
+
+       view_action_group = view->details->view_action_group;
+
+       GAction *action = g_action_map_lookup_action (G_ACTION_MAP (view_action_group),
+                                                     "show-hidden-files");
+
+       g_action_change_state (action,
+                               g_variant_new_boolean (view->details->show_hidden_files));
+}
+
+/* Convenience function to be called when updating menus,
+ * so children can subclass it and it will be called when
+ * they chain up to the parent in update_right_click_menus
+ * or update_toolbar_menus
+ */
+void
+nautilus_view_update_actions_state (NautilusView *view)
+{
+       g_assert(NAUTILUS_IS_VIEW (view));
+
+       NAUTILUS_VIEW_CLASS (G_OBJECT_GET_CLASS (view))->update_actions_state (view);
+}
+
+static void
+update_background_menu (NautilusView *view)
+{
+
+}
+
+static void
+update_selection_menu (NautilusView *view)
+{
+       
+}
+
+static void
+real_update_right_click_menus (NautilusView *view)
+{
+       g_print ("view real_update_right_click_menus\n");
+       if (view->details->background_menu != NULL)
+               g_object_unref (view->details->background_menu);
+       if (view->details->selection_menu != NULL)
+               g_object_unref (view->details->selection_menu);
+       
+       GtkBuilder *builder;
+       builder = gtk_builder_new_from_resource ("/org/gnome/nautilus/nautilus-view-right-click-menus.xml");
+       view->details->background_menu = g_object_ref (G_MENU (gtk_builder_get_object (builder, 
"background-menu")));
+       view->details->selection_menu = g_object_ref (G_MENU (gtk_builder_get_object (builder, 
"selection-menu")));
+       g_object_unref (builder);
+
+       update_background_menu (view);
+       update_selection_menu (view);
+       nautilus_view_update_actions_state (view);
+}
+
+/* Convenience function to reset the menus owned
+ * by the view and update them with the current state.
+ * Children can subclass it and add items on the menu
+ * after chaining up to the parent, so menus are already
+ * reseted.
+ * It will also update the actions state, which will also
+ * update children actions state if the children subclass
+ * nautilus_view_update_actions_state
+ */
+void
+nautilus_view_update_right_click_menus (NautilusView *view)
+{
+       g_assert(NAUTILUS_IS_VIEW (view));
+
+       NAUTILUS_VIEW_CLASS (G_OBJECT_GET_CLASS (view))->update_right_click_menus (view);
+}
+
+static void
+real_update_toolbar_menus (NautilusView *view)
+{
+       NautilusToolbar *toolbar;
+
+       toolbar = nautilus_window_get_toolbar (nautilus_view_get_window (view));
+       nautilus_toolbar_reset_menus (toolbar);
+       nautilus_view_update_actions_state (view);
+}
+
+void
+nautilus_view_update_toolbar_menus (NautilusView *view)
+{
+       g_assert(NAUTILUS_IS_VIEW (view));
+
+       NAUTILUS_VIEW_CLASS (G_OBJECT_GET_CLASS (view))->update_toolbar_menus (view);
+}
+
+
+static void 
+create_right_click_menu (NautilusView *view,
+               GMenu *menu,
+               GdkEventButton *event)
+{
+       GtkWidget *gtk_menu;
+
+       int button;
+
+       g_return_if_fail (G_IS_MENU (menu));
+
+       gtk_menu = gtk_menu_new_from_model (G_MENU_MODEL (menu));
+       gtk_menu_attach_to_widget (GTK_MENU (gtk_menu), GTK_WIDGET (view), NULL);
+       /* The event button needs to be 0 if we're popping up this menu from
+        * a button release, else a 2nd click outside the menu with any button
+        * other than the one that invoked the menu will be ignored (instead
+        * of dismissing the menu). This is a subtle fragility of the GTK menu code.
+        */
+       if (event) {
+               button = event->type == GDK_BUTTON_RELEASE
+                       ? 0
+                       : event->button;
+       } else {
+               button = 0;
+       }
+       
+       gtk_menu_popup (GTK_MENU (gtk_menu),                    /* menu */
+                       NULL,                                   /* parent_menu_shell */
+                       NULL,                                   /* parent_menu_item */
+                       NULL,                                   /* popup_position_func */
+                       NULL,                                   /* popup_position_data */
+                       button,                                 /* button */
+                       event ? event->time : gtk_get_current_event_time ()); /* activate_time */
+
+       g_object_ref_sink (gtk_menu);
+       g_object_unref (gtk_menu);
+}
+
+
 /**
  * nautilus_view_pop_up_selection_context_menu
  *
@@ -8781,13 +9166,11 @@ nautilus_view_pop_up_selection_context_menu  (NautilusView *view,
        /* Make the context menu items not flash as they update to proper disabled,
         * etc. states by forcing menus to update now.
         */
-       update_menus_if_pending (view);
+       update_right_click_menus_if_pending (view);
 
        update_context_menu_position_from_event (view, event);
 
-       eel_pop_up_context_menu (create_popup_menu 
-                                (view, NAUTILUS_VIEW_POPUP_PATH_SELECTION),
-                                event);
+       create_right_click_menu (view, view->details->selection_menu, event);
 }
 
 /**
@@ -8808,14 +9191,11 @@ nautilus_view_pop_up_background_context_menu (NautilusView *view,
        /* Make the context menu items not flash as they update to proper disabled,
         * etc. states by forcing menus to update now.
         */
-       update_menus_if_pending (view);
+       update_right_click_menus_if_pending (view);
 
        update_context_menu_position_from_event (view, event);
 
-
-       eel_pop_up_context_menu (create_popup_menu 
-                                (view, NAUTILUS_VIEW_POPUP_PATH_BACKGROUND),
-                                event);
+       create_right_click_menu (view, view->details->background_menu, event);
 }
 
 static void
@@ -8921,7 +9301,7 @@ nautilus_view_pop_up_location_context_menu (NautilusView *view,
 }
 
 static void
-schedule_update_menus (NautilusView *view) 
+schedule_update_right_click_menus (NautilusView *view) 
 {
        g_assert (NAUTILUS_IS_VIEW (view));
 
@@ -8934,9 +9314,9 @@ schedule_update_menus (NautilusView *view)
        }
        
        /* Schedule a menu update with the current update interval */
-       if (view->details->update_menus_timeout_id == 0) {
-               view->details->update_menus_timeout_id
-                       = g_timeout_add (view->details->update_interval, update_menus_timeout_callback, view);
+       if (view->details->update_right_click_menus_timeout_id == 0) {
+               view->details->update_right_click_menus_timeout_id
+                       = g_timeout_add (view->details->update_interval, 
update_right_click_menus_timeout_callback, view);
        }
 }
 
@@ -9022,7 +9402,8 @@ nautilus_view_notify_selection_changed (NautilusView *view)
                 */
 
                /* Schedule an update of menu item states to match selection */
-               schedule_update_menus (view);
+                g_print ("selection_changed\n");
+               schedule_update_right_click_menus (view);
        }
 }
 
@@ -9033,7 +9414,8 @@ file_changed_callback (NautilusFile *file, gpointer callback_data)
 
        schedule_changes (view);
 
-       schedule_update_menus (view);
+       g_print ("file_changed\n");
+       schedule_update_right_click_menus (view);
        schedule_update_status (view);
 }
 
@@ -9068,7 +9450,7 @@ load_directory (NautilusView *view,
         * location, so they won't have any false lingering knowledge
         * of old selection.
         */
-       schedule_update_menus (view);
+       schedule_update_right_click_menus (view);
        
        while (view->details->subdirectory_list != NULL) {
                nautilus_view_remove_subdirectory (view,
@@ -9500,7 +9882,7 @@ nautilus_view_trash_state_changed_callback (NautilusTrashMonitor *trash_monitor,
        view = (NautilusView *) callback_data;
        g_assert (NAUTILUS_IS_VIEW (view));
        
-       schedule_update_menus (view);
+       schedule_update_right_click_menus (view);
 }
 
 void
@@ -9649,7 +10031,6 @@ nautilus_view_parent_set (GtkWidget *widget,
 {
        NautilusView *view;
        GtkWidget *parent;
-
        view = NAUTILUS_VIEW (widget);
 
        parent = gtk_widget_get_parent (widget);
@@ -9667,11 +10048,13 @@ nautilus_view_parent_set (GtkWidget *widget,
                        view->details->active = TRUE;
 
                        nautilus_view_merge_menus (view);
-                       schedule_update_menus (view);
+                       g_print("parent set \n");
+                       nautilus_view_update_right_click_menus(view);
+                       nautilus_view_update_toolbar_menus (view);
                }
        } else {
                nautilus_view_unmerge_menus (view);
-               remove_update_menus_timeout_callback (view);
+               remove_update_right_click_menus_timeout_callback (view);
        }
 }
 
@@ -9805,7 +10188,12 @@ 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->update_menus = real_update_menus;
+       klass->get_window = nautilus_view_get_window;
+       klass->get_action_group = nautilus_view_get_action_group;
+       klass->update_right_click_menus = real_update_right_click_menus;
+       klass->update_actions_state = real_update_actions_state;
+       klass->update_toolbar_menus = real_update_toolbar_menus;
+       klass->zoom_to_level = real_zoom_to_level;
        klass->trash = real_trash;
        klass->delete = real_delete;
 
@@ -9837,6 +10225,109 @@ nautilus_view_class_init (NautilusViewClass *klass)
                                      "delete", 0);
 }
 
+static void
+nautilus_view_init (NautilusView *view)
+{
+       AtkObject *atk_object;
+       NautilusDirectory *scripts_directory;
+       NautilusDirectory *templates_directory;
+       char *templates_uri;
+
+       nautilus_profile_start (NULL);
+
+       view->details = G_TYPE_INSTANCE_GET_PRIVATE (view, NAUTILUS_TYPE_VIEW,
+                                                    NautilusViewDetails);
+
+       /* Default to true; desktop-icon-view sets to false */
+       view->details->show_foreign_files = TRUE;
+
+       view->details->non_ready_files =
+               g_hash_table_new_full (file_and_directory_hash,
+                                      file_and_directory_equal,
+                                      (GDestroyNotify)file_and_directory_free,
+                                      NULL);
+
+       gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (view),
+                                       GTK_POLICY_AUTOMATIC,
+                                       GTK_POLICY_AUTOMATIC);
+       gtk_scrolled_window_set_hadjustment (GTK_SCROLLED_WINDOW (view), NULL);
+       gtk_scrolled_window_set_vadjustment (GTK_SCROLLED_WINDOW (view), NULL);
+
+       gtk_style_context_set_junction_sides (gtk_widget_get_style_context (GTK_WIDGET (view)),
+                                             GTK_JUNCTION_TOP | GTK_JUNCTION_LEFT);
+
+       if (set_up_scripts_directory_global ()) {
+               scripts_directory = nautilus_directory_get_by_uri (scripts_directory_uri);
+               add_directory_to_scripts_directory_list (view, scripts_directory);
+               nautilus_directory_unref (scripts_directory);
+       } else {
+               g_warning ("Ignoring scripts directory, it may be a broken link\n");
+       }
+
+       if (nautilus_should_use_templates_directory ()) {
+               templates_uri = nautilus_get_templates_directory_uri ();
+               templates_directory = nautilus_directory_get_by_uri (templates_uri);
+               g_free (templates_uri);
+               add_directory_to_templates_directory_list (view, templates_directory);
+               nautilus_directory_unref (templates_directory);
+       }
+       update_templates_directory (view);
+
+       view->details->sort_directories_first =
+               g_settings_get_boolean (nautilus_preferences, NAUTILUS_PREFERENCES_SORT_DIRECTORIES_FIRST);
+       view->details->show_hidden_files =
+               g_settings_get_boolean (gtk_filechooser_preferences, NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES);
+
+       g_signal_connect_object (nautilus_trash_monitor_get (), "trash-state-changed",
+                                G_CALLBACK (nautilus_view_trash_state_changed_callback), view, 0);
+
+       /* React to clipboard changes */
+       g_signal_connect_object (nautilus_clipboard_monitor_get (), "clipboard-changed",
+                                G_CALLBACK (clipboard_changed_callback), view, 0);
+
+       /* Register to menu provider extension signal managing menu updates */
+       g_signal_connect_object (nautilus_signaller_get_current (), "popup-menu-changed",
+                                G_CALLBACK (schedule_update_right_click_menus), view, G_CONNECT_SWAPPED);
+
+       gtk_widget_show (GTK_WIDGET (view));
+
+       g_signal_connect_swapped (nautilus_preferences,
+                                 "changed::" NAUTILUS_PREFERENCES_ENABLE_DELETE,
+                                 G_CALLBACK (schedule_update_right_click_menus), view);
+       g_signal_connect_swapped (nautilus_preferences,
+                                 "changed::" NAUTILUS_PREFERENCES_CLICK_POLICY,
+                                 G_CALLBACK (click_policy_changed_callback),
+                                 view);
+       g_signal_connect_swapped (nautilus_preferences,
+                                 "changed::" NAUTILUS_PREFERENCES_SORT_DIRECTORIES_FIRST, 
+                                 G_CALLBACK (sort_directories_first_changed_callback), view);
+       g_signal_connect_swapped (gtk_filechooser_preferences,
+                                 "changed::" NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES, 
+                                 G_CALLBACK (show_hidden_files_changed_callback), view);
+       g_signal_connect_swapped (gnome_lockdown_preferences,
+                                 "changed::" NAUTILUS_PREFERENCES_LOCKDOWN_COMMAND_LINE,
+                                 G_CALLBACK (schedule_update_right_click_menus), view);
+
+       g_signal_connect_object (nautilus_file_undo_manager_get (), "undo-changed",
+                                G_CALLBACK (undo_manager_changed_cb), view, 0);
+
+       /* Accessibility */
+       atk_object = gtk_widget_get_accessible (GTK_WIDGET (view));
+       atk_object_set_name (atk_object, _("Content View"));
+       atk_object_set_description (atk_object, _("View of the current folder"));
+
+       view->details->view_action_group = G_ACTION_GROUP (g_simple_action_group_new ());
+       g_action_map_add_action_entries (G_ACTION_MAP (view->details->view_action_group),
+                                       view_entries,
+                                       G_N_ELEMENTS (view_entries),
+                                       view);
+       gtk_widget_insert_action_group (GTK_WIDGET (view),
+                                       "view",
+                                       G_ACTION_GROUP (view->details->view_action_group));
+
+       nautilus_profile_end (NULL);
+}
+
 NautilusView *
 nautilus_view_new (const gchar         *id,
                   NautilusWindowSlot   *slot)
diff --git a/src/nautilus-view.h b/src/nautilus-view.h
index 98f3d57..a4a5923 100644
--- a/src/nautilus-view.h
+++ b/src/nautilus-view.h
@@ -227,7 +227,11 @@ struct NautilusViewClass {
          * It is called (at least) whenever the selection changes. If overridden, 
          * subclasses must call parent class's function.
          */
-        void    (* update_menus)               (NautilusView *view);
+        void    (* update_right_click_menus)           (NautilusView *view);
+
+        void    (* update_toolbar_menus)               (NautilusView *view);
+
+        void    (* update_actions_state)               (NautilusView *view);
 
        /* sort_files is a function pointer that subclasses can override
         * to provide a sorting order to determine which files should be
@@ -295,6 +299,9 @@ struct NautilusViewClass {
         /* Signals used only for keybindings */
         gboolean (* trash)                         (NautilusView *view);
         gboolean (* delete)                        (NautilusView *view);
+
+        NautilusWindow * (*get_window)         (NautilusView *view);
+        GActionGroup * (*get_action_group)     (NautilusView *view);
 };
 
 /* GObject support */
@@ -358,6 +365,7 @@ void                nautilus_view_remove_subdirectory             (NautilusView
                                                                   NautilusDirectory*directory);
 
 gboolean            nautilus_view_is_editable                     (NautilusView *view);
+NautilusWindow *    nautilus_view_get_window                     (NautilusView *view);
 
 /* NautilusView methods */
 const char *      nautilus_view_get_view_id                (NautilusView      *view);
@@ -409,6 +417,14 @@ void              nautilus_view_pop_up_location_context_menu (NautilusView    *v
 void              nautilus_view_grab_focus                 (NautilusView      *view);
 void              nautilus_view_update_menus               (NautilusView      *view);
 
+void              nautilus_view_update_right_click_menus               (NautilusView      *view);
+void              nautilus_view_update_toolbar_menus               (NautilusView      *view);
+void              nautilus_view_update_actions_state              (NautilusView      *view);
+
 gboolean          nautilus_view_get_show_hidden_files      (NautilusView      *view);
+void nautilus_view_action_show_hidden_files (NautilusView *view,
+                                       gboolean show_hidden);
+
+GActionGroup * nautilus_view_get_action_group (NautilusView *view);
 
 #endif /* NAUTILUS_VIEW_H */
diff --git a/src/nautilus-window-menus.c b/src/nautilus-window-menus.c
index 999d163..6b64e30 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,124 @@ action_toggle_state (GSimpleAction *action,
        g_variant_unref (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_tab (GSimpleAction *action,
+               GVariant      *state,
+               gpointer       user_data) 
+{
+       nautilus_window_new_tab (NAUTILUS_WINDOW (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 },
+       { "show-sidebar", NULL, NULL, "false", action_show_sidebar },
+       { "reload", action_reload },
+       { "new-tab", action_new_tab },
+       { "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));
 }
 
 /**
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..a905839 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -1401,9 +1401,9 @@ create_content_view (NautilusWindowSlot *slot,
         } else {
                 /* create a new content view */
                view = nautilus_view_new (view_id, 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..49db5c0 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,12 @@ notebook_popup_menu_cb (GtkWidget *widget,
        return TRUE;
 }
 
+GtkWidget *
+nautilus_window_get_toolbar (NautilusWindow *window)
+{
+       return window->details->toolbar;
+}
+
 static GtkWidget *
 create_toolbar (NautilusWindow *window)
 {
@@ -1459,13 +1442,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 +1460,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 +1478,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 +2096,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..ac29a16 100644
--- a/src/nautilus-window.h
+++ b/src/nautilus-window.h
@@ -135,4 +135,5 @@ gboolean nautilus_window_disable_chrome_mapping (GValue *value,
 NautilusWindowOpenFlags nautilus_event_get_window_open_flags   (void);
 void     nautilus_window_show_about_dialog    (NautilusWindow *window);
 
+GtkWidget *nautilus_window_get_toolbar (NautilusWindow *window);
 #endif
diff --git a/src/nautilus.gresource.xml b/src/nautilus.gresource.xml
index 37a5bbf..1b0e47a 100644
--- a/src/nautilus.gresource.xml
+++ b/src/nautilus.gresource.xml
@@ -9,6 +9,10 @@
     <file>nautilus-list-view-ui.xml</file>
     <file>nautilus-shell-ui.xml</file>
     <file>nautilus-app-menu.ui</file>
+    <file>nautilus-main-menus.xml</file>
+    <file>nautilus-toolbar-ui.xml</file>
+    <file>nautilus-toolbar-view-menu.xml</file>
+    <file>nautilus-view-right-click-menus.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]