From 8b2202cd5610359f6333b4393b2b4f529edad922 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Wed, 8 Mar 2023 18:08:24 +0000 Subject: [PATCH] Filter recently used files in the file chooser Since it's a file selection widget, we should only list recently used files that point to a file. Fixes: #5650 --- gtk/gtkfilechooserwidget.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c index 0c29b31076..d4daa2b78b 100644 --- a/gtk/gtkfilechooserwidget.c +++ b/gtk/gtkfilechooserwidget.c @@ -644,6 +644,9 @@ _gtk_file_chooser_extract_recent_folders (GList *infos) uri = gtk_recent_info_get_uri (info); + if (!g_str_has_prefix (uri, "file://")) + continue; + file = g_file_new_for_uri (uri); parent = g_file_get_parent (file); g_object_unref (file); @@ -5980,6 +5983,10 @@ recent_start_loading (GtkFileChooserWidget *impl) GtkRecentInfo *info = l->data; GFile *file; + const char *uri = gtk_recent_info_get_uri (info); + if (!g_str_has_prefix (uri, "file://")) + continue; + if (gtk_recent_info_get_private_hint (info) && !gtk_recent_info_has_application (info, app_name)) continue;