gtkfilechooser: drain thumbnail queue asynchronously
This commit is contained in:
parent
fd799a203b
commit
ac2c4e808d
1 changed files with 44 additions and 0 deletions
|
|
@ -994,6 +994,48 @@ thumbnail_queue_ensure (GtkFileChooserDefault *impl)
|
|||
NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
thumbnail_queue_idle_cb (gpointer data)
|
||||
{
|
||||
GtkFileChooserDefault *impl = data;
|
||||
GFile *file;
|
||||
GSList *link;
|
||||
|
||||
impl->thumbnail_queue_idle_id = 0;
|
||||
|
||||
if (!impl->show_thumbnails || impl->thumbnail_queue == NULL)
|
||||
return FALSE;
|
||||
|
||||
link = impl->thumbnail_queue;
|
||||
file = link->data;
|
||||
|
||||
impl->thumbnail_queue = g_slist_delete_link (impl->thumbnail_queue, link);
|
||||
|
||||
if (impl->thumbnail_queued_files)
|
||||
g_hash_table_remove (impl->thumbnail_queued_files, file);
|
||||
|
||||
g_object_unref (file);
|
||||
|
||||
if (impl->thumbnail_queue)
|
||||
impl->thumbnail_queue_idle_id = gdk_threads_add_idle (thumbnail_queue_idle_cb,
|
||||
impl);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
thumbnail_queue_schedule (GtkFileChooserDefault *impl)
|
||||
{
|
||||
if (impl->thumbnail_queue_idle_id)
|
||||
return;
|
||||
|
||||
if (!impl->show_thumbnails || impl->thumbnail_queue == NULL)
|
||||
return;
|
||||
|
||||
impl->thumbnail_queue_idle_id = gdk_threads_add_idle (thumbnail_queue_idle_cb,
|
||||
impl);
|
||||
}
|
||||
|
||||
static void
|
||||
thumbnail_queue_enqueue (GtkFileChooserDefault *impl,
|
||||
GFile *file,
|
||||
|
|
@ -1012,6 +1054,8 @@ thumbnail_queue_enqueue (GtkFileChooserDefault *impl,
|
|||
GUINT_TO_POINTER (1));
|
||||
impl->thumbnail_queue = g_slist_prepend (impl->thumbnail_queue,
|
||||
g_object_ref (file));
|
||||
|
||||
thumbnail_queue_schedule (impl);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
Loading…
Reference in a new issue