Filter recently used files in the file chooser
authorEmmanuele Bassi <ebassi@gnome.org>
Wed, 8 Mar 2023 18:08:24 +0000 (18:08 +0000)
committerEmmanuele Bassi <ebassi@gnome.org>
Wed, 8 Mar 2023 18:08:24 +0000 (18:08 +0000)
Since it's a file selection widget, we should only list recently used
files that point to a file.

Fixes: #5650
gtk/gtkfilechooserwidget.c

index 0c29b31076227bef7309fe936404013cfc6cf464..d4daa2b78be5bb466f5217350e2656b223f398fa 100644 (file)
@@ -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;