summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2018-08-18 19:43:32 +0200
committerulteq <ulteq@web.de>2018-08-24 11:41:18 +0200
commitdbc8dc8ceabdab55c5c8c74708af7788ade1c151 (patch)
treecbecefba342df30568aef9e7e468dca5c8790f04
parentf3ea5c887e034f08d2735c7a32876f94ee9ef60a (diff)
combine --no-cycle and --cycle-once into --on-last-slide={quit,hold}
-rw-r--r--src/help.raw4
-rw-r--r--src/options.c16
-rw-r--r--src/options.h9
-rw-r--r--src/slideshow.c10
4 files changed, 27 insertions, 12 deletions
diff --git a/src/help.raw b/src/help.raw
index 52d06bf..ebffae3 100644
--- a/src/help.raw
+++ b/src/help.raw
@@ -38,8 +38,8 @@ OPTIONS
--auto-rotate Rotate images according to Exif info (if compiled with exif=1)
-^, --title TITLE Set window title (see FORMAT SPECIFIERS)
-D, --slideshow-delay NUM Set delay between automatically changing slides
- --no-cycle Stop at both ends of the filelist
- --cycle-once Exit after one loop through the slideshow
+ --on-last-slide quit Exit after one loop through the slide show
+ --on-last-slide hold Stop at both ends of the filelist
-R, --reload NUM Reload images after NUM seconds
-k, --keep-http Keep local copies when viewing HTTP/FTP files
--insecure Disable peer/host verification when using HTTPS.
diff --git a/src/options.c b/src/options.c
index 1a47a39..38d2568 100644
--- a/src/options.c
+++ b/src/options.c
@@ -415,7 +415,7 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun)
{"insecure" , 0, 0, 240},
{"no-recursive" , 0, 0, 241},
{"cache-size" , 1, 0, 243},
- {"no-cycle" , 0, 0, 244},
+ {"on-last-slide" , 1, 0, 244},
{"conversion-timeout" , 1, 0, 245},
{"version-sort" , 0, 0, 246},
{"offset" , 1, 0, 247},
@@ -743,7 +743,8 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun)
break;
#endif
case 224:
- opt.cycle_once = 1;
+ weprintf("--cycle-once is deprecated, please use --on-last-slide=quit instead");
+ opt.on_last_slide = ON_LAST_SLIDE_QUIT;
break;
case 225:
opt.xinerama = 0;
@@ -787,7 +788,16 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun)
opt.cache_size = 2048;
break;
case 244:
- opt.no_cycle = 1;
+ if (!strcmp(optarg, "quit")) {
+ opt.on_last_slide = ON_LAST_SLIDE_QUIT;
+ } else if (!strcmp(optarg, "hold")) {
+ opt.on_last_slide = ON_LAST_SLIDE_HOLD;
+ } else if (!strcmp(optarg, "resume")) {
+ opt.on_last_slide = ON_LAST_SLIDE_RESUME;
+ } else {
+ weprintf("Unrecognized on-last-slide action \"%s\"."
+ "Supported actions: hold, resume, quit\n", optarg);
+ }
break;
case 245:
opt.conversion_timeout = atoi(optarg);
diff --git a/src/options.h b/src/options.h
index 122d39e..606b8e6 100644
--- a/src/options.h
+++ b/src/options.h
@@ -27,6 +27,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#ifndef OPTIONS_H
#define OPTIONS_H
+enum on_last_slide_action {
+ ON_LAST_SLIDE_RESUME = 0,
+ ON_LAST_SLIDE_QUIT,
+ ON_LAST_SLIDE_HOLD
+};
+
struct __fehoptions {
unsigned char multiwindow;
unsigned char montage;
@@ -68,8 +74,7 @@ struct __fehoptions {
unsigned char draw_actions;
unsigned char draw_info;
unsigned char cache_thumbnails;
- unsigned char cycle_once;
- unsigned char no_cycle;
+ unsigned char on_last_slide;
unsigned char hold_actions[10];
unsigned char text_bg;
unsigned char no_fehbg;
diff --git a/src/slideshow.c b/src/slideshow.c
index 77f5a82..6f622b4 100644
--- a/src/slideshow.c
+++ b/src/slideshow.c
@@ -225,7 +225,7 @@ void slideshow_change_image(winwidget winwid, int change, int render)
/* Without this, clicking a one-image slideshow reloads it. Not very *
intelligent behaviour :-) */
- if (filelist_len < 2 && opt.cycle_once == 0)
+ if (filelist_len < 2 && opt.on_last_slide != ON_LAST_SLIDE_QUIT)
return;
/* Ok. I do this in such an odd way to ensure that if the last or first *
@@ -333,7 +333,7 @@ void slideshow_change_image(winwidget winwid, int change, int render)
last = NULL;
}
- if (opt.no_cycle &&
+ if (opt.on_last_slide == ON_LAST_SLIDE_HOLD &&
((current_file == filelist && change == SLIDE_NEXT) ||
(previous_file == filelist && change == SLIDE_PREV))) {
current_file = previous_file;
@@ -574,10 +574,10 @@ void feh_filelist_image_remove(winwidget winwid, char do_delete)
doomed = current_file;
/*
- * work around feh_list_jump exiting if cycle_once is enabled
+ * work around feh_list_jump exiting if ON_LAST_SLIDE_QUIT is set
* and no further files are left (we need to delete first)
*/
- if (opt.cycle_once && ! doomed->next && do_delete) {
+ if (opt.on_last_slide == ON_LAST_SLIDE_QUIT && ! doomed->next && do_delete) {
feh_file_rm_and_free(filelist, doomed);
exit(0);
}
@@ -653,7 +653,7 @@ gib_list *feh_list_jump(gib_list * root, gib_list * l, int direction, int num)
if (ret->next) {
ret = ret->next;
} else {
- if (opt.cycle_once) {
+ if (opt.on_last_slide == ON_LAST_SLIDE_QUIT) {
exit(0);
}
if (opt.randomize) {