diff options
author | Carlos Soriano <csoriano@gnome.org> | 2015-07-22 13:24:56 +0200 |
---|---|---|
committer | Carlos Soriano <csoriano@gnome.org> | 2015-07-22 13:27:58 +0200 |
commit | 00f67d86873c9ec9baf8cd4884bf73f87db227e9 (patch) | |
tree | a6e868463b91861c5d1571b5990d909805686c4f | |
parent | 61116b34914cbe2e220863dbd4b70b15cebf7b62 (diff) | |
download | nautilus-00f67d86873c9ec9baf8cd4884bf73f87db227e9.tar.gz |
window: don't set list view as default when searching
We recently made a change that the view switchs automatically
to list view if it is searching.
But we introduced a bug, we were setting as default list view in
that case, and therefore if nautilus was closed while searching
the default view mode changed to list view.
Fix that and only set as default list view if we are not searching
and "switch to list view on search" setting is set.
-rw-r--r-- | src/nautilus-window.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/src/nautilus-window.c b/src/nautilus-window.c index 1b767726d..d78eac601 100644 --- a/src/nautilus-window.c +++ b/src/nautilus-window.c @@ -440,39 +440,39 @@ 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) { const gchar *name; NautilusWindowSlot *slot; + GFile *location; name = g_variant_get_string (value, NULL); slot = nautilus_window_get_active_slot (NAUTILUS_WINDOW (user_data)); if (g_strcmp0 (name, "list") == 0) { nautilus_window_slot_set_content_view (slot, NAUTILUS_LIST_VIEW_ID); - g_settings_set_enum (nautilus_preferences, - NAUTILUS_PREFERENCES_DEFAULT_FOLDER_VIEWER, - NAUTILUS_DEFAULT_FOLDER_VIEWER_LIST_VIEW); + /* If this change is caused because of the automatic list view + * switch for search, don't set as default list view */ + location = nautilus_window_slot_get_location (slot); + if (!(nautilus_file_is_in_search (nautilus_file_get (location)) && + g_settings_get_boolean (nautilus_preferences, NAUTILUS_PREFERENCES_LIST_VIEW_ON_SEARCH))) {; + g_settings_set_enum (nautilus_preferences, + 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); + + /* If the user manually changed the view mode to grid, disable the automatic + * switch to list view on search */ + 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); + } g_settings_set_enum (nautilus_preferences, NAUTILUS_PREFERENCES_DEFAULT_FOLDER_VIEWER, NAUTILUS_DEFAULT_FOLDER_VIEWER_ICON_VIEW); |