filechooser: skip stale thumbnail queue entries
This commit is contained in:
parent
d83e126644
commit
1d4ea5dac3
1 changed files with 32 additions and 0 deletions
|
|
@ -1569,6 +1569,27 @@ thumbnail_worker_start (GtkFileChooserDefault *impl,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
thumbnail_queue_file_still_needed (GtkFileChooserDefault *impl,
|
||||
GFile *file)
|
||||
{
|
||||
GtkFileSystemModel *model;
|
||||
GtkTreeIter iter;
|
||||
GFileInfo *info;
|
||||
|
||||
if (!impl->current_model || !GTK_IS_FILE_SYSTEM_MODEL (impl->current_model))
|
||||
return FALSE;
|
||||
|
||||
model = GTK_FILE_SYSTEM_MODEL (impl->current_model);
|
||||
|
||||
if (!_gtk_file_system_model_get_iter_for_file (model, &iter, file))
|
||||
return FALSE;
|
||||
|
||||
info = _gtk_file_system_model_get_info (model, &iter);
|
||||
|
||||
return thumbnail_queue_should_enqueue (impl, file, info);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
thumbnail_queue_idle_cb (gpointer data)
|
||||
{
|
||||
|
|
@ -1590,6 +1611,17 @@ thumbnail_queue_idle_cb (gpointer data)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (!thumbnail_queue_file_still_needed (impl, file))
|
||||
{
|
||||
g_object_unref (file);
|
||||
impl->thumbnail_worker_running = FALSE;
|
||||
|
||||
if (impl->thumbnail_queue)
|
||||
thumbnail_queue_schedule (impl);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!thumbnail_worker_start (impl, file))
|
||||
{
|
||||
g_object_unref (file);
|
||||
|
|
|
|||
Loading…
Reference in a new issue