[nautilus] list-base: Ignore sort metadata on some locations



commit 1232c5cfcd0147f59feeca62159e598331152807
Author: António Fernandes <antoniof gnome org>
Date:   Sun Sep 4 13:53:31 2022 +0100

    list-base: Ignore sort metadata on some locations
    
    If you change the sort order from the sort menu, the next time you
    visit that location, the last sort option is remembered.
    
    This is generally desirable behavior, but not in the case of Recent,
    Search or Trash.
    
    Fixes https://gitlab.gnome.org/GNOME/nautilus/-/issues/2472

 src/nautilus-list-base.c | 8 ++++++++
 1 file changed, 8 insertions(+)
---
diff --git a/src/nautilus-list-base.c b/src/nautilus-list-base.c
index af063e99b..f4673b9d3 100644
--- a/src/nautilus-list-base.c
+++ b/src/nautilus-list-base.c
@@ -172,6 +172,14 @@ get_directory_sort_by (NautilusFile *file,
     default_sort = get_default_sort_order (file, reversed);
     g_return_val_if_fail (default_sort != NULL, NULL);
 
+    if (default_sort->sort_type == NAUTILUS_FILE_SORT_BY_RECENCY ||
+        default_sort->sort_type == NAUTILUS_FILE_SORT_BY_TRASHED_TIME ||
+        default_sort->sort_type == NAUTILUS_FILE_SORT_BY_SEARCH_RELEVANCE)
+    {
+        /* These defaults are important. Ignore metadata. */
+        return default_sort;
+    }
+
     sort_by = nautilus_file_get_metadata (file,
                                           NAUTILUS_METADATA_KEY_ICON_VIEW_SORT_BY,
                                           default_sort->metadata_name);


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