[nautilus/wip/antoniof/flow-box-preparation: 24/29] view-icon-controller: Implement .compare_files()
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/antoniof/flow-box-preparation: 24/29] view-icon-controller: Implement .compare_files()
- Date: Fri, 10 Dec 2021 14:05:47 +0000 (UTC)
commit 639e2b4ce7d3e1c2e52bd3a709026cc9d9570a56
Author: António Fernandes <antoniof gnome org>
Date: Thu Dec 2 23:47:43 2021 +0000
view-icon-controller: Implement .compare_files()
Mimic the canvas view implementation.
src/nautilus-view-icon-controller.c | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
---
diff --git a/src/nautilus-view-icon-controller.c b/src/nautilus-view-icon-controller.c
index c861576b9..09f45ec4f 100644
--- a/src/nautilus-view-icon-controller.c
+++ b/src/nautilus-view-icon-controller.c
@@ -868,17 +868,22 @@ real_compare_files (NautilusFilesView *files_view,
NautilusFile *file1,
NautilusFile *file2)
{
- if (file1 < file2)
- {
- return -1;
- }
+ GActionGroup *view_action_group;
+ GAction *action;
+ const gchar *target_name;
+ const SortConstants *sort_constants;
+ gboolean directories_first;
- if (file1 > file2)
- {
- return +1;
- }
+ view_action_group = nautilus_files_view_get_action_group (files_view);
+ action = g_action_map_lookup_action (G_ACTION_MAP (view_action_group), "sort");
+ target_name = g_variant_get_string (g_action_get_state (action), NULL);
+ sort_constants = get_sorts_constants_from_action_target_name (target_name);
+ directories_first = nautilus_files_view_should_sort_directories_first (files_view);
- return 0;
+ return nautilus_file_compare_for_sort (file1, file2,
+ sort_constants->sort_type,
+ directories_first,
+ sort_constants->reversed);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]