gib_list *feh_file_remove_from_list(gib_list * list, gib_list * l) { feh_file_free(FEH_FILE(l->data)); D(("filelist_len %d -> %d\n", filelist_len, filelist_len - 1)); filelist_len--; return(gib_list_remove(list, l)); }
void cb_reload_timer(void *data) { gib_list *l; char *current_filename; winwidget w = (winwidget) data; /* save the current filename for refinding it in new list */ current_filename = estrdup(FEH_FILE(current_file->data)->filename); for (l = filelist; l; l = l->next) { feh_file_free(l->data); l->data = NULL; } gib_list_free_and_data(filelist); filelist = NULL; filelist_len = 0; current_file = NULL; /* rebuild filelist from original_file_items */ if (gib_list_length(original_file_items) > 0) for (l = gib_list_last(original_file_items); l; l = l->prev) add_file_to_filelist_recursively(l->data, FILELIST_FIRST); else if (!opt.filelistfile && !opt.bgmode) add_file_to_filelist_recursively(".", FILELIST_FIRST); if (!(filelist_len = gib_list_length(filelist))) { eprintf("No files found to reload."); } /* find the previously current file */ for (l = filelist; l; l = l->next) if (strcmp(FEH_FILE(l->data)->filename, current_filename) == 0) { current_file = l; break; } free(current_filename); filelist = gib_list_first(gib_list_reverse(filelist)); if (!current_file) current_file = filelist; w->file = current_file; /* reset window name in case of current file order, * filename, or filelist_length has changed. */ current_filename = slideshow_create_name(FEH_FILE(current_file->data), w); winwidget_rename(w, current_filename); free(current_filename); feh_reload_image(w, 1, 0); if (opt.reload) feh_add_unique_timer(cb_reload_timer, w, opt.reload); return; }
int feh_load_image_char(Imlib_Image * im, char *filename) { feh_file *file; int i; file = feh_file_new(filename); i = feh_load_image(im, file); feh_file_free(file); return(i); }