summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntónio Fernandes <antoniof@gnome.org>2022-09-04 13:53:31 +0100
committerAntónio Fernandes <antoniof@gnome.org>2022-09-04 13:53:31 +0100
commit1232c5cfcd0147f59feeca62159e598331152807 (patch)
tree37284ac802bab2973a204ce8b2948ea50202d40b
parent4b4bdf9d15a5cd7cbe7e00f9be82a9b7ab847103 (diff)
downloadnautilus-1232c5cfcd0147f59feeca62159e598331152807.tar.gz
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
-rw-r--r--src/nautilus-list-base.c8
1 files changed, 8 insertions, 0 deletions
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);