gtk_list_store_set(GTK_LIST_STORE(store), &iter, FILE_COLUMN_POINTER, list, -1);
}
-// TOOD(xsdg): This could be broken
+/* Returns the next fd without a loaded pixbuf, so the thumb-loader can load the pixbuf for it. */
FileData *vficon_thumb_next_fd(ViewFile *vf)
{
GtkTreePath *tpath;
- FileData *fd = NULL;
-
- /* first check the visible files */
+ /* First see if there are visible files that don't have a loaded thumb... */
if (gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(vf->listview), 0, 0, &tpath, NULL, NULL, NULL))
{
GtkTreeModel *store;
gtk_tree_path_free(tpath);
tpath = NULL;
- while (!fd && valid && tree_view_row_get_visibility(GTK_TREE_VIEW(vf->listview), &iter, FALSE) == 0)
+ while (valid && tree_view_row_get_visibility(GTK_TREE_VIEW(vf->listview), &iter, FALSE) == 0)
{
GList *list;
-
gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &list, -1);
- while (!fd && list)
+ // TODO(xsdg): for loop here.
+ for (; list; list = list->next)
{
- FileData *new_fd = list->data;
- if (new_fd && !fd->thumb_pixbuf) fd = new_fd;
- list = list->next;
+ FileData *fd = list->data;
+ if (fd && !fd->thumb_pixbuf) return fd;
}
valid = gtk_tree_model_iter_next(store, &iter);
}
}
- /* then find first undone */
-
- if (!fd)
+ /* Then iterate through the entire list to load all of them. */
+ GList *work;
+ for (work = vf->list; work; work = work->next)
{
- GList *work = vf->list;
- while (work && !fd)
- {
- FileData *fd_p = work->data;
- work = work->next;
+ FileData *fd = work->data;
- // Note: This implementation differs from view_file_list.c because sidecar files are not
- // distinct list elements here, as they are in the list view.
- if (!fd_p->thumb_pixbuf) fd = fd_p;
- }
+ // Note: This implementation differs from view_file_list.c because sidecar files are not
+ // distinct list elements here, as they are in the list view.
+ if (!fd->thumb_pixbuf) return fd;
}
- return fd;
-}
-
-void vficon_thumb_reset_all(ViewFile *vf)
-{
- GList *work = vf->list;
-
- while (work)
- {
- FileData *fd = work->data;
- if (fd->thumb_pixbuf)
- {
- g_object_unref(fd->thumb_pixbuf);
- fd->thumb_pixbuf = NULL;
- }
- work = work->next;
- }
+ return NULL;
}
-
/*
*-----------------------------------------------------------------------------
* row stuff
*-----------------------------------------------------------------------------
*/
-FileData *vficon_index_get_data(ViewFile *vf, gint row)
-{
- FileData *fd;
-
- fd = g_list_nth_data(vf->list, row);
- return fd ? fd : NULL;
-}
-
-
gint vficon_index_by_fd(ViewFile *vf, FileData *in_fd)
{
gint p = 0;
return -1;
}
-guint vficon_count(ViewFile *vf, gint64 *bytes)
-{
- if (bytes)
- {
- gint64 b = 0;
- GList *work;
-
- work = vf->list;
- while (work)
- {
- FileData *fd = work->data;
- work = work->next;
-
- b += fd->size;
- }
-
- *bytes = b;
- }
-
- return g_list_length(vf->list);
-}
-
-GList *vficon_get_list(ViewFile *vf)
-{
- GList *list = NULL;
- GList *work;
-
- work = vf->list;
- while (work)
- {
- FileData *fd = work->data;
- work = work->next;
-
- list = g_list_prepend(list, file_data_ref(fd));
- }
-
- return g_list_reverse(list);
-}
-
/*
*-----------------------------------------------------------------------------
*