diff --git a/0001-filerchooser-Show-Recent-files-in-inverse-order.patch b/0001-filerchooser-Show-Recent-files-in-inverse-order.patch new file mode 100644 index 0000000..fd4a93e --- /dev/null +++ b/0001-filerchooser-Show-Recent-files-in-inverse-order.patch @@ -0,0 +1,85 @@ +From 442fa8d9723ff320993bd4a869c7ec1258c45218 Mon Sep 17 00:00:00 2001 +From: Ray Strode +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 + diff --git a/gtk4.spec b/gtk4.spec index 3893be7..8552d61 100644 --- a/gtk4.spec +++ b/gtk4.spec @@ -29,6 +29,9 @@ Source1: settings.ini # https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/4756 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: desktop-file-utils BuildRequires: docbook-style-xsl