[nautilus] file: use specific file type for Sort by Type



commit a3369c5a4b36275d624939ac9e8dd5643aef2996
Author: Rajat Jain <rajatjain ix gmail com>
Date:   Mon Apr 19 17:50:15 2021 +0530

    file: use specific file type for Sort by Type
    
    Adds file comparison based on actual file type, rather than generic
    type category. For example .jpg and .png files will now be sorted
    into two different groups.
    
    Fixes https://gitlab.gnome.org/GNOME/nautilus/-/issues/1776
    
    Signed-off-by: Rajat Jain <rajatjain ix gmail com>

 src/nautilus-file.c | 5 +++++
 1 file changed, 5 insertions(+)
---
diff --git a/src/nautilus-file.c b/src/nautilus-file.c
index c14356d8f..5d6efdcb2 100644
--- a/src/nautilus-file.c
+++ b/src/nautilus-file.c
@@ -3480,6 +3480,11 @@ compare_by_type (NautilusFile *file_1,
     }
 
     result = g_utf8_collate (type_string_1, type_string_2);
+    if (result == 0)
+    {
+        /* Among files of the same (generic) type, sort them by mime type. */
+        result = g_utf8_collate (file_1->details->mime_type, file_2->details->mime_type);
+    }
 
     g_free (type_string_1);
     g_free (type_string_2);


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