forked from AuroraMiddleware/gtk
Merge branch 'file_chooser_stuff' into 'main'
filechooser: two small changes See merge request GNOME/gtk!5619
This commit is contained in:
commit
9ca3a52bf0
@ -637,28 +637,36 @@ _gtk_file_chooser_extract_recent_folders (GList *infos)
|
||||
for (l = infos; l; l = l->next)
|
||||
{
|
||||
GtkRecentInfo *info = l->data;
|
||||
const char *uri;
|
||||
GFile *parent;
|
||||
const char *uri, *mime_type;
|
||||
GFile *dir;
|
||||
GFile *file;
|
||||
|
||||
uri = gtk_recent_info_get_uri (info);
|
||||
|
||||
if (!g_str_has_prefix (uri, "file://"))
|
||||
if (!gtk_recent_info_is_local (info))
|
||||
continue;
|
||||
|
||||
uri = gtk_recent_info_get_uri (info);
|
||||
file = g_file_new_for_uri (uri);
|
||||
parent = g_file_get_parent (file);
|
||||
g_object_unref (file);
|
||||
|
||||
if (parent)
|
||||
mime_type = gtk_recent_info_get_mime_type (info);
|
||||
if (strcmp (mime_type, "inode/directory") != 0)
|
||||
{
|
||||
if (!g_hash_table_lookup (folders, parent))
|
||||
dir = g_file_get_parent (file);
|
||||
g_object_unref (file);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_hash_table_insert (folders, parent, (gpointer) 1);
|
||||
result = g_list_prepend (result, g_object_ref (parent));
|
||||
dir = file;
|
||||
}
|
||||
|
||||
g_object_unref (parent);
|
||||
if (dir)
|
||||
{
|
||||
if (!g_hash_table_lookup (folders, dir))
|
||||
{
|
||||
g_hash_table_insert (folders, dir, (gpointer) 1);
|
||||
result = g_list_prepend (result, g_object_ref (dir));
|
||||
}
|
||||
|
||||
g_object_unref (dir);
|
||||
}
|
||||
}
|
||||
|
||||
@ -5996,8 +6004,7 @@ 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://"))
|
||||
if (!gtk_recent_info_is_local (info))
|
||||
continue;
|
||||
|
||||
if (gtk_recent_info_get_private_hint (info) &&
|
||||
|
Loading…
Reference in New Issue
Block a user