diff options
Diffstat (limited to 'src/nautilus-window.c')
-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); |