From 0585258dc117b50cf8e8f6b5361fd815cc292cca Mon Sep 17 00:00:00 2001 From: Moritz Bruder Date: Wed, 4 Apr 2018 09:39:47 +0200 Subject: Add sort criterion by reversed extension segments The basenames of files are split by dots and then starting from the end each segment is compared to find a sort order. Example: bar.tar.bz2 foo.tar.bz2 a.bar.gz x.tar.gz z.tar.gz test.tex A heuristic determines what extension segments are part of the extension. There is probably no perfect solution but there are much less false positives. As a result the sorting is more intuitive and the displayed column in the list view is better readable and displays extensions more accurately. In addition a bug related to the default sort criteria in the preferences has been fixed. --- src/file-manager/caja-icon-view-ui.xml | 2 ++ src/file-manager/fm-icon-view.c | 13 +++++++++++++ 2 files changed, 15 insertions(+) (limited to 'src/file-manager') diff --git a/src/file-manager/caja-icon-view-ui.xml b/src/file-manager/caja-icon-view-ui.xml index 89c4cb6e..865daaf3 100644 --- a/src/file-manager/caja-icon-view-ui.xml +++ b/src/file-manager/caja-icon-view-ui.xml @@ -17,6 +17,7 @@ + @@ -40,6 +41,7 @@ + diff --git a/src/file-manager/fm-icon-view.c b/src/file-manager/fm-icon-view.c index aadb3463..2d533bfc 100644 --- a/src/file-manager/fm-icon-view.c +++ b/src/file-manager/fm-icon-view.c @@ -169,6 +169,13 @@ static const SortCriterion sort_criteria[] = "Sort by Trash Time", N_("by T_rash Time"), N_("Keep icons sorted by trash time in rows") + }, + { + CAJA_FILE_SORT_BY_EXTENSION, + "extension", + "Sort by Extension", + N_("by E_xtension"), + N_("Keep icons sorted by reversed extension segments in rows") } }; @@ -1770,6 +1777,12 @@ static const GtkRadioActionEntry arrange_radio_entries[] = N_("Keep icons sorted by trash time in rows"), CAJA_FILE_SORT_BY_TRASHED_TIME }, + { + "Sort by Extension", NULL, + N_("By E_xtension"), NULL, + N_("Keep icons sorted by reverse extension segments in rows"), + CAJA_FILE_SORT_BY_EXTENSION + }, }; static void -- cgit v1.2.1