diff options
Diffstat (limited to 'src/slideshow.c')
-rw-r--r-- | src/slideshow.c | 103 |
1 files changed, 66 insertions, 37 deletions
diff --git a/src/slideshow.c b/src/slideshow.c index 591848c..87ec4cb 100644 --- a/src/slideshow.c +++ b/src/slideshow.c @@ -57,6 +57,7 @@ void init_slideshow_mode(void) // Try finding an exact filename match first for (; l && opt.start_list_at; l = l->next) { if (!strcmp(opt.start_list_at, FEH_FILE(l->data)->filename)) { + free(opt.start_list_at); opt.start_list_at = NULL; break; } @@ -83,6 +84,7 @@ void init_slideshow_mode(void) current_filename = FEH_FILE(l->data)->filename; } if (!strcmp(start_at_filename, current_filename)) { + free(opt.start_list_at); opt.start_list_at = NULL; break; } @@ -135,47 +137,54 @@ void cb_reload_timer(void *data) winwidget w = (winwidget) data; - /* save the current filename for refinding it in new list */ - current_filename = estrdup(FEH_FILE(current_file->data)->filename); + /* + * multi-window mode has no concept of a "current file" and + * dynamically adding/removing windows is not implemented at the moment. + * So don't reload filelists in multi-window mode. + */ + if (current_file != NULL) { + /* 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 (opt.filelistfile) { - filelist = gib_list_cat(filelist, feh_read_filelist(opt.filelistfile)); - } - - if (!(filelist_len = gib_list_length(filelist))) { - eprintf("No files found to reload."); - } + 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 (opt.filelistfile) { + filelist = gib_list_cat(filelist, feh_read_filelist(opt.filelistfile)); + } + + if (!(filelist_len = gib_list_length(filelist))) { + eprintf("No files found to reload."); + } - feh_prepare_filelist(); + feh_prepare_filelist(); - /* 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; - } + /* 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); + free(current_filename); - if (!current_file) - current_file = filelist; - w->file = current_file; + if (!current_file) + current_file = filelist; + w->file = current_file; + } feh_reload_image(w, 1, 0); feh_add_unique_timer(cb_reload_timer, w, opt.reload); @@ -218,6 +227,18 @@ void slideshow_change_image(winwidget winwid, int change, int render) /* The for loop prevents us looping infinitely */ for (i = 0; i < our_filelist_len; i++) { winwidget_free_image(winwid); +#ifdef HAVE_LIBEXIF + /* + * An EXIF data chunk requires up to 50 kB of space. For large and + * long-running slideshows, this would acculumate gigabytes of + * EXIF data after a few days. We therefore do not cache EXIF data + * in slideshows. + */ + if (FEH_FILE(winwid->file->data)->ed) { + exif_data_unref(FEH_FILE(winwid->file->data)->ed); + FEH_FILE(winwid->file->data)->ed = NULL; + } +#endif switch (change) { case SLIDE_NEXT: current_file = feh_list_jump(filelist, current_file, FORWARD, 1); @@ -398,6 +419,14 @@ char *feh_printf(char *str, feh_file * file, winwidget winwid) if ((*c == '%') && (*(c+1) != '\0')) { c++; switch (*c) { + case 'a': + if (opt.paused == 1) { + strncat(ret, "paused", sizeof(ret) - strlen(ret) - 1); + } + else { + strncat(ret, "playing", sizeof(ret) - strlen(ret) - 1); + } + break; case 'f': if (file) strncat(ret, file->filename, sizeof(ret) - strlen(ret) - 1); @@ -612,7 +641,7 @@ void slideshow_save_image(winwidget win) gib_imlib_save_image_with_error_return(win->im, tmpname, &err); if (err) - feh_imlib_print_load_error(tmpname, win, err); + feh_print_load_error(tmpname, win, err, LOAD_ERROR_IMLIB); free(tmpname); return; |