GktRecentManager and the GVFS recent backend diverge in behaviour
The GVFS recent backend filters recently used files, maybe most importantly, it ignores non-local (not file://
) files. I think GtkRecentManager
should do the same otherwise entries like this:
<bookmark href="https://github.com/google/sanitizers/issues/1171" added="2023-03-07T19:32:21.332000Z" modified="2023-03-07T22:14:34.524000Z" visited="2023-03-07T22:14:34.524000Z">
<info>
<metadata owner="http://freedesktop.org">
<mime:mime-type type="application/octet-stream"/>
<bookmark:applications>
<bookmark:application name="firefox" exec="/usr/lib/firefox/firefox %u %u" modified="2023-03-07T22:14:34.524000Z" count="2"/>
</bookmark:applications>
</metadata>
</info>
</bookmark>
will show up on the "Recent" tab of the file chooser widget.
The change itself seems simple:
diff --git a/gtk/gtkrecentmanager.c b/gtk/gtkrecentmanager.c
index 3576718408..46713c1fe1 100644
--- a/gtk/gtkrecentmanager.c
+++ b/gtk/gtkrecentmanager.c
@@ -1296,6 +1296,9 @@ gtk_recent_manager_get_items (GtkRecentManager *manager)
{
GtkRecentInfo *info;
+ if (g_ascii_strncasecmp (uris[i], "file:/", strlen("file:/")) != 0)
+ continue;
+
info = gtk_recent_info_new (uris[i]);
build_recent_info (priv->recent_items, info);
Alternatively the filtering could be done inside the file chooser widget itself.
Edited by Barnabás Pőcze