static gint vficon_thumb_next(ViewFile *vf);
+static gdouble vficon_thumb_progress(ViewFile *vf)
+{
+ gint count = 0;
+ gint done = 0;
+
+ GList *work = vf->list;
+ while (work)
+ {
+ IconData *id = work->data;
+ FileData *fd = id->fd;
+ work = work->next;
+
+ if (fd->pixbuf) done++;
+ count++;
+ }
+ DEBUG_1("thumb progress: %d of %d", done, count);
+ return (gdouble)done / count;
+}
+
static void vficon_thumb_status(ViewFile *vf, gdouble val, const gchar *text)
{
if (vf->func_thumb_status)
{
vficon_thumb_status(vf, 0.0, NULL);
- vf->thumbs_count = 0;
vf->thumbs_running = FALSE;
thumb_loader_free(vf->thumbs_loader);
vficon_set_thumb(vf, fd);
- vficon_thumb_status(vf, (gdouble)(vf->thumbs_count) / g_list_length(vf->list), _("Loading thumbs..."));
+ vficon_thumb_status(vf, vficon_thumb_progress(vf), _("Loading thumbs..."));
}
static void vficon_thumb_error_cb(ThumbLoader *tl, gpointer data)
return FALSE;
}
- vf->thumbs_count++;
-
vf->thumbs_filedata = fd;
thumb_loader_free(vf->thumbs_loader);
static gint vflist_thumb_next(ViewFile *vf);
+static void vflist_thumb_progress_count(GList *list, gint *count, gint *done)
+{
+ GList *work = list;
+ while (work)
+ {
+ FileData *fd = work->data;
+ work = work->next;
+
+ if (fd->pixbuf) (*done)++;
+
+ if (fd->sidecar_files)
+ {
+ vflist_thumb_progress_count(fd->sidecar_files, count, done);
+ }
+ (*count)++;
+ }
+}
+
+static gdouble vflist_thumb_progress(ViewFile *vf)
+{
+ gint count = 0;
+ gint done = 0;
+
+ vflist_thumb_progress_count(vf->list, &count, &done);
+
+ DEBUG_1("thumb progress: %d of %d", done, count);
+ return (gdouble)done / count;
+}
+
+
static void vflist_thumb_status(ViewFile *vf, gdouble val, const gchar *text)
{
if (vf->func_thumb_status)
{
vflist_thumb_status(vf, 0.0, NULL);
- vf->thumbs_count = 0;
vf->thumbs_running = FALSE;
thumb_loader_free(vf->thumbs_loader);
store = GTK_TREE_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(vf->listview)));
gtk_tree_store_set(store, &iter, FILE_COLUMN_THUMB, fd->pixbuf, -1);
- vflist_thumb_status(vf, (gdouble)(vf->thumbs_count) / vflist_sidecar_list_count(vf->list), _("Loading thumbs..."));
+ vflist_thumb_status(vf, vflist_thumb_progress(vf), _("Loading thumbs..."));
}
static void vflist_thumb_error_cb(ThumbLoader *tl, gpointer data)
return FALSE;
}
- vf->thumbs_count++;
-
vf->thumbs_filedata = fd;
thumb_loader_free(vf->thumbs_loader);