gtkfilechooser: add thumbnail queue state
This commit is contained in:
parent
bd62ff6717
commit
0bd9ec1e5e
2 changed files with 49 additions and 0 deletions
|
|
@ -883,6 +883,36 @@ pending_select_files_add (GtkFileChooserDefault *impl,
|
|||
g_slist_prepend (impl->pending_select_files, g_object_ref (file));
|
||||
}
|
||||
|
||||
static void
|
||||
thumbnail_queue_clear (GtkFileChooserDefault *impl)
|
||||
{
|
||||
if (impl->thumbnail_queue_idle_id)
|
||||
{
|
||||
g_source_remove (impl->thumbnail_queue_idle_id);
|
||||
impl->thumbnail_queue_idle_id = 0;
|
||||
}
|
||||
|
||||
if (impl->thumbnail_cancellable)
|
||||
{
|
||||
g_cancellable_cancel (impl->thumbnail_cancellable);
|
||||
g_object_unref (impl->thumbnail_cancellable);
|
||||
impl->thumbnail_cancellable = NULL;
|
||||
}
|
||||
|
||||
g_slist_foreach (impl->thumbnail_queue, (GFunc) g_object_unref, NULL);
|
||||
g_slist_free (impl->thumbnail_queue);
|
||||
impl->thumbnail_queue = NULL;
|
||||
|
||||
if (impl->thumbnail_queued_files)
|
||||
{
|
||||
g_hash_table_destroy (impl->thumbnail_queued_files);
|
||||
impl->thumbnail_queued_files = NULL;
|
||||
}
|
||||
|
||||
impl->thumbnail_worker_running = FALSE;
|
||||
impl->thumbnail_generation_serial++;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_file_chooser_default_finalize (GObject *object)
|
||||
{
|
||||
|
|
@ -902,6 +932,8 @@ gtk_file_chooser_default_finalize (GObject *object)
|
|||
|
||||
icon_view_scale_remove_timeout (impl);
|
||||
|
||||
thumbnail_queue_clear (impl);
|
||||
|
||||
if (impl->icon_tooltip_path)
|
||||
{
|
||||
gtk_tree_path_free (impl->icon_tooltip_path);
|
||||
|
|
@ -6884,6 +6916,8 @@ view_mode_set (GtkFileChooserDefault *impl, ViewMode view_mode)
|
|||
file_list_tooltip_cache_clear (impl);
|
||||
file_icon_view_tooltip_cache_clear (impl);
|
||||
|
||||
thumbnail_queue_clear (impl);
|
||||
|
||||
impl->view_mode = view_mode;
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (impl->view_mode_combo_box),
|
||||
view_mode);
|
||||
|
|
@ -9787,6 +9821,8 @@ set_list_model (GtkFileChooserDefault *impl,
|
|||
|
||||
profile_start ("start", NULL);
|
||||
|
||||
thumbnail_queue_clear (impl);
|
||||
|
||||
stop_loading_and_clear_list_model (impl, TRUE);
|
||||
|
||||
set_busy_cursor (impl, TRUE);
|
||||
|
|
@ -13524,6 +13560,8 @@ current_view_set_file_model (GtkFileChooserDefault *impl, GtkTreeModel *model)
|
|||
file_list_tooltip_cache_clear (impl);
|
||||
file_icon_view_tooltip_cache_clear (impl);
|
||||
|
||||
thumbnail_queue_clear (impl);
|
||||
|
||||
impl->current_model = model;
|
||||
|
||||
if (impl->view_mode == VIEW_MODE_LIST)
|
||||
|
|
|
|||
|
|
@ -262,6 +262,17 @@ struct _GtkFileChooserDefault
|
|||
gint icon_view_scale_visible_overscan;
|
||||
ViewMode view_mode;
|
||||
|
||||
/* Visible-only thumbnail generation state. Thumbnail workers are
|
||||
* cancellable so changing folders or views never leaves stale decode work
|
||||
* running for files that are no longer useful to the user.
|
||||
*/
|
||||
GSList *thumbnail_queue;
|
||||
GHashTable *thumbnail_queued_files;
|
||||
GCancellable *thumbnail_cancellable;
|
||||
guint thumbnail_queue_idle_id;
|
||||
guint thumbnail_generation_serial;
|
||||
guint thumbnail_worker_running : 1;
|
||||
|
||||
GtkWidget *location_button;
|
||||
GtkWidget *location_entry_box;
|
||||
GtkWidget *location_label;
|
||||
|
|
|
|||
Loading…
Reference in a new issue