[nautilus/wip/neilh/toolbar-reorg: 2/16] files-view: merge action and view menus



commit bdcdbe67ff051d797edc7a40f3486d0abc7a9be2
Author: Neil Herald <neil herald gmail com>
Date:   Fri Apr 29 23:20:48 2016 +0100

    files-view: merge action and view menus
    
    Usability tests conducted by Gina Dobrescu have highlighted a number of
    issues with the toolbar menus. Users can't switch between list and grid
    mode with a single click, and they have struggled to find the switch
    between list and grid mode.
    
    Allan Day has come up with a design to address these problems. The view
    and action menus have been combined into a single menu, and we have
    added a new button to the toolbar which toggles the view mode between
    list and grid mode.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=764632

 nautilus-desktop/nautilus-desktop-window-slot.c  |    2 +
 src/nautilus-files-view.c                        |   94 ++++++++++++++-
 src/nautilus-other-locations-window-slot.c       |    2 +
 src/nautilus-toolbar.c                           |   60 +++-------
 src/nautilus-toolbar.h                           |    4 -
 src/nautilus-window-slot.c                       |   44 ++++++-
 src/nautilus-window.c                            |   58 +--------
 src/resources/nautilus.gresource.xml             |    1 -
 src/resources/ui/nautilus-toolbar-action-menu.ui |   95 ---------------
 src/resources/ui/nautilus-toolbar-view-menu.ui   |  138 ++++++++++++++--------
 src/resources/ui/nautilus-toolbar.ui             |   15 ++-
 11 files changed, 251 insertions(+), 262 deletions(-)
---
diff --git a/nautilus-desktop/nautilus-desktop-window-slot.c b/nautilus-desktop/nautilus-desktop-window-slot.c
index d1c05e7..be834c2 100644
--- a/nautilus-desktop/nautilus-desktop-window-slot.c
+++ b/nautilus-desktop/nautilus-desktop-window-slot.c
@@ -64,4 +64,6 @@ nautilus_desktop_window_slot_init (NautilusDesktopWindowSlot *self)
   /* Disable the ability to change between types of views */
   action = g_action_map_lookup_action (G_ACTION_MAP (action_group), "files-view-mode");
   g_simple_action_set_enabled (G_SIMPLE_ACTION (action), FALSE);
+  action = g_action_map_lookup_action (G_ACTION_MAP (action_group), "files-view-mode-toggle");
+  g_simple_action_set_enabled (G_SIMPLE_ACTION (action), FALSE);
 }
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index a386e19..078a27c 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -29,6 +29,7 @@
 
 #include "nautilus-application.h"
 #include "nautilus-error-reporting.h"
+#include "nautilus-file-undo-manager.h"
 #include "nautilus-floating-bar.h"
 #include "nautilus-list-view.h"
 #include "nautilus-canvas-view.h"
@@ -261,7 +262,6 @@ struct NautilusFilesViewDetails
 
         /* View menu */
         GtkWidget *view_menu_widget;
-        GtkWidget *view_icon;
         GtkWidget *sort_menu;
         GtkWidget *sort_trash_time;
         GtkWidget *sort_search_relevance;
@@ -271,6 +271,9 @@ struct NautilusFilesViewDetails
         GtkAdjustment *zoom_adjustment;
         GtkWidget *zoom_level_scale;
 
+        GtkWidget *undo_button;
+        GtkWidget *redo_button;
+
         gulong stop_signal_handler;
         gulong reload_signal_handler;
 };
@@ -7974,6 +7977,90 @@ nautilus_files_view_is_loading (NautilusView *view)
 }
 
 static void
+update_menu_item (GtkWidget      *menu_item,
+                  NautilusWindow *window,
+                  const char     *action_name,
+                  gboolean        enabled,
+                  char           *label)
+{
+        GAction *action;
+        GValue val = G_VALUE_INIT;
+
+        /* Activate/deactivate */
+        action = g_action_map_lookup_action (G_ACTION_MAP (window), action_name);
+        g_simple_action_set_enabled (G_SIMPLE_ACTION (action), enabled);
+
+        /* Set the text of the menu item. Can't use gtk_button_set_label here
+         * as we need to set the text property, not the label. There's no equivalent
+         * gtk_model_button_set_text function
+         */
+        g_value_init (&val, G_TYPE_STRING);
+        g_value_set_string (&val, label);
+        g_object_set_property (G_OBJECT (menu_item), "text", &val);
+        g_value_unset (&val);
+}
+
+static void
+undo_manager_changed (NautilusFilesView *view)
+{
+        NautilusWindow *window;
+        NautilusFileUndoInfo *info;
+        NautilusFileUndoManagerState undo_state;
+        gboolean undo_active;
+        gboolean redo_active;
+        gchar *undo_label;
+        gchar *redo_label;
+        gchar *undo_description;
+        gchar *redo_description;
+        gboolean is_undo;
+
+        window = nautilus_files_view_get_window (view);
+        undo_label = undo_description = redo_label = redo_description = NULL;
+
+        /* Look up the last action from the undo manager, and get the text that
+         * describes it, e.g. "Undo Create Folder"/"Redo Create Folder"
+         */
+        info = nautilus_file_undo_manager_get_action ();
+        undo_state = nautilus_file_undo_manager_get_state ();
+        undo_active = redo_active = FALSE;
+        if (info != NULL && undo_state > NAUTILUS_FILE_UNDO_MANAGER_STATE_NONE) {
+                is_undo = undo_state == NAUTILUS_FILE_UNDO_MANAGER_STATE_UNDO;
+
+                /* The last action can either be undone/redone. Activate the corresponding
+                 * menu item and deactivate the other
+                 */
+                undo_active = is_undo;
+                redo_active = !is_undo;
+                nautilus_file_undo_info_get_strings (info, &undo_label, &undo_description,
+                                                     &redo_label, &redo_description);
+                g_free (undo_description);
+                g_free (redo_description);
+        }
+
+        /* Set the label of the undo and redo menu items, and activate them appropriately
+         */
+        undo_label = undo_active && undo_label != NULL ? undo_label : g_strdup (_("_Undo"));
+        update_menu_item (view->details->undo_button, window, "undo", undo_active, undo_label);
+
+        redo_label = redo_active && redo_label != NULL ? redo_label : g_strdup (_("_Redo"));
+        update_menu_item (view->details->redo_button, window, "redo", redo_active, redo_label);
+
+        g_free (undo_label);
+        g_free (redo_label);
+}
+
+static void
+nautilus_files_view_constructed (GObject *object)
+{
+        NautilusFilesView *view;
+
+        view = NAUTILUS_FILES_VIEW (object);
+        g_signal_connect_object (nautilus_file_undo_manager_get (), "undo-changed",
+                                 G_CALLBACK (undo_manager_changed), view, G_CONNECT_SWAPPED);
+        undo_manager_changed (view);
+}
+
+static void
 nautilus_files_view_iface_init (NautilusViewInterface *iface)
 {
         iface->get_icon = nautilus_files_view_get_icon;
@@ -7988,7 +8075,6 @@ nautilus_files_view_iface_init (NautilusViewInterface *iface)
         iface->is_loading = nautilus_files_view_is_loading;
 }
 
-
 static void
 nautilus_files_view_class_init (NautilusFilesViewClass *klass)
 {
@@ -7999,6 +8085,7 @@ nautilus_files_view_class_init (NautilusFilesViewClass *klass)
         oclass = G_OBJECT_CLASS (klass);
 
         oclass->finalize = nautilus_files_view_finalize;
+        oclass->constructed = nautilus_files_view_constructed;
         oclass->get_property = nautilus_files_view_get_property;
         oclass->set_property = nautilus_files_view_set_property;
 
@@ -8157,6 +8244,9 @@ nautilus_files_view_init (NautilusFilesView *view)
         view->details->reload =  GTK_WIDGET (gtk_builder_get_object (builder, "reload"));
         view->details->stop =  GTK_WIDGET (gtk_builder_get_object (builder, "stop"));
 
+        view->details->undo_button = GTK_WIDGET (gtk_builder_get_object (builder, "undo"));
+        view->details->redo_button = GTK_WIDGET (gtk_builder_get_object (builder, "redo"));
+
         g_signal_connect (view->details->zoom_level_scale, "value-changed",
                           G_CALLBACK (zoom_level_changed), view);
 
diff --git a/src/nautilus-other-locations-window-slot.c b/src/nautilus-other-locations-window-slot.c
index 166c82f..27d16ec 100644
--- a/src/nautilus-other-locations-window-slot.c
+++ b/src/nautilus-other-locations-window-slot.c
@@ -75,4 +75,6 @@ nautilus_other_locations_window_slot_init (NautilusOtherLocationsWindowSlot *sel
 
   action = g_action_map_lookup_action (G_ACTION_MAP (action_group), "files-view-mode");
   g_simple_action_set_enabled (G_SIMPLE_ACTION (action), FALSE);
+  action = g_action_map_lookup_action (G_ACTION_MAP (action_group), "files-view-mode-toggle");
+  g_simple_action_set_enabled (G_SIMPLE_ACTION (action), FALSE);
 }
diff --git a/src/nautilus-toolbar.c b/src/nautilus-toolbar.c
index c4a9620..f64f84f 100644
--- a/src/nautilus-toolbar.c
+++ b/src/nautilus-toolbar.c
@@ -66,15 +66,13 @@ struct _NautilusToolbarPrivate {
 
        GtkWidget *operations_button;
        GtkWidget *view_button;
-       GtkWidget *action_button;
+        GtkWidget *view_toggle_button;
+        GtkWidget *view_toggle_icon;
 
         GtkWidget *operations_popover;
         GtkWidget *operations_container;
         GtkWidget *operations_revealer;
         GtkWidget *operations_icon;
-       GtkWidget *view_icon;
-        GtkWidget *undo_button;
-        GtkWidget *redo_button;
 
        GtkWidget *forward_button;
        GtkWidget *back_button;
@@ -756,8 +754,6 @@ on_progress_has_viewers_changed (NautilusProgressInfoManager *manager,
 static void
 nautilus_toolbar_init (NautilusToolbar *self)
 {
-       GtkBuilder *builder;
-
        self->priv = nautilus_toolbar_get_instance_private (self);
        gtk_widget_init_template (GTK_WIDGET (self));
 
@@ -769,14 +765,6 @@ nautilus_toolbar_init (NautilusToolbar *self)
        gtk_container_add (GTK_CONTAINER (self->priv->location_entry_container),
                                          self->priv->location_entry);
 
-       builder = gtk_builder_new_from_resource ("/org/gnome/nautilus/ui/nautilus-toolbar-action-menu.ui");
-        self->priv->undo_button = GTK_WIDGET (gtk_builder_get_object (builder, "undo"));
-        self->priv->redo_button = GTK_WIDGET (gtk_builder_get_object (builder, "redo"));
-        gtk_menu_button_set_popover (GTK_MENU_BUTTON (self->priv->action_button),
-                                     GTK_WIDGET (gtk_builder_get_object (builder, "action_menu_widget")));
-
-       g_object_unref (builder);
-
         self->priv->progress_manager = nautilus_progress_info_manager_dup_singleton ();
        g_signal_connect (self->priv->progress_manager, "new-progress-info",
                          G_CALLBACK (on_new_progress_info), self);
@@ -901,8 +889,8 @@ nautilus_toolbar_class_init (NautilusToolbarClass *klass)
        gtk_widget_class_bind_template_child_private (widget_class, NautilusToolbar, operations_container);
        gtk_widget_class_bind_template_child_private (widget_class, NautilusToolbar, operations_revealer);
        gtk_widget_class_bind_template_child_private (widget_class, NautilusToolbar, view_button);
-        gtk_widget_class_bind_template_child_private (widget_class, NautilusToolbar, view_icon);
-       gtk_widget_class_bind_template_child_private (widget_class, NautilusToolbar, action_button);
+        gtk_widget_class_bind_template_child_private (widget_class, NautilusToolbar, view_toggle_button);
+        gtk_widget_class_bind_template_child_private (widget_class, NautilusToolbar, view_toggle_icon);
        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);
        gtk_widget_class_bind_template_child_private (widget_class, NautilusToolbar, back_button);
@@ -922,27 +910,6 @@ nautilus_toolbar_new ()
                             NULL);
 }
 
-static void
-set_string_property (GObject *object,
-                     char    *prop_name,
-                     char    *value)
-{
-        GValue val = G_VALUE_INIT;
-        g_value_init (&val, G_TYPE_STRING);
-        g_value_set_string (&val, value);
-        g_object_set_property (object, prop_name, &val);
-        g_value_unset (&val);
-}
-
-void
-nautilus_toolbar_update_undo_redo_labels (NautilusToolbar *self,
-                                          gchar           *undo_label,
-                                          gchar           *redo_label)
-{
-        set_string_property (G_OBJECT (self->priv->undo_button), "text", undo_label);
-        set_string_property (G_OBJECT (self->priv->redo_button), "text", redo_label);
-}
-
 GtkWidget *
 nautilus_toolbar_get_path_bar (NautilusToolbar *self)
 {
@@ -968,10 +935,10 @@ nautilus_toolbar_set_show_location_entry (NautilusToolbar *self,
 }
 
 static gboolean
-nautilus_toolbar_view_icon_transform_to (GBinding     *binding,
-                                         const GValue *from_value,
-                                         GValue       *to_value,
-                                         gpointer      user_data)
+nautilus_toolbar_view_toggle_icon_transform_to (GBinding     *binding,
+                                                const GValue *from_value,
+                                                GValue       *to_value,
+                                                gpointer      user_data)
 {
         GIcon *icon;
 
@@ -998,11 +965,16 @@ nautilus_toolbar_view_widget_transform_to (GBinding     *binding,
         toolbar = NAUTILUS_TOOLBAR (user_data);
         view_widget = g_value_get_object (from_value);
 
-        gtk_widget_set_sensitive (toolbar->priv->view_button, view_widget != NULL);
         gtk_menu_button_set_popover (GTK_MENU_BUTTON (toolbar->priv->view_button), NULL);
 
         g_value_set_object (to_value, view_widget);
 
+        /* Make the sensitivity change after the popover has been set, so that the sensitivity
+         * propagates to the popover. Otherwise the popover will remain greyed out after
+         * switching to a previous tab
+         */
+        gtk_widget_set_sensitive (toolbar->priv->view_button, view_widget != NULL);
+
         return TRUE;
 }
 
@@ -1021,9 +993,9 @@ nautilus_toolbar_set_active_slot (NautilusToolbar    *toolbar,
                 if (slot) {
                         toolbar->priv->icon_binding =
                                         g_object_bind_property_full (slot, "icon",
-                                                                     toolbar->priv->view_icon, "gicon",
+                                                                     toolbar->priv->view_toggle_icon, 
"gicon",
                                                                      G_BINDING_DEFAULT | 
G_BINDING_SYNC_CREATE,
-                                                                     (GBindingTransformFunc) 
nautilus_toolbar_view_icon_transform_to,
+                                                                     (GBindingTransformFunc) 
nautilus_toolbar_view_toggle_icon_transform_to,
                                                                      NULL,
                                                                      toolbar,
                                                                      NULL);
diff --git a/src/nautilus-toolbar.h b/src/nautilus-toolbar.h
index 1b2a1eb..41ec2ae 100644
--- a/src/nautilus-toolbar.h
+++ b/src/nautilus-toolbar.h
@@ -67,10 +67,6 @@ GtkWidget *nautilus_toolbar_new (void);
 GtkWidget *nautilus_toolbar_get_path_bar (NautilusToolbar *self);
 GtkWidget *nautilus_toolbar_get_location_entry (NautilusToolbar *self);
 
-void nautilus_toolbar_update_undo_redo_labels (NautilusToolbar *self,
-                                               gchar           *undo_label,
-                                               gchar           *redo_label);
-
 void nautilus_toolbar_set_show_location_entry (NautilusToolbar *self,
                                               gboolean show_location_entry);
 
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index 76cfeef..3a0f643 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -720,12 +720,46 @@ action_search_visible (GSimpleAction *action,
 }
 
 static void
+change_files_view_mode (NautilusWindowSlot *self,
+                        guint               view_id)
+{
+        const gchar *preferences_key;
+
+        nautilus_window_slot_set_content_view (self, view_id);
+        preferences_key = nautilus_view_is_searching (nautilus_window_slot_get_current_view (self)) ?
+                          NAUTILUS_PREFERENCES_SEARCH_VIEW :
+                          NAUTILUS_PREFERENCES_DEFAULT_FOLDER_VIEWER;
+
+        g_settings_set_enum (nautilus_preferences, preferences_key, view_id);
+}
+
+static void
+action_files_view_mode_toggle (GSimpleAction *action,
+                               GVariant      *value,
+                               gpointer       user_data)
+{
+        NautilusWindowSlot *self;
+        NautilusWindowSlotPrivate *priv;
+        guint current_view_id;
+
+        self = NAUTILUS_WINDOW_SLOT (user_data);
+        priv = nautilus_window_slot_get_instance_private (self);
+        if (priv->content_view == NULL)
+                return;
+
+        current_view_id = nautilus_files_view_get_view_id (NAUTILUS_FILES_VIEW (priv->content_view));
+        if (current_view_id == NAUTILUS_VIEW_LIST_ID)
+                change_files_view_mode (self, NAUTILUS_VIEW_GRID_ID);
+        else
+                change_files_view_mode (self, NAUTILUS_VIEW_LIST_ID);
+}
+
+static void
 action_files_view_mode (GSimpleAction *action,
                        GVariant      *value,
                        gpointer       user_data)
 {
         NautilusWindowSlot *self;
-        const gchar *preferences_key;
         guint view_id;
 
         view_id =  g_variant_get_uint32 (value);
@@ -734,12 +768,7 @@ action_files_view_mode (GSimpleAction *action,
         if (!NAUTILUS_IS_FILES_VIEW (nautilus_window_slot_get_current_view (self)))
                 return;
 
-        nautilus_window_slot_set_content_view (self, view_id);
-        preferences_key = nautilus_view_is_searching (nautilus_window_slot_get_current_view (self)) ?
-                          NAUTILUS_PREFERENCES_SEARCH_VIEW :
-                          NAUTILUS_PREFERENCES_DEFAULT_FOLDER_VIEWER;
-
-        g_settings_set_enum (nautilus_preferences, preferences_key, view_id);
+        change_files_view_mode (self, view_id);
 
         g_simple_action_set_state (action, value);
 }
@@ -747,6 +776,7 @@ action_files_view_mode (GSimpleAction *action,
 const GActionEntry slot_entries[] = {
         /* 4 is NAUTILUS_VIEW_INVALID_ID */
         { "files-view-mode", NULL, "u", "uint32 4", action_files_view_mode },
+        { "files-view-mode-toggle", action_files_view_mode_toggle },
         { "search-visible", NULL, NULL, "false", action_search_visible },
 };
 
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 1d0b416..5137e71 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -414,9 +414,9 @@ action_undo (GSimpleAction *action,
 }
 
 static void
-action_toggle_state_action_button (GSimpleAction *action,
-                                  GVariant      *state,
-                                  gpointer       user_data)
+action_toggle_state_view_button (GSimpleAction *action,
+                                 GVariant      *state,
+                                 gpointer       user_data)
 {
        GVariant *current_state;
 
@@ -427,50 +427,6 @@ action_toggle_state_action_button (GSimpleAction *action,
 }
 
 static void
-undo_manager_changed (NautilusWindow *window)
-{
-       NautilusToolbar *toolbar;
-       NautilusFileUndoInfo *info;
-       NautilusFileUndoManagerState undo_state;
-       gboolean undo_active, redo_active;
-       gchar *undo_label, *undo_description, *redo_label, *redo_description;
-       gboolean is_undo;
-       GAction *action;
-
-       toolbar = NAUTILUS_TOOLBAR (window->priv->toolbar);
-       undo_label = undo_description = redo_label = redo_description = NULL;
-
-       info = nautilus_file_undo_manager_get_action ();
-       undo_state = nautilus_file_undo_manager_get_state ();
-       undo_active = redo_active = FALSE;
-       if (info != NULL &&
-           (undo_state > NAUTILUS_FILE_UNDO_MANAGER_STATE_NONE)) {
-               is_undo = (undo_state == NAUTILUS_FILE_UNDO_MANAGER_STATE_UNDO);
-               undo_active = is_undo;
-               redo_active = !is_undo;
-               nautilus_file_undo_info_get_strings (info,
-                                                    &undo_label, &undo_description,
-                                                    &redo_label, &redo_description);
-       }
-
-       action = g_action_map_lookup_action (G_ACTION_MAP (window), "undo");
-       g_simple_action_set_enabled (G_SIMPLE_ACTION (action), undo_active);
-       action = g_action_map_lookup_action (G_ACTION_MAP (window), "redo");
-       g_simple_action_set_enabled (G_SIMPLE_ACTION (action), redo_active);
-
-       undo_label = undo_active ? undo_label : g_strdup (_("Undo"));
-       redo_label = redo_active ? redo_label : g_strdup (_("Redo"));
-        undo_label = undo_label == NULL ? g_strdup (_("Undo")) : undo_label;
-        redo_label = redo_label == NULL ? g_strdup (_("Redo")) : redo_label;
-        nautilus_toolbar_update_undo_redo_labels (toolbar, undo_label, redo_label);
-
-       g_free (undo_label);
-       g_free (undo_description);
-       g_free (redo_label);
-       g_free (redo_description);
-}
-
-static void
 on_location_changed (NautilusWindow *window)
 {
         gtk_places_sidebar_set_location (GTK_PLACES_SIDEBAR (window->priv->places_sidebar),
@@ -2066,7 +2022,7 @@ const GActionEntry win_entries[] = {
        { "back",  action_back },
        { "forward",  action_forward },
        { "up",  action_up },
-       { "action-menu", action_toggle_state_action_button, NULL, "false", NULL },
+        { "view-menu", action_toggle_state_view_button, NULL, "false", NULL },
        { "reload", action_reload },
        { "stop", action_stop },
        { "new-tab", action_new_tab },
@@ -2130,7 +2086,7 @@ nautilus_window_initialize_actions (NautilusWindow *window)
        nautilus_application_add_accelerator (app, "win.tab-move-right", "<shift><control>Page_Down");
        nautilus_application_add_accelerator (app, "win.prompt-root-location", "slash");
        nautilus_application_add_accelerator (app, "win.prompt-home-location", "asciitilde");
-       nautilus_application_add_accelerator (app, "win.action-menu", "F10");
+        nautilus_application_add_accelerator (app, "win.view-menu", "F10");
 
        /* Alt+N for the first 9 tabs */
        for (i = 0; i < 9; ++i) {
@@ -2145,10 +2101,6 @@ nautilus_window_initialize_actions (NautilusWindow *window)
                nautilus_window_show_sidebar (window);
 
        g_variant_unref (state);
-
-       g_signal_connect_object (nautilus_file_undo_manager_get (), "undo-changed",
-                                G_CALLBACK (undo_manager_changed), window, G_CONNECT_SWAPPED);
-       undo_manager_changed (window);
 }
 
 
diff --git a/src/resources/nautilus.gresource.xml b/src/resources/nautilus.gresource.xml
index 0acbc70..30a0566 100644
--- a/src/resources/nautilus.gresource.xml
+++ b/src/resources/nautilus.gresource.xml
@@ -7,7 +7,6 @@
     <file>ui/nautilus-pathbar-context-menu.ui</file>
     <file>ui/nautilus-toolbar.ui</file>
     <file>ui/nautilus-toolbar-view-menu.ui</file>
-    <file>ui/nautilus-toolbar-action-menu.ui</file>
     <file>ui/nautilus-create-folder-dialog.ui</file>
     <file>ui/nautilus-rename-file-popover.ui</file>
     <file>ui/nautilus-files-view-context-menus.ui</file>
diff --git a/src/resources/ui/nautilus-toolbar-view-menu.ui b/src/resources/ui/nautilus-toolbar-view-menu.ui
index 7cb336d..b7b0763 100644
--- a/src/resources/ui/nautilus-toolbar-view-menu.ui
+++ b/src/resources/ui/nautilus-toolbar-view-menu.ui
@@ -9,48 +9,6 @@
         <property name="orientation">vertical</property>
         <property name="width_request">160</property>
         <child>
-          <object class="GtkBox" id="views_box">
-            <property name="visible">True</property>
-            <property name="orientation">horizontal</property>
-            <property name="margin-bottom">6</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">slot.files-view-mode</property>
-                <property name="action-target">uint32 0</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">slot.files-view-mode</property>
-                <property name="action-target">uint32 1</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>
@@ -196,7 +154,7 @@
           <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="text" translatable="yes">R_eload</property>
             <property name="action-name">win.reload</property>
           </object>
         </child>
@@ -208,15 +166,97 @@
             <property name="action-name">win.stop</property>
           </object>
         </child>
+        <child>
+          <object class="GtkSeparator">
+            <property name="visible">True</property>
+            <property name="orientation">horizontal</property>
+            <property name="margin-top">6</property>
+            <property name="margin-bottom">6</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkModelButton" id="new-folder">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="text" translatable="yes">New _Folder</property>
+            <property name="action-name">view.new-folder</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkModelButton" id="new-tab">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="text" translatable="yes">New _Tab</property>
+            <property name="action-name">win.new-tab</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkSeparator">
+            <property name="visible">True</property>
+            <property name="orientation">horizontal</property>
+            <property name="margin-top">6</property>
+            <property name="margin-bottom">6</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkModelButton" id="undo">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="text" translatable="yes">_Undo</property>
+            <property name="action-name">win.undo</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkModelButton" id="redo">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="text" translatable="yes">_Redo</property>
+            <property name="action-name">win.redo</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkSeparator">
+            <property name="visible">True</property>
+            <property name="orientation">horizontal</property>
+            <property name="margin-top">6</property>
+            <property name="margin-bottom">6</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkModelButton" id="select-all">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="text" translatable="yes">Select _All</property>
+            <property name="action-name">view.select-all</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkModelButton" id="enter-location">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="text" translatable="yes">Enter _Location</property>
+            <property name="action-name">win.enter-location</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkSeparator">
+            <property name="visible">True</property>
+            <property name="orientation">horizontal</property>
+            <property name="margin-top">6</property>
+            <property name="margin-bottom">6</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkModelButton" id="bookmark-this-location">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="text" translatable="yes">_Bookmark this Location</property>
+            <property name="action-name">win.bookmark-current-location</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">3</property>
diff --git a/src/resources/ui/nautilus-toolbar.ui b/src/resources/ui/nautilus-toolbar.ui
index 024e3f3..3c3b1d5 100644
--- a/src/resources/ui/nautilus-toolbar.ui
+++ b/src/resources/ui/nautilus-toolbar.ui
@@ -72,15 +72,15 @@
       </packing>
     </child>
     <child>
-      <object class="GtkMenuButton" id="action_button">
+      <object class="GtkMenuButton" id="view_button">
         <property name="visible">True</property>
         <property name="sensitive">True</property>
-        <property name="action_name">win.action-menu</property>
+        <property name="action_name">win.view-menu</property>
         <style>
           <class name="image-button"/>
         </style>
         <child>
-          <object class="GtkImage" id="action_icon">
+          <object class="GtkImage">
             <property name="visible">True</property>
             <property name="icon-name">open-menu-symbolic</property>
             <property name="icon-size">1</property>
@@ -98,22 +98,23 @@
       </packing>
     </child>
     <child>
-      <object class="GtkMenuButton" id="view_button">
+      <object class="GtkButton" id="view_toggle_button">
         <property name="visible">True</property>
         <property name="sensitive">True</property>
+        <property name="action_name">slot.files-view-mode-toggle</property>
         <style>
           <class name="image-button"/>
         </style>
         <child>
-          <object class="GtkImage" id="view_icon">
+          <object class="GtkImage" id="view_toggle_icon">
             <property name="visible">True</property>
             <property name="icon-size">1</property>
           </object>
         </child>
         <child internal-child="accessible">
           <object class="AtkObject">
-            <property name="accessible-name" translatable="yes">View menu</property>
-            <property name="accessible-description" translatable="yes">Open view menu</property>
+            <property name="accessible-name" translatable="yes">View mode toggle</property>
+            <property name="accessible-description" translatable="yes">Toggle between grid and list 
view</property>
           </object>
         </child>
       </object>


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