summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarlos Soriano <csoriano@gnome.org>2018-04-13 21:36:42 +0200
committerCarlos Soriano <csoriano@gnome.org>2018-05-03 22:43:39 +0200
commitf278574df4a7fe84ff8f7e70b0f9f260fa665072 (patch)
treef8049044b4ba7b6b9cf1747c898ab21294d482b0 /src
parent7346702032adde2255db99563b20f11715b2ab37 (diff)
downloadnautilus-f278574df4a7fe84ff8f7e70b0f9f260fa665072.tar.gz
general: Add actions to the toolbar
Generally actions in Nautilus were accessed through context menus or keyboard shorcuts. However, those are not very discoverable and are not touch friendly. Even more, in list view it was not possible to access background actions since there is always a selection, making Nautilus UX quite poor in that case. Also some actions were placed in the app menu, which didn't was not as clear for some people given that we have most of actions in the toolbar. In all, we came with a new design that solves the main goals of discoverability, touch friendly and accessibility for background actions and app actions, and now are placed in the toolbar together with an overhaul of the looks of Nautilus path bar and search. There is still work to do, specifically finding a design that works for the selection actions and also to replace the current information floating bar. The later might be just a different goal. However this goes in the right direction. See https://gitlab.gnome.org/GNOME/nautilus/issues/322
Diffstat (limited to 'src')
-rw-r--r--src/nautilus-pathbar.c127
-rw-r--r--src/nautilus-query-editor.c39
-rw-r--r--src/nautilus-query-editor.h10
-rw-r--r--src/nautilus-query.c2
-rw-r--r--src/nautilus-toolbar.c259
-rw-r--r--src/nautilus-toolbar.h4
-rw-r--r--src/nautilus-window-slot.c20
-rw-r--r--src/nautilus-window-slot.h2
-rw-r--r--src/nautilus-window.c8
-rw-r--r--src/resources/css/Adwaita.css15
-rw-r--r--src/resources/nautilus.gresource.xml1
-rw-r--r--src/resources/ui/nautilus-toolbar-menu.ui128
-rw-r--r--src/resources/ui/nautilus-toolbar-view-menu.ui1
-rw-r--r--src/resources/ui/nautilus-toolbar.ui620
-rw-r--r--src/resources/ui/nautilus-window.ui12
15 files changed, 779 insertions, 469 deletions
diff --git a/src/nautilus-pathbar.c b/src/nautilus-pathbar.c
index 6accd87b5..14ab461ca 100644
--- a/src/nautilus-pathbar.c
+++ b/src/nautilus-pathbar.c
@@ -76,6 +76,7 @@ typedef struct
GtkWidget *label;
GtkWidget *bold_label;
GtkWidget *separator;
+ GtkWidget *disclosure_arrow;
GtkWidget *container;
guint ignore_changes : 1;
@@ -107,6 +108,8 @@ typedef struct
GMenu *context_menu;
NautilusFile *context_menu_file;
GdkEvent *context_menu_event;
+
+ GtkPopover *current_view_menu;
} NautilusPathBarPrivate;
@@ -322,6 +325,11 @@ nautilus_path_bar_init (NautilusPathBar *self)
{
NautilusPathBarPrivate *priv;
GtkBuilder *builder;
+ GMenu *menu;
+ GMenu *section_1;
+ GMenu *section_2;
+ GMenu *section_3;
+ GMenu *section_4;
priv = nautilus_path_bar_get_instance_private (self);
@@ -386,6 +394,26 @@ nautilus_path_bar_init (NautilusPathBar *self)
GTK_STYLE_CLASS_LINKED);
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (self)),
"path-bar");
+
+ menu = g_menu_new ();
+ section_1 = g_menu_new ();
+ section_2 = g_menu_new ();
+ section_3 = g_menu_new ();
+ section_4 = g_menu_new ();
+ g_menu_insert (section_1, 0, _("New Folder…"), "view.new-folder");
+ g_menu_insert (section_2, 0, _("Add to Bookmarks"), "view.bookmark");
+ g_menu_insert (section_2, 1, _("Star"), "view.star");
+ g_menu_insert (section_3, 0, _("Paste"), "view.paste");
+ g_menu_insert (section_3, 1, _("Select All"), "view.select-all");
+ g_menu_insert (section_4, 0, _("Properties"), "view.properties");
+
+ g_menu_insert_section (menu, 0, NULL, G_MENU_MODEL (section_1));
+ g_menu_insert_section (menu, 1, NULL, G_MENU_MODEL (section_2));
+ g_menu_insert_section (menu, 2, NULL, G_MENU_MODEL (section_3));
+ g_menu_insert_section (menu, 3, NULL, G_MENU_MODEL (section_4));
+
+ priv->current_view_menu = GTK_POPOVER (gtk_popover_new_from_model (GTK_WIDGET (self),
+ G_MENU_MODEL (menu)));
}
static void
@@ -1620,9 +1648,16 @@ button_clicked_cb (GtkWidget *button,
button_list = g_list_find (priv->button_list, button_data);
g_assert (button_list != NULL);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
+ if (g_file_equal (button_data->path, priv->current_path))
+ {
+ gtk_popover_popup (priv->current_view_menu);
+ }
+ else
+ {
+ g_signal_emit (self, path_bar_signals[OPEN_LOCATION], 0, button_data->path, 0);
+ }
+
- g_signal_emit (self, path_bar_signals [PATH_CLICKED], 0, button_data->path);
}
@@ -2108,7 +2143,9 @@ make_button_data (NautilusPathBar *self,
GFile *path;
GtkWidget *child;
ButtonData *button_data;
+ NautilusPathBarPrivate *priv;
+ priv = nautilus_path_bar_get_instance_private (self);
path = nautilus_file_get_location (file);
child = NULL;
@@ -2128,7 +2165,20 @@ make_button_data (NautilusPathBar *self,
switch (button_data->type)
{
case ROOT_BUTTON:
- /* Fall through */
+ {
+ child = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
+ button_data->label = gtk_label_new (NULL);
+ button_data->disclosure_arrow = gtk_image_new_from_icon_name ("pan-down-symbolic",
+ GTK_ICON_SIZE_MENU);
+ button_data->container = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
+ gtk_box_pack_start (GTK_BOX (button_data->container), button_data->button, FALSE, FALSE, 0);
+
+ gtk_box_pack_start (GTK_BOX (child), button_data->image, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (child), button_data->label, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (child), button_data->disclosure_arrow, FALSE, FALSE, 0);
+ }
+ break;
+
case HOME_BUTTON:
/* Fall through */
case MOUNT_BUTTON:
@@ -2137,10 +2187,14 @@ make_button_data (NautilusPathBar *self,
{
button_data->label = gtk_label_new (NULL);
child = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
- gtk_box_pack_start (GTK_BOX (child), button_data->image, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (child), button_data->label, FALSE, FALSE, 0);
+ button_data->disclosure_arrow = gtk_image_new_from_icon_name ("pan-down-symbolic",
+ GTK_ICON_SIZE_MENU);
button_data->container = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_box_pack_start (GTK_BOX (button_data->container), button_data->button, FALSE, FALSE, 0);
+
+ gtk_box_pack_start (GTK_BOX (child), button_data->image, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (child), button_data->label, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (child), button_data->disclosure_arrow, FALSE, FALSE, 0);
}
break;
@@ -2150,14 +2204,25 @@ make_button_data (NautilusPathBar *self,
{
button_data->label = gtk_label_new (NULL);
child = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
- gtk_box_pack_start (GTK_BOX (child), button_data->label, FALSE, FALSE, 0);
+ button_data->disclosure_arrow = gtk_image_new_from_icon_name ("pan-down-symbolic",
+ GTK_ICON_SIZE_MENU);
button_data->container = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_pack_start (GTK_BOX (button_data->container), gtk_label_new (G_DIR_SEPARATOR_S), FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (button_data->container), button_data->button, FALSE, FALSE, 0);
+
+ gtk_box_pack_start (GTK_BOX (child), button_data->label, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (child), button_data->disclosure_arrow, FALSE, FALSE, 0);
}
break;
}
+ gtk_widget_set_no_show_all (button_data->disclosure_arrow, TRUE);
+ if (current_dir)
+ {
+ gtk_widget_show (button_data->disclosure_arrow);
+ gtk_popover_set_relative_to (priv->current_view_menu, button_data->button);
+ }
+
if (button_data->label != NULL)
{
gtk_label_set_ellipsize (GTK_LABEL (button_data->label), PANGO_ELLIPSIZE_MIDDLE);
@@ -2205,49 +2270,6 @@ make_button_data (NautilusPathBar *self,
return button_data;
}
-static gboolean
-nautilus_path_bar_check_parent_path (NautilusPathBar *self,
- GFile *location,
- ButtonData **current_button_data)
-{
- GList *list;
- NautilusPathBarPrivate *priv;
- ButtonData *button_data, *current_data;
- gboolean is_active;
-
- priv = nautilus_path_bar_get_instance_private (self);
- current_data = NULL;
-
- for (list = priv->button_list; list; list = list->next)
- {
- button_data = list->data;
- if (g_file_equal (location, button_data->path))
- {
- current_data = button_data;
- is_active = TRUE;
-
- if (!gtk_widget_get_child_visible (current_data->container))
- {
- priv->first_scrolled_button = list;
- gtk_widget_queue_resize (GTK_WIDGET (self));
- }
- }
- else
- {
- is_active = FALSE;
- }
-
- nautilus_path_bar_update_button_state (button_data, is_active);
- }
-
- if (current_button_data != NULL)
- {
- *current_button_data = current_data;
- }
-
- return (current_data != NULL);
-}
-
static void
nautilus_path_bar_update_path (NautilusPathBar *self,
GFile *file_path)
@@ -2321,11 +2343,8 @@ nautilus_path_bar_set_path (NautilusPathBar *self,
/* Check whether the new path is already present in the pathbar as buttons.
* This could be a parent directory or a previous selected subdirectory. */
- if (!nautilus_path_bar_check_parent_path (self, file_path, &button_data))
- {
- nautilus_path_bar_update_path (self, file_path);
- button_data = g_list_nth_data (priv->button_list, 0);
- }
+ nautilus_path_bar_update_path (self, file_path);
+ button_data = g_list_nth_data (priv->button_list, 0);
if (priv->current_path != NULL)
{
diff --git a/src/nautilus-query-editor.c b/src/nautilus-query-editor.c
index 5ce439e68..9c8033def 100644
--- a/src/nautilus-query-editor.c
+++ b/src/nautilus-query-editor.c
@@ -78,7 +78,7 @@ static void entry_changed_cb (GtkWidget *entry,
NautilusQueryEditor *editor);
static void nautilus_query_editor_changed (NautilusQueryEditor *editor);
-G_DEFINE_TYPE_WITH_PRIVATE (NautilusQueryEditor, nautilus_query_editor, GTK_TYPE_SEARCH_BAR);
+G_DEFINE_TYPE_WITH_PRIVATE (NautilusQueryEditor, nautilus_query_editor, GTK_TYPE_BOX);
static gboolean
settings_search_is_recursive (NautilusQueryEditor *editor)
@@ -428,7 +428,7 @@ entry_changed_cb (GtkWidget *entry,
priv = nautilus_query_editor_get_instance_private (editor);
- if (priv->change_frozen || !gtk_search_bar_get_search_mode (GTK_SEARCH_BAR (editor)))
+ if (priv->change_frozen)
{
return;
}
@@ -468,27 +468,12 @@ entry_key_press_event_cb (GtkWidget *widget,
GdkEventKey *event,
NautilusQueryEditor *editor)
{
- if (event->keyval == GDK_KEY_Down)
+ if (event->keyval == GDK_KEY_Down )
{
gtk_widget_grab_focus (gtk_widget_get_toplevel (GTK_WIDGET (widget)));
}
- return FALSE;
-}
-
-static void
-search_mode_changed_cb (GObject *editor,
- GParamSpec *pspec,
- gpointer user_data)
-{
- NautilusQueryEditorPrivate *priv;
-
- priv = nautilus_query_editor_get_instance_private (NAUTILUS_QUERY_EDITOR (editor));
- if (!gtk_search_bar_get_search_mode (GTK_SEARCH_BAR (editor)))
- {
- g_signal_emit (editor, signals[CANCEL], 0);
- gtk_widget_hide (priv->popover);
- }
+ return FALSE;
}
static void
@@ -657,8 +642,7 @@ setup_widgets (NautilusQueryEditor *editor)
/* create the search entry */
priv->entry = GTK_WIDGET (gd_tagged_entry_new ());
- gtk_widget_set_size_request (GTK_WIDGET (priv->entry), 400, -1);
- gtk_search_bar_connect_entry (GTK_SEARCH_BAR (editor), GTK_ENTRY (priv->entry));
+ gtk_widget_set_hexpand (priv->entry, TRUE);
gtk_container_add (GTK_CONTAINER (hbox), priv->entry);
@@ -696,8 +680,6 @@ setup_widgets (NautilusQueryEditor *editor)
gtk_menu_button_set_popover (GTK_MENU_BUTTON (priv->dropdown_button), priv->popover);
gtk_container_add (GTK_CONTAINER (hbox), priv->dropdown_button);
- g_signal_connect (editor, "notify::search-mode-enabled",
- G_CALLBACK (search_mode_changed_cb), NULL);
g_signal_connect (priv->entry, "key-press-event",
G_CALLBACK (entry_key_press_event_cb), editor);
g_signal_connect (priv->entry, "activate",
@@ -858,3 +840,14 @@ nautilus_query_editor_set_text (NautilusQueryEditor *editor,
/* The handler of the entry will take care of everything */
gtk_entry_set_text (GTK_ENTRY (priv->entry), text);
}
+
+gboolean
+nautilus_query_editor_handle_event (NautilusQueryEditor *self,
+ GdkEvent *event)
+{
+ NautilusQueryEditorPrivate *priv;
+
+ priv = nautilus_query_editor_get_instance_private (self);
+
+ return gtk_search_entry_handle_event (GTK_SEARCH_ENTRY (priv->entry), event);
+}
diff --git a/src/nautilus-query-editor.h b/src/nautilus-query-editor.h
index d5d298e8d..0a13ad857 100644
--- a/src/nautilus-query-editor.h
+++ b/src/nautilus-query-editor.h
@@ -27,11 +27,11 @@
#define NAUTILUS_TYPE_QUERY_EDITOR nautilus_query_editor_get_type()
-G_DECLARE_DERIVABLE_TYPE (NautilusQueryEditor, nautilus_query_editor, NAUTILUS, QUERY_EDITOR, GtkSearchBar)
+G_DECLARE_DERIVABLE_TYPE (NautilusQueryEditor, nautilus_query_editor, NAUTILUS, QUERY_EDITOR, GtkBox)
struct _NautilusQueryEditorClass
{
- GtkSearchBarClass parent_class;
+ GtkBoxClass parent_class;
void (* changed) (NautilusQueryEditor *editor,
NautilusQuery *query,
@@ -81,4 +81,8 @@ void nautilus_query_editor_set_location (NautilusQueryEditor *editor,
* @text: (not nullable) (transfer none): The search text.
*/
void nautilus_query_editor_set_text (NautilusQueryEditor *editor,
- const gchar *text); \ No newline at end of file
+ const gchar *text);
+
+gboolean
+nautilus_query_editor_handle_event (NautilusQueryEditor *self,
+ GdkEvent *event);
diff --git a/src/nautilus-query.c b/src/nautilus-query.c
index 43afa15d6..59600d195 100644
--- a/src/nautilus-query.c
+++ b/src/nautilus-query.c
@@ -663,8 +663,6 @@ nautilus_query_set_recursive (NautilusQuery *query,
gboolean
nautilus_query_is_empty (NautilusQuery *query)
{
- g_return_val_if_fail (NAUTILUS_IS_QUERY (query), FALSE);
-
if (!query)
{
return TRUE;
diff --git a/src/nautilus-toolbar.c b/src/nautilus-toolbar.c
index 26a978e7d..442abd800 100644
--- a/src/nautilus-toolbar.c
+++ b/src/nautilus-toolbar.c
@@ -65,6 +65,8 @@ struct _NautilusToolbar
GtkWidget *path_bar_container;
GtkWidget *location_entry_container;
+ GtkWidget *search_container;
+ GtkWidget *toolbar_switcher;
GtkWidget *path_bar;
GtkWidget *location_entry;
@@ -102,7 +104,7 @@ struct _NautilusToolbar
NautilusProgressInfoManager *progress_manager;
/* active slot & bindings */
- NautilusWindowSlot *active_slot;
+ NautilusWindowSlot *window_slot;
GBinding *icon_binding;
GBinding *view_widget_binding;
};
@@ -111,6 +113,7 @@ enum
{
PROP_WINDOW = 1,
PROP_SHOW_LOCATION_ENTRY,
+ PROP_WINDOW_SLOT,
NUM_PROPERTIES
};
@@ -129,10 +132,20 @@ toolbar_update_appearance (NautilusToolbar *self)
g_settings_get_boolean (nautilus_preferences,
NAUTILUS_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY);
- gtk_widget_set_visible (self->location_entry_container,
- show_location_entry);
- gtk_widget_set_visible (self->path_bar,
- !show_location_entry);
+
+ if (self->window_slot != NULL &&
+ nautilus_window_slot_get_searching (self->window_slot))
+ {
+ gtk_stack_set_visible_child_name (GTK_STACK (self->toolbar_switcher), "search");
+ }
+ else if (show_location_entry)
+ {
+ gtk_stack_set_visible_child_name (GTK_STACK (self->toolbar_switcher), "location");
+ }
+ else
+ {
+ gtk_stack_set_visible_child_name (GTK_STACK (self->toolbar_switcher), "pathbar");
+ }
}
static void
@@ -150,32 +163,30 @@ activate_back_or_forward_menu_item (GtkMenuItem *menu_item,
}
static void
-activate_back_menu_item_callback (GtkMenuItem *menu_item,
- NautilusWindow *window)
+activate_back_menu_item_callback (GtkMenuItem *menu_item,
+ NautilusToolbar *self)
{
- activate_back_or_forward_menu_item (menu_item, window, TRUE);
+ activate_back_or_forward_menu_item (menu_item, self->window, TRUE);
}
static void
-activate_forward_menu_item_callback (GtkMenuItem *menu_item,
- NautilusWindow *window)
+activate_forward_menu_item_callback (GtkMenuItem *menu_item,
+ NautilusToolbar *self)
{
- activate_back_or_forward_menu_item (menu_item, window, FALSE);
+ activate_back_or_forward_menu_item (menu_item, self->window, FALSE);
}
static void
-fill_menu (NautilusWindow *window,
- GtkWidget *menu,
- gboolean back)
+fill_menu (NautilusToolbar *self,
+ GtkWidget *menu,
+ gboolean back)
{
- NautilusWindowSlot *slot;
GtkWidget *menu_item;
int index;
GList *list;
- slot = nautilus_window_get_active_slot (window);
- list = back ? nautilus_window_slot_get_back_history (slot) :
- nautilus_window_slot_get_forward_history (slot);
+ list = back ? nautilus_window_slot_get_back_history (self->window_slot) :
+ nautilus_window_slot_get_forward_history (self->window_slot);
index = 0;
while (list != NULL)
@@ -187,7 +198,7 @@ fill_menu (NautilusWindow *window,
back
? G_CALLBACK (activate_back_menu_item_callback)
: G_CALLBACK (activate_forward_menu_item_callback),
- window, 0);
+ self, 0);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
list = g_list_next (list);
@@ -200,11 +211,9 @@ show_menu (NautilusToolbar *self,
GtkWidget *widget,
const GdkEvent *event)
{
- NautilusWindow *window;
GtkWidget *menu;
NautilusNavigationDirection direction;
- window = self->window;
menu = gtk_menu_new ();
direction = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (widget),
@@ -214,13 +223,13 @@ show_menu (NautilusToolbar *self,
{
case NAUTILUS_NAVIGATION_DIRECTION_FORWARD:
{
- fill_menu (window, menu, FALSE);
+ fill_menu (self, menu, FALSE);
}
break;
case NAUTILUS_NAVIGATION_DIRECTION_BACK:
{
- fill_menu (window, menu, TRUE);
+ fill_menu (self, menu, TRUE);
}
break;
@@ -231,7 +240,7 @@ show_menu (NautilusToolbar *self,
break;
}
- gtk_menu_attach_to_widget (GTK_MENU (menu), GTK_WIDGET (window), NULL);
+ gtk_menu_attach_to_widget (GTK_MENU (menu), GTK_WIDGET (self->window), NULL);
gtk_menu_popup_at_widget (GTK_MENU (menu), widget,
GDK_GRAVITY_SOUTH_WEST,
GDK_GRAVITY_NORTH_WEST,
@@ -885,23 +894,8 @@ on_location_entry_focus_in_event (GtkWidget *widget,
static void
nautilus_toolbar_init (NautilusToolbar *self)
{
- GtkBuilder *builder;
- GtkWidget *menu_popover;
-
gtk_widget_init_template (GTK_WIDGET (self));
- builder = gtk_builder_new_from_resource ("/org/gnome/nautilus/ui/nautilus-toolbar-menu.ui");
- menu_popover = GTK_WIDGET (gtk_builder_get_object (builder, "menu_popover"));
-
- self->window = NULL;
- self->view_menu_zoom_section = GTK_WIDGET (gtk_builder_get_object (builder, "view_menu_zoom_section"));
- self->view_menu_undo_redo_section = GTK_WIDGET (gtk_builder_get_object (builder, "view_menu_undo_redo_section"));
- self->view_menu_extended_section = GTK_WIDGET (gtk_builder_get_object (builder, "view_menu_extended_section"));
- self->undo_button = GTK_WIDGET (gtk_builder_get_object (builder, "undo"));
- self->redo_button = GTK_WIDGET (gtk_builder_get_object (builder, "redo"));
- gtk_menu_button_set_popover (GTK_MENU_BUTTON (self->view_button), menu_popover);
- g_object_unref (builder);
-
self->path_bar = g_object_new (NAUTILUS_TYPE_PATH_BAR, NULL);
gtk_container_add (GTK_CONTAINER (self->path_bar_container),
self->path_bar);
@@ -994,6 +988,15 @@ nautilus_toolbar_get_property (GObject *object,
}
}
+static void
+on_window_slot_destroyed (gpointer data,
+ GObject *where_the_object_was)
+{
+ NautilusToolbar *self = NAUTILUS_TOOLBAR (data);
+
+ nautilus_toolbar_set_window_slot (self, NULL);
+}
+
/* The working assumption being made here is, if the location entry is visible,
* the user must have switched windows while having keyboard focus on the entry
* (because otherwise it would be invisible),
@@ -1082,6 +1085,12 @@ nautilus_toolbar_set_property (GObject *object,
}
break;
+ case PROP_WINDOW_SLOT:
+ {
+ nautilus_toolbar_set_window_slot (self, g_value_get_object (value));
+ }
+ break;
+
default:
{
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -1097,6 +1106,14 @@ nautilus_toolbar_finalize (GObject *obj)
g_signal_handlers_disconnect_by_func (nautilus_preferences,
toolbar_update_appearance, self);
+
+ if (self->window_slot != NULL)
+ {
+ g_signal_handlers_disconnect_by_data (self->window_slot, self);
+ g_object_weak_unref (G_OBJECT (self->window_slot),
+ on_window_slot_destroyed, self);
+ self->window_slot = NULL;
+ }
disconnect_progress_infos (self);
unschedule_remove_finished_operations (self);
unschedule_operations_start (self);
@@ -1142,6 +1159,14 @@ nautilus_toolbar_class_init (NautilusToolbarClass *klass)
FALSE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+ properties [PROP_WINDOW_SLOT] =
+ g_param_spec_object ("window-slot",
+ "Whether to show the location entry",
+ "Whether to show the location entry instead of the pathbar",
+ NAUTILUS_TYPE_WINDOW_SLOT,
+ (G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
+
g_object_class_install_properties (oclass, NUM_PROPERTIES, properties);
gtk_widget_class_set_template_from_resource (widget_class,
@@ -1152,14 +1177,22 @@ nautilus_toolbar_class_init (NautilusToolbarClass *klass)
gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, operations_popover);
gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, operations_container);
gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, operations_revealer);
+ gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, search_container);
gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, view_button);
gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, view_toggle_button);
gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, view_toggle_icon);
gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, path_bar_container);
gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, location_entry_container);
+ gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, toolbar_switcher);
gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, back_button);
gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, forward_button);
+ gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, view_menu_zoom_section);
+ gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, view_menu_undo_redo_section);
+ gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, view_menu_extended_section);
+ gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, undo_button);
+ gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, redo_button);
+
gtk_widget_class_bind_template_callback (widget_class, on_operations_icon_draw);
gtk_widget_class_bind_template_callback (widget_class, on_operations_button_toggled);
}
@@ -1168,9 +1201,6 @@ GtkWidget *
nautilus_toolbar_new ()
{
return g_object_new (NAUTILUS_TYPE_TOOLBAR,
- "show-close-button", TRUE,
- "custom-title", gtk_label_new (NULL),
- "valign", GTK_ALIGN_CENTER,
NULL);
}
@@ -1199,26 +1229,6 @@ nautilus_toolbar_set_show_location_entry (NautilusToolbar *self,
}
}
-static gboolean
-nautilus_toolbar_view_toggle_icon_transform_to (GBinding *binding,
- const GValue *from_value,
- GValue *to_value,
- gpointer user_data)
-{
- GIcon *icon;
-
- icon = g_value_get_object (from_value);
-
- /* As per design decision, we let the previous used icon if no
- * view menu is available */
- if (icon)
- {
- g_value_set_object (to_value, icon);
- }
-
- return TRUE;
-}
-
static void
container_remove_all_children (GtkContainer *container)
{
@@ -1234,14 +1244,14 @@ container_remove_all_children (GtkContainer *container)
}
static void
-on_slot_toolbar_menu_sections_changed (NautilusToolbar *toolbar,
+on_slot_toolbar_menu_sections_changed (NautilusToolbar *self,
GParamSpec *param,
NautilusWindowSlot *slot)
{
NautilusToolbarMenuSections *new_sections;
- container_remove_all_children (GTK_CONTAINER (toolbar->view_menu_zoom_section));
- container_remove_all_children (GTK_CONTAINER (toolbar->view_menu_extended_section));
+ container_remove_all_children (GTK_CONTAINER (self->view_menu_zoom_section));
+ container_remove_all_children (GTK_CONTAINER (self->view_menu_extended_section));
new_sections = nautilus_window_slot_get_toolbar_menu_sections (slot);
if (new_sections == NULL)
@@ -1249,62 +1259,125 @@ on_slot_toolbar_menu_sections_changed (NautilusToolbar *toolbar,
return;
}
- gtk_widget_set_visible (toolbar->view_menu_undo_redo_section,
+ gtk_widget_set_visible (self->view_menu_undo_redo_section,
new_sections->supports_undo_redo);
if (new_sections->zoom_section != NULL)
{
- gtk_box_pack_start (GTK_BOX (toolbar->view_menu_zoom_section), new_sections->zoom_section, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (self->view_menu_zoom_section),
+ new_sections->zoom_section, FALSE, FALSE, 0);
}
if (new_sections->extended_section != NULL)
{
- gtk_box_pack_start (GTK_BOX (toolbar->view_menu_extended_section), new_sections->extended_section, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (self->view_menu_extended_section),
+ new_sections->extended_section, FALSE, FALSE, 0);
}
+
+ gtk_widget_set_sensitive (self->view_button, new_sections->extended_section != NULL ||
+ new_sections->zoom_section != NULL ||
+ new_sections->supports_undo_redo);
}
+
static void
-disconnect_toolbar_menu_sections_change_handler (NautilusToolbar *toolbar)
+disconnect_toolbar_menu_sections_change_handler (NautilusToolbar *self)
{
- if (toolbar->active_slot == NULL)
+ if (self->window_slot == NULL)
{
return;
}
- g_signal_handlers_disconnect_by_func (toolbar->active_slot,
+ g_signal_handlers_disconnect_by_func (self->window_slot,
G_CALLBACK (on_slot_toolbar_menu_sections_changed),
- toolbar);
+ self);
+}
+
+static gboolean
+nautilus_toolbar_view_toggle_icon_transform_to (GBinding *binding,
+ const GValue *from_value,
+ GValue *to_value,
+ gpointer user_data)
+{
+ GIcon *icon;
+
+ icon = g_value_get_object (from_value);
+
+ /* As per design decision, we let the previous used icon if no
+ * view menu is available */
+ if (icon)
+ {
+ g_value_set_object (to_value, icon);
+ }
+
+ return TRUE;
}
void
-nautilus_toolbar_set_active_slot (NautilusToolbar *toolbar,
- NautilusWindowSlot *slot)
+nautilus_toolbar_set_window_slot (NautilusToolbar *self,
+ NautilusWindowSlot *window_slot)
{
- g_return_if_fail (NAUTILUS_IS_TOOLBAR (toolbar));
+ g_return_if_fail (NAUTILUS_IS_TOOLBAR (self));
- g_clear_pointer (&toolbar->icon_binding, g_binding_unbind);
- g_clear_pointer (&toolbar->view_widget_binding, g_binding_unbind);
+ g_clear_pointer (&self->icon_binding, g_binding_unbind);
+ g_clear_pointer (&self->view_widget_binding, g_binding_unbind);
- if (toolbar->active_slot != slot)
+ if (self->window_slot != window_slot)
{
- disconnect_toolbar_menu_sections_change_handler (toolbar);
- toolbar->active_slot = slot;
+ GList *children;
- if (slot)
+ disconnect_toolbar_menu_sections_change_handler (self);
+ if (self->window_slot != NULL)
{
- toolbar->icon_binding =
- g_object_bind_property_full (slot, "icon",
- toolbar->view_toggle_icon, "gicon",
- G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE,
- (GBindingTransformFunc) nautilus_toolbar_view_toggle_icon_transform_to,
- NULL,
- toolbar,
- NULL);
-
- on_slot_toolbar_menu_sections_changed (toolbar, NULL, slot);
- g_signal_connect_swapped (slot, "notify::toolbar-menu-sections",
- G_CALLBACK (on_slot_toolbar_menu_sections_changed), toolbar);
+ g_signal_handlers_disconnect_by_data (self->window_slot, self);
+ g_object_weak_unref (G_OBJECT (self->window_slot),
+ on_window_slot_destroyed, self);
+ self->window_slot = NULL;
}
+
+ self->window_slot = window_slot;
+
+ if (self->window_slot)
+ {
+ g_object_weak_ref (G_OBJECT (self->window_slot),
+ on_window_slot_destroyed,
+ self);
+
+ self->icon_binding = g_object_bind_property_full (self->window_slot, "icon",
+ self->view_toggle_icon, "gicon",
+ G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE,
+ (GBindingTransformFunc) nautilus_toolbar_view_toggle_icon_transform_to,
+ NULL,
+ self,
+ NULL);
+
+ on_slot_toolbar_menu_sections_changed (self, NULL, self->window_slot);
+ g_signal_connect_swapped (self->window_slot, "notify::toolbar-menu-sections",
+ G_CALLBACK (on_slot_toolbar_menu_sections_changed), self);
+
+ g_signal_connect_swapped (window_slot, "notify::searching",
+ G_CALLBACK (toolbar_update_appearance), self);
+
+ }
+
+ children = gtk_container_get_children (GTK_CONTAINER (self->search_container));
+ if (children != NULL)
+ {
+ gtk_container_remove (GTK_CONTAINER (self->search_container),
+ children->data);
+ }
+
+ if (self->window_slot != NULL)
+ {
+ GTK_WIDGET (nautilus_window_slot_get_query_editor (self->window_slot));
+ GTK_CONTAINER (self->search_container);
+ gtk_container_add (GTK_CONTAINER (self->search_container),
+ GTK_WIDGET (nautilus_window_slot_get_query_editor (self->window_slot)));
+ }
+
+ toolbar_update_appearance (self);
+
+ g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_WINDOW_SLOT]);
}
}
diff --git a/src/nautilus-toolbar.h b/src/nautilus-toolbar.h
index 36ce4f080..13f00721e 100644
--- a/src/nautilus-toolbar.h
+++ b/src/nautilus-toolbar.h
@@ -50,4 +50,6 @@ gboolean nautilus_toolbar_is_operations_button_active (NautilusToolbar *toolba
void nautilus_toolbar_on_window_constructed (NautilusToolbar *toolbar);
-G_END_DECLS \ No newline at end of file
+void nautilus_toolbar_set_window_slot (NautilusToolbar *self,
+ NautilusWindowSlot *window_slot);
+G_END_DECLS
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index 1ff5747f2..511043551 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -635,8 +635,8 @@ nautilus_window_slot_handle_event (NautilusWindowSlot *self,
/* If the action is not enabled, don't try to handle search */
if (g_action_get_enabled (action))
{
- retval = gtk_search_bar_handle_event (GTK_SEARCH_BAR (priv->query_editor),
- (GdkEvent *) event);
+ retval = nautilus_query_editor_handle_event (priv->query_editor,
+ (GdkEvent *) event);
}
if (retval)
@@ -888,12 +888,12 @@ action_search_visible (GSimpleAction *action,
if (g_variant_get_boolean (state))
{
show_query_editor (self);
- g_object_set (self, "searching", TRUE, NULL);
+ nautilus_window_slot_set_searching (self, TRUE);
}
else
{
hide_query_editor (self);
- g_object_set (self, "searching", FALSE, NULL);
+ nautilus_window_slot_set_searching (self, FALSE);
}
}
@@ -3360,3 +3360,15 @@ nautilus_window_slot_get_loading (NautilusWindowSlot *self)
return priv->loading;
}
+
+NautilusQueryEditor *
+nautilus_window_slot_get_query_editor (NautilusWindowSlot *self)
+{
+ NautilusWindowSlotPrivate *priv;
+
+ g_return_val_if_fail (NAUTILUS_IS_WINDOW_SLOT (self), NULL);
+
+ priv = nautilus_window_slot_get_instance_private (self);
+
+ return priv->query_editor;
+}
diff --git a/src/nautilus-window-slot.h b/src/nautilus-window-slot.h
index 86b441fdc..4cf323027 100644
--- a/src/nautilus-window-slot.h
+++ b/src/nautilus-window-slot.h
@@ -125,5 +125,7 @@ void nautilus_window_slot_restore_from_data (NautilusWindowSlot *self,
RestoreTabData* nautilus_window_slot_get_restore_tab_data (NautilusWindowSlot *self);
+NautilusQueryEditor *nautilus_window_slot_get_query_editor (NautilusWindowSlot *self);
+
/* Only used by slot-dnd */
NautilusView* nautilus_window_slot_get_current_view (NautilusWindowSlot *slot);
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 598064d02..a931b0524 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -2081,6 +2081,8 @@ setup_toolbar (NautilusWindow *window)
G_CALLBACK (location_entry_location_changed_callback), window, 0);
g_signal_connect_object (location_entry, "cancel",
G_CALLBACK (location_entry_cancel_callback), window, 0);
+
+ gtk_window_set_titlebar (GTK_WINDOW (window), priv->toolbar);
}
static void
@@ -2544,6 +2546,7 @@ nautilus_window_set_active_slot (NautilusWindow *window,
{
/* inform slot & view */
nautilus_window_slot_set_active (old_slot, FALSE);
+ nautilus_toolbar_set_window_slot (NAUTILUS_TOOLBAR (priv->toolbar), NULL);
}
priv->active_slot = new_slot;
@@ -2551,10 +2554,10 @@ nautilus_window_set_active_slot (NautilusWindow *window,
/* make new slot active, if it exists */
if (new_slot)
{
- nautilus_toolbar_set_active_slot (NAUTILUS_TOOLBAR (priv->toolbar), new_slot);
/* inform slot & view */
nautilus_window_slot_set_active (new_slot, TRUE);
+ nautilus_toolbar_set_window_slot (NAUTILUS_TOOLBAR (priv->toolbar), new_slot);
on_location_changed (window);
}
@@ -2800,6 +2803,8 @@ nautilus_window_init (NautilusWindow *window)
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (window)),
"nautilus-window");
+ priv->toolbar = nautilus_toolbar_new ();
+
window_group = gtk_window_group_new ();
gtk_window_group_add_window (window_group, GTK_WINDOW (window));
g_object_unref (window_group);
@@ -2847,7 +2852,6 @@ nautilus_window_class_init (NautilusWindowClass *class)
gtk_widget_class_set_template_from_resource (wclass,
"/org/gnome/nautilus/ui/nautilus-window.ui");
- gtk_widget_class_bind_template_child_private (wclass, NautilusWindow, toolbar);
gtk_widget_class_bind_template_child_private (wclass, NautilusWindow, content_paned);
gtk_widget_class_bind_template_child_private (wclass, NautilusWindow, sidebar);
gtk_widget_class_bind_template_child_private (wclass, NautilusWindow, places_sidebar);
diff --git a/src/resources/css/Adwaita.css b/src/resources/css/Adwaita.css
index fcb1843e6..61fc11386 100644
--- a/src/resources/css/Adwaita.css
+++ b/src/resources/css/Adwaita.css
@@ -45,6 +45,10 @@
animation-iteration-count: 3;
}
+.disclosure-button {
+ padding: 4px;
+}
+
/* Path bar */
.path-bar button { /* undecorate the buttons */
@@ -55,12 +59,12 @@
border-radius: 0;
text-shadow: none;
-gtk-icon-shadow: none;
+ padding: 4px;
+ border-width: 0px;
+ margin: 0px;
}
.path-bar .slider-button { /* margins are for the round keynav indicator */
- margin-top: 10px;
- margin-bottom: 11px;
- -gtk-outline-radius: 50px;
opacity: 0.7;
}
@@ -85,6 +89,11 @@
box-shadow: 0 3px @theme_selected_bg_color;
}
+.pathbar-box {
+ border: 1px @borders solid;
+ border-radius: 2px;
+}
+
/* Sidebar */
.sidebar-row:selected {
diff --git a/src/resources/nautilus.gresource.xml b/src/resources/nautilus.gresource.xml
index 3c6fe18a9..117431e4e 100644
--- a/src/resources/nautilus.gresource.xml
+++ b/src/resources/nautilus.gresource.xml
@@ -6,7 +6,6 @@
<file>gtk/menus.ui</file>
<file>ui/nautilus-pathbar-context-menu.ui</file>
<file>ui/nautilus-toolbar.ui</file>
- <file>ui/nautilus-toolbar-menu.ui</file>
<file>ui/nautilus-toolbar-view-menu.ui</file>
<file>ui/nautilus-create-folder-dialog.ui</file>
<file>ui/nautilus-compress-dialog.ui</file>
diff --git a/src/resources/ui/nautilus-toolbar-menu.ui b/src/resources/ui/nautilus-toolbar-menu.ui
deleted file mode 100644
index 384558dc1..000000000
--- a/src/resources/ui/nautilus-toolbar-menu.ui
+++ /dev/null
@@ -1,128 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<interface>
- <object class="GtkPopoverMenu" id="menu_popover">
- <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="width_request">160</property>
- <child>
- <object class="GtkBox">
- <property name="visible">True</property>
- <property name="orientation">horizontal</property>
- <property name="homogeneous">True</property>
- <style>
- <class name="linked"/>
- </style>
- <child>
- <object class="GtkButton" id="new-folder">
- <property name="visible">True</property>
- <property name="action_name">view.new-folder</property>
- <property name="tooltip-text" translatable="yes">New folder</property>
- <child>
- <object class="GtkImage">
- <property name="visible">True</property>
- <property name="icon-name">folder-new-symbolic</property>
- <property name="icon-size">1</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="bookmark-this-location">
- <property name="visible">True</property>
- <property name="action_name">win.bookmark-current-location</property>
- <property name="tooltip-text" translatable="yes">Bookmark this location</property>
- <child>
- <object class="GtkImage">
- <property name="visible">True</property>
- <property name="icon-name">bookmark-new-symbolic</property>
- <property name="icon-size">1</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="new-tab">
- <property name="visible">True</property>
- <property name="action-name">win.new-tab</property>
- <property name="tooltip-text" translatable="yes">New tab</property>
- <child>
- <object class="GtkImage">
- <property name="visible">True</property>
- <property name="icon-name">tab-new-symbolic</property>
- <property name="icon-size">1</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">2</property>
- </packing>
- </child>
- </object>
- </child>
- <child>
- <!-- Zoom controls are added to this, if the view supports them -->
- <object class="GtkBox" id="view_menu_zoom_section">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="orientation">vertical</property>
- </object>
- </child>
- <child>
- <object class="GtkBox" id="view_menu_undo_redo_section">
- <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>
- <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>
- </object>
- </child>
- <child>
- <!-- Other controls custom to the view are added to this -->
- <object class="GtkBox" id="view_menu_extended_section">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="orientation">vertical</property>
- </object>
- </child>
- </object>
- </child>
- </object>
-</interface>
diff --git a/src/resources/ui/nautilus-toolbar-view-menu.ui b/src/resources/ui/nautilus-toolbar-view-menu.ui
index 2aefd3bcd..d585e0f72 100644
--- a/src/resources/ui/nautilus-toolbar-view-menu.ui
+++ b/src/resources/ui/nautilus-toolbar-view-menu.ui
@@ -10,7 +10,6 @@
<property name="visible">True</property>
<property name="orientation">horizontal</property>
<property name="homogeneous">True</property>
- <property name="margin-top">9</property>
<style>
<class name="linked"/>
</style>
diff --git a/src/resources/ui/nautilus-toolbar.ui b/src/resources/ui/nautilus-toolbar.ui
index 59d3fea04..959b18e9f 100644
--- a/src/resources/ui/nautilus-toolbar.ui
+++ b/src/resources/ui/nautilus-toolbar.ui
@@ -1,215 +1,551 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
<interface>
- <!-- interface-requires gtk+ 3.8 -->
- <template class="NautilusToolbar" parent="GtkHeaderBar">
- <property name="visible">True</property>
- <property name="show-close-button">True</property>
+ <requires lib="gtk+" version="3.22"/>
+ <object class="GtkPopoverMenu" id="app_menu">
+ <property name="can_focus">False</property>
<child>
- <object class="GtkBox" id="navigation_box">
+ <object class="GtkBox">
<property name="visible">True</property>
- <property name="orientation">horizontal</property>
- <style>
- <class name="linked"/>
- <class name="raised"/>
- </style>
+ <property name="can_focus">False</property>
+ <property name="margin_left">10</property>
+ <property name="margin_right">10</property>
+ <property name="margin_top">10</property>
+ <property name="margin_bottom">10</property>
+ <property name="orientation">vertical</property>
<child>
- <object class="GtkButton" id="back_button">
+ <object class="GtkModelButton">
<property name="visible">True</property>
- <property name="sensitive">True</property>
- <property name="action_name">win.back</property>
- <property name="tooltip-text" translatable="yes">Go 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>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="action_name">app.new-window</property>
+ <property name="text" translatable="yes">New Window</property>
</object>
<packing>
- <property name="pack-type">start</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="forward_button">
+ <object class="GtkModelButton">
<property name="visible">True</property>
- <property name="sensitive">True</property>
- <property name="action_name">win.forward</property>
- <property name="tooltip-text" translatable="yes">Go 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>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="action_name">win.new-tab</property>
+ <property name="text" translatable="yes">New Tab</property>
</object>
<packing>
- <property name="pack-type">start</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSeparator">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkModelButton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="action_name">app.preferences</property>
+ <property name="text" translatable="yes">Preferences</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkModelButton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="action_name">app.help</property>
+ <property name="text" translatable="yes">Help</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkModelButton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="action_name">app.about</property>
+ <property name="text" translatable="yes">About</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">5</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">
- <style>
- <class name="linked"/>
- </style>
- </object>
- <packing>
- <property name="pack-type">start</property>
+ <property name="submenu">main</property>
+ <property name="position">1</property>
</packing>
</child>
+ </object>
+ <object class="GtkPopoverMenu" id="menu_popover">
+ <property name="can_focus">False</property>
<child>
- <object class="GtkMenuButton" id="view_button">
+ <object class="GtkBox">
+ <property name="width_request">160</property>
<property name="visible">True</property>
- <property name="sensitive">True</property>
- <property name="action_name">win.view-menu</property>
- <property name="tooltip-text" translatable="yes">Open menu</property>
- <!-- Popover defined in nautilus-toolbar-menu.ui -->
- <style>
- <class name="image-button"/>
- </style>
+ <property name="can_focus">False</property>
+ <property name="border_width">9</property>
+ <property name="orientation">vertical</property>
<child>
- <object class="GtkImage">
+ <object class="GtkBox" id="view_menu_zoom_section">
<property name="visible">True</property>
- <property name="icon-name">open-menu-symbolic</property>
- <property name="icon-size">1</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <placeholder/>
+ </child>
</object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
</child>
- <child internal-child="accessible">
- <object class="AtkObject">
- <property name="accessible-name" translatable="yes">Action menu</property>
- <property name="accessible-description" translatable="yes">Open action menu</property>
+ <child>
+ <object class="GtkBox" id="view_menu_undo_redo_section">
+ <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="can_focus">False</property>
+ <property name="margin_top">6</property>
+ <property name="margin_bottom">6</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkModelButton" id="undo_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="action_name">win.undo</property>
+ <property name="text" translatable="yes">_Undo</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkModelButton" id="redo_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="action_name">win.redo</property>
+ <property name="text" translatable="yes">_Redo</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="view_menu_extended_section">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <placeholder/>
+ </child>
</object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">3</property>
+ </packing>
</child>
</object>
<packing>
- <property name="pack-type">end</property>
+ <property name="submenu">main</property>
+ <property name="position">1</property>
</packing>
</child>
+ </object>
+ <object class="GtkPopover" id="operations_popover">
+ <property name="can_focus">False</property>
<child>
- <object class="GtkButton" id="view_toggle_button">
+ <object class="GtkScrolledWindow">
<property name="visible">True</property>
- <property name="sensitive">True</property>
- <property name="action_name">slot.files-view-mode-toggle</property>
- <property name="tooltip-text" translatable="yes">Toggle view</property>
- <style>
- <class name="image-button"/>
- </style>
+ <property name="can_focus">False</property>
+ <property name="hscrollbar_policy">never</property>
+ <property name="max_content_height">270</property>
+ <property name="propagate_natural_height">True</property>
<child>
- <object class="GtkImage" id="view_toggle_icon">
+ <object class="GtkViewport">
<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 mode toggle</property>
- <property name="accessible-description" translatable="yes">Toggle between grid and list view</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkBox" id="operations_container">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin_left">12</property>
+ <property name="margin_right">12</property>
+ <property name="margin_top">12</property>
+ <property name="margin_bottom">12</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">10</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ </child>
</object>
</child>
</object>
- <packing>
- <property name="pack-type">end</property>
- </packing>
</child>
+ </object>
+ <template class="NautilusToolbar" parent="GtkHeaderBar">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="show_close_button">True</property>
<child>
- <object class="GtkToggleButton" id="search_button">
+ <object class="GtkBox" id="navigation_box">
<property name="visible">True</property>
- <property name="sensitive">True</property>
- <property name="action_name">slot.search-visible</property>
- <property name="tooltip-text" translatable="yes">Search</property>
- <style>
- <class name="image-button"/>
- </style>
+ <property name="can_focus">False</property>
<child>
- <object class="GtkImage" id="search_icon">
+ <object class="GtkButton" id="back_button">
<property name="visible">True</property>
- <property name="icon-name">edit-find-symbolic</property>
- <property name="icon-size">1</property>
+ <property name="can_focus">False</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip_text" translatable="yes">Go back</property>
+ <property name="action_name">win.back</property>
+ <child>
+ <object class="GtkImage" id="back_icon">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">go-previous-symbolic</property>
+ <property name="icon_size">1</property>
+ </object>
+ </child>
+ <style>
+ <class name="image-button"/>
+ </style>
</object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
</child>
- <child internal-child="accessible">
- <object class="AtkObject">
- <property name="accessible-name" translatable="yes">Search</property>
- <property name="accessible-description" translatable="yes">Search files</property>
+ <child>
+ <object class="GtkButton" id="forward_button">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip_text" translatable="yes">Go forward</property>
+ <property name="action_name">win.forward</property>
+ <child>
+ <object class="GtkImage" id="forward_icon">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">go-next-symbolic</property>
+ <property name="icon_size">1</property>
+ </object>
+ </child>
+ <style>
+ <class name="image-button"/>
+ </style>
</object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
</child>
+ <style>
+ <class name="linked"/>
+ <class name="raised"/>
+ </style>
</object>
- <packing>
- <property name="pack-type">end</property>
- </packing>
</child>
- <child>
- <object class="GtkRevealer" id="operations_revealer">
+ <child type="title">
+ <object class="GtkBox" id="header_toolbar">
<property name="visible">True</property>
- <property name="transition-type">GTK_REVEALER_TRANSITION_TYPE_CROSSFADE</property>
+ <property name="can_focus">False</property>
+ <property name="margin_left">24</property>
+ <property name="margin_right">24</property>
+ <property name="spacing">6</property>
<child>
- <object class="GtkMenuButton" id="operations_button">
- <property name="visible">False</property>
- <property name="popover">operations_popover</property>
- <property name="tooltip-text" translatable="yes">Show operations</property>
- <signal name="toggled" handler="on_operations_button_toggled" object="NautilusToolbar" swapped="yes"/>
- <style>
- <class name="button"/>
- </style>
+ <object class="GtkStack" id="toolbar_switcher">
+ <property name="width_request">300</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="transition_type">crossfade</property>
<child>
- <object class="GtkDrawingArea" id="operations_icon">
+ <object class="GtkBox" id="path_bar_container">
+ <property name="can_focus">False</property>
+ <property name="valign">center</property>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <style>
+ <class name="pathbar-box"/>
+ </style>
+ </object>
+ <packing>
+ <property name="name">pathbar</property>
+ <property name="title" translatable="yes">page0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="location_entry_container">
+ <property name="can_focus">False</property>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <style>
+ <class name="linked"/>
+ </style>
+ </object>
+ <packing>
+ <property name="name">location</property>
+ <property name="title" translatable="yes">page1</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="search_container">
<property name="visible">True</property>
- <property name="height-request">16</property>
- <property name="width-request">16</property>
- <property name="valign">GTK_ALIGN_CENTER</property>
- <property name="halign">GTK_ALIGN_CENTER</property>
- <signal name="draw" handler="on_operations_icon_draw" object="NautilusToolbar" swapped="no"/>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</object>
+ <packing>
+ <property name="name">search</property>
+ <property name="title" translatable="yes">page2</property>
+ <property name="position">2</property>
+ </packing>
</child>
- <child internal-child="accessible">
- <object class="AtkObject">
- <property name="accessible-name" translatable="yes">Operations in progress</property>
- <property name="accessible-description" translatable="yes">Show operations in progress</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToggleButton" id="search_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip_text" translatable="yes">Search</property>
+ <property name="action_name">slot.search-visible</property>
+ <child>
+ <object class="GtkImage" id="search_icon">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">edit-find-symbolic</property>
+ <property name="icon_size">1</property>
</object>
</child>
+ <style>
+ <class name="image-button"/>
+ </style>
</object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
</child>
</object>
<packing>
- <property name="pack-type">end</property>
+ <property name="pack_type">end</property>
</packing>
</child>
- </template>
- <object class="GtkPopover" id="operations_popover">
<child>
- <object class="GtkScrolledWindow">
+ <object class="GtkBox">
<property name="visible">True</property>
- <property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
- <property name="max-content-height">270</property>
- <property name="propagate-natural-height">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">6</property>
<child>
- <object class="GtkBox" id="operations_container">
- <property name="orientation">vertical</property>
+ <object class="GtkRevealer" id="operations_revealer">
<property name="visible">True</property>
- <property name="margin">12</property>
- <property name="spacing">10</property>
+ <property name="can_focus">False</property>
+ <property name="transition_type">crossfade</property>
+ <child>
+ <object class="GtkMenuButton" id="operations_button">
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip_text" translatable="yes">Show operations</property>
+ <property name="popover">operations_popover</property>
+ <signal name="toggled" handler="on_operations_button_toggled" object="NautilusToolbar" swapped="yes"/>
+ <child>
+ <object class="GtkDrawingArea" id="operations_icon">
+ <property name="width_request">16</property>
+ <property name="height_request">16</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">center</property>
+ <property name="valign">center</property>
+ <signal name="draw" handler="on_operations_icon_draw" object="NautilusToolbar" swapped="no"/>
+ </object>
+ </child>
+ <style>
+ <class name="button"/>
+ </style>
+ </object>
+ </child>
</object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkButton" id="view_toggle_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip_text" translatable="yes">Toggle view</property>
+ <property name="action_name">slot.files-view-mode-toggle</property>
+ <child>
+ <object class="GtkImage" id="view_toggle_icon">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_size">1</property>
+ </object>
+ </child>
+ <style>
+ <class name="image-button"/>
+ </style>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkMenuButton" id="view_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="halign">start</property>
+ <property name="action_name">win.view-menu</property>
+ <property name="popover">menu_popover</property>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">pan-down-symbolic</property>
+ </object>
+ </child>
+ <style>
+ <class name="disclosure-button"/>
+ </style>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <style>
+ <class name="linked"/>
+ </style>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkMenuButton" id="app_button">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip_text" translatable="yes">Open menu</property>
+ <property name="popover">app_menu</property>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">open-menu-symbolic</property>
+ <property name="icon_size">1</property>
+ </object>
+ </child>
+ <style>
+ <class name="image-button"/>
+ </style>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">3</property>
+ </packing>
</child>
</object>
+ <packing>
+ <property name="pack_type">end</property>
+ <property name="position">3</property>
+ </packing>
</child>
- </object>
+ </template>
</interface>
diff --git a/src/resources/ui/nautilus-window.ui b/src/resources/ui/nautilus-window.ui
index 52efc2ecc..4eef37c11 100644
--- a/src/resources/ui/nautilus-window.ui
+++ b/src/resources/ui/nautilus-window.ui
@@ -3,18 +3,6 @@
<template class="NautilusWindow" parent="GtkApplicationWindow">
<property name="show-menubar">False</property>
<property name="title" translatable="yes">_Files</property>
- <child type="titlebar">
- <object class="NautilusToolbar" id="toolbar">
- <!-- We override the title widget so the GtkHeaderBar stop managing the
- title label automatically, since we use the NautilusPathBar. We need to set it
- here rather than in the NautilusToolbar definition due to bug 744324 on
- gtk+ . -->
- <child type="title">
- <object class="GtkLabel">
- </object>
- </child>
- </object>
- </child>
<child>
<object class="GtkGrid">
<property name="visible">True</property>