From 64e9c952f0bbd5c23fd775620f3df1c261799ed6 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 11 Aug 2011 20:30:06 +0200 Subject: Show correct file number after deleting image In the image_remove function, slideshow_change_image needs to be called before removing the image from the filelist. Because of this, the "x of y" displayed by --draw-filename is wrong (y is 1 too high). This commit introduces a new 'render' argument to slideshow_chingae_image. The image_remove function calls it with render=0, edits the filelist and then runs by winwidget_render_image itself. Patch by Yu-Jie Lin. --- src/slideshow.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/slideshow.c') diff --git a/src/slideshow.c b/src/slideshow.c index 25fca03..f33ae9e 100644 --- a/src/slideshow.c +++ b/src/slideshow.c @@ -83,7 +83,7 @@ void init_slideshow_mode(void) void cb_slide_timer(void *data) { - slideshow_change_image((winwidget) data, SLIDE_NEXT); + slideshow_change_image((winwidget) data, SLIDE_NEXT, 1); return; } @@ -170,7 +170,7 @@ void feh_reload_image(winwidget w, int resize, int force_new) return; } -void slideshow_change_image(winwidget winwid, int change) +void slideshow_change_image(winwidget winwid, int change, int render) { gib_list *last = NULL; int i = 0; @@ -260,7 +260,8 @@ void slideshow_change_image(winwidget winwid, int change) winwidget_reset_image(winwid); winwid->im_w = gib_imlib_image_get_width(winwid->im); winwid->im_h = gib_imlib_image_get_height(winwid->im); - winwidget_render_image(winwid, 1, 0); + if (render) + winwidget_render_image(winwid, 1, 0); s = slideshow_create_name(FEH_FILE(current_file->data)); winwidget_rename(winwid, s); @@ -428,7 +429,7 @@ void feh_filelist_image_remove(winwidget winwid, char do_delete) gib_list *doomed; doomed = current_file; - slideshow_change_image(winwid, SLIDE_NEXT); + slideshow_change_image(winwid, SLIDE_NEXT, 0); if (do_delete) filelist = feh_file_rm_and_free(filelist, doomed); else @@ -441,6 +442,7 @@ void feh_filelist_image_remove(winwidget winwid, char do_delete) s = slideshow_create_name(FEH_FILE(winwid->file->data)); winwidget_rename(winwid, s); free(s); + winwidget_render_image(winwid, 1, 0); } else if ((winwid->type == WIN_TYPE_SINGLE) || (winwid->type == WIN_TYPE_THUMBNAIL_VIEWER)) { if (do_delete) -- cgit v1.2.3