diff options
author | Carlos Soriano <csoriano@gnome.org> | 2015-07-20 17:56:30 +0200 |
---|---|---|
committer | Carlos Soriano <csoriano@gnome.org> | 2015-07-20 18:41:48 +0200 |
commit | 46d18fecc33d5a9a85f90ca2aa58d5017f3415de (patch) | |
tree | 65a38c923494db157e7824d53369fccd1c076ed8 /src/nautilus-window.c | |
parent | 8f2f9025939b5bbac75deee4bc2c448e22bed60c (diff) | |
download | nautilus-46d18fecc33d5a9a85f90ca2aa58d5017f3415de.tar.gz |
window-slot: switch to list view on search
When searching, list view is a better view given that we can see
more attributes of the files, for instance, the location is
a important part for discerning files in the current folder or
in nested folders.
For that, switch to list view while searching, and disable this behavior
if the user changes the view mode while searching.
Diffstat (limited to 'src/nautilus-window.c')
-rw-r--r-- | src/nautilus-window.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/nautilus-window.c b/src/nautilus-window.c index 30fb9ecd8..f77a73e76 100644 --- a/src/nautilus-window.c +++ b/src/nautilus-window.c @@ -440,6 +440,19 @@ action_toggle_state_action_button (GSimpleAction *action, } static void +check_use_list_view_on_search (NautilusWindowSlot *slot) +{ + GFile *location; + + location = nautilus_window_slot_get_location (slot); + if (nautilus_file_is_in_search (nautilus_file_get (location))) { + g_settings_set_boolean (nautilus_preferences, + NAUTILUS_PREFERENCES_LIST_VIEW_ON_SEARCH, + FALSE); + } +} + +static void action_view_mode (GSimpleAction *action, GVariant *value, gpointer user_data) @@ -456,6 +469,9 @@ action_view_mode (GSimpleAction *action, NAUTILUS_PREFERENCES_DEFAULT_FOLDER_VIEWER, NAUTILUS_DEFAULT_FOLDER_VIEWER_LIST_VIEW); } else if (g_strcmp0 (name, "grid") == 0) { + /* If the user manually changed the view mode, disable the automatic + * switch to list view on search */ + check_use_list_view_on_search (slot); nautilus_window_slot_set_content_view (slot, NAUTILUS_CANVAS_VIEW_ID); g_settings_set_enum (nautilus_preferences, NAUTILUS_PREFERENCES_DEFAULT_FOLDER_VIEWER, |