Short most recent files first in Recent Files in file chooser
This commit is contained in:
parent
734842883d
commit
cccd1322c6
85
0001-filerchooser-Show-Recent-files-in-inverse-order.patch
Normal file
85
0001-filerchooser-Show-Recent-files-in-inverse-order.patch
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
From 442fa8d9723ff320993bd4a869c7ec1258c45218 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Ray Strode <rstrode@redhat.com>
|
||||||
|
Date: Thu, 9 Mar 2023 15:42:16 -0500
|
||||||
|
Subject: [PATCH] filerchooser: Show Recent files in inverse order
|
||||||
|
|
||||||
|
When looking at Recent files in the file chooser, it makes more
|
||||||
|
sense to show the recent files on top.
|
||||||
|
|
||||||
|
This commit flips the sort order for that case.
|
||||||
|
---
|
||||||
|
gtk/gtkfilechooserwidget.c | 4 ++++
|
||||||
|
1 file changed, 4 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
|
||||||
|
index 3a0dc6e41b..142daf6e2d 100644
|
||||||
|
--- a/gtk/gtkfilechooserwidget.c
|
||||||
|
+++ b/gtk/gtkfilechooserwidget.c
|
||||||
|
@@ -7083,60 +7083,64 @@ time_sort_func (gconstpointer a,
|
||||||
|
if (impl->operation_mode == OPERATION_MODE_RECENT)
|
||||||
|
{
|
||||||
|
time_a = (glong) g_file_info_get_attribute_uint64 ((GFileInfo *)a, G_FILE_ATTRIBUTE_TIME_ACCESS);
|
||||||
|
time_b = (glong) g_file_info_get_attribute_uint64 ((GFileInfo *)b, G_FILE_ATTRIBUTE_TIME_ACCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
time_a = (glong) g_file_info_get_attribute_uint64 ((GFileInfo *)a, G_FILE_ATTRIBUTE_TIME_MODIFIED);
|
||||||
|
time_b = (glong) g_file_info_get_attribute_uint64 ((GFileInfo *)b, G_FILE_ATTRIBUTE_TIME_MODIFIED);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (time_a < time_b)
|
||||||
|
return GTK_ORDERING_SMALLER;
|
||||||
|
else if (time_a > time_b)
|
||||||
|
return GTK_ORDERING_LARGER;
|
||||||
|
else
|
||||||
|
return GTK_ORDERING_EQUAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static GtkOrdering
|
||||||
|
recent_sort_func (gconstpointer a,
|
||||||
|
gconstpointer b,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
GtkOrdering result;
|
||||||
|
|
||||||
|
result = time_sort_func (a, b, user_data);
|
||||||
|
|
||||||
|
+ /* Recent files should show most recently changed items first
|
||||||
|
+ */
|
||||||
|
+ result = -result;
|
||||||
|
+
|
||||||
|
if (result == GTK_ORDERING_EQUAL)
|
||||||
|
result = name_sort_func (a, b, user_data);
|
||||||
|
|
||||||
|
if (result == GTK_ORDERING_EQUAL)
|
||||||
|
result = location_sort_func (a, b, user_data);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
static GtkOrdering
|
||||||
|
search_sort_func (gconstpointer a,
|
||||||
|
gconstpointer b,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
GtkOrdering result;
|
||||||
|
|
||||||
|
result = location_sort_func (a, b, user_data);
|
||||||
|
|
||||||
|
if (result == GTK_ORDERING_EQUAL)
|
||||||
|
result = name_sort_func (a, b, user_data);
|
||||||
|
|
||||||
|
if (result == GTK_ORDERING_EQUAL)
|
||||||
|
result = time_sort_func (a, b, user_data);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
static char *
|
||||||
|
get_name (GFileInfo *info)
|
||||||
|
{
|
||||||
|
--
|
||||||
|
2.39.2
|
||||||
|
|
@ -29,6 +29,9 @@ Source1: settings.ini
|
|||||||
# https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/4756
|
# https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/4756
|
||||||
Patch0: 0001-Revert-Meson-Simplify-pkgconfig-file-generator.patch
|
Patch0: 0001-Revert-Meson-Simplify-pkgconfig-file-generator.patch
|
||||||
|
|
||||||
|
# https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/5625
|
||||||
|
Patch1: 0001-filerchooser-Show-Recent-files-in-inverse-order.patch
|
||||||
|
|
||||||
BuildRequires: cups-devel
|
BuildRequires: cups-devel
|
||||||
BuildRequires: desktop-file-utils
|
BuildRequires: desktop-file-utils
|
||||||
BuildRequires: docbook-style-xsl
|
BuildRequires: docbook-style-xsl
|
||||||
|
Loading…
Reference in New Issue
Block a user