diff options
author | Daniel Friesel <derf@finalrewind.org> | 2016-06-02 13:45:00 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2016-06-02 13:45:00 +0200 |
commit | 09c59148f8cdc1cb1cb83cb63f6edacec617a446 (patch) | |
tree | 36e759b0bd5d94fa4ef8817a746f43b6e6e9d5c4 /src/slideshow.c | |
parent | 315bac4637537654b4711867911458c3a6974c7e (diff) | |
parent | 36b09fa038a8b7996a12e45419c28821c5596308 (diff) |
Merge branch 'guns-dirnav'
Diffstat (limited to 'src/slideshow.c')
-rw-r--r-- | src/slideshow.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/slideshow.c b/src/slideshow.c index 7636d31..2af78c9 100644 --- a/src/slideshow.c +++ b/src/slideshow.c @@ -322,6 +322,44 @@ void slideshow_change_image(winwidget winwid, int change, int render) try the previous file, not another jmp */ change = SLIDE_NEXT; break; + case SLIDE_JUMP_NEXT_DIR: + { + char old_dir[FEH_MAX_DIRNAME_LEN], new_dir[FEH_MAX_DIRNAME_LEN]; + int j; + + feh_file_dirname(old_dir, FEH_FILE(current_file->data), FEH_MAX_DIRNAME_LEN); + + for (j = 0; j < our_filelist_len; j++) { + current_file = feh_list_jump(filelist, current_file, FORWARD, 1); + feh_file_dirname(new_dir, FEH_FILE(current_file->data), FEH_MAX_DIRNAME_LEN); + if (strcmp(old_dir, new_dir) != 0) + break; + } + } + change = SLIDE_NEXT; + break; + case SLIDE_JUMP_PREV_DIR: + { + char old_dir[FEH_MAX_DIRNAME_LEN], new_dir[FEH_MAX_DIRNAME_LEN]; + int j; + + /* Start the search from the previous file in case we are on + the first file of a directory */ + current_file = feh_list_jump(filelist, current_file, BACK, 1); + feh_file_dirname(old_dir, FEH_FILE(current_file->data), FEH_MAX_DIRNAME_LEN); + + for (j = 0; j < our_filelist_len; j++) { + current_file = feh_list_jump(filelist, current_file, BACK, 1); + feh_file_dirname(new_dir, FEH_FILE(current_file->data), FEH_MAX_DIRNAME_LEN); + if (strcmp(old_dir, new_dir) != 0) + break; + } + + /* Next file is the first entry of prev_dir */ + current_file = feh_list_jump(filelist, current_file, FORWARD, 1); + } + change = SLIDE_NEXT; + break; default: eprintf("BUG!\n"); break; |