summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/menu.c49
1 files changed, 40 insertions, 9 deletions
diff --git a/src/menu.c b/src/menu.c
index 9a83f08..f315093 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -49,14 +49,38 @@ void feh_menu_cb(feh_menu * m, feh_menu_item * i, int action, unsigned short dat
void feh_menu_cb_opt_fullscreen(feh_menu * m, feh_menu_item * i);
enum {
- CB_CLOSE = 1, CB_EXIT, CB_RELOAD, CB_REMOVE, CB_DELETE, CB_RESET,
- CB_REMOVE_THUMB, CB_DELETE_THUMB, CB_BG_TILED, CB_BG_SCALED,
- CB_BG_CENTERED, CB_BG_FILLED, CB_BG_TILED_NOFILE,
- CB_BG_SCALED_NOFILE, CB_BG_CENTERED_NOFILE, CB_BG_FILLED_NOFILE,
- CB_SORT_FILENAME, CB_SORT_IMAGENAME, CB_SORT_FILESIZE, CB_SORT_RANDOMIZE,
- CB_SAVE_IMAGE, CB_SAVE_FILELIST, CB_FIT, CB_OPT_DRAW_FILENAME,
- CB_OPT_DRAW_ACTIONS, CB_OPT_KEEP_HTTP, CB_OPT_FREEZE_WINDOW,
- CB_OPT_FULLSCREEN, CB_EDIT_ROTATE, CB_OPT_AUTO_ZOOM, CB_OPT_KEEP_ZOOM_VP
+ CB_CLOSE = 1,
+ CB_EXIT,
+ CB_RELOAD,
+ CB_REMOVE,
+ CB_DELETE,
+ CB_RESET,
+ CB_REMOVE_THUMB,
+ CB_DELETE_THUMB,
+ CB_BG_TILED,
+ CB_BG_SCALED,
+ CB_BG_CENTERED,
+ CB_BG_FILLED,
+ CB_BG_TILED_NOFILE,
+ CB_BG_SCALED_NOFILE,
+ CB_BG_CENTERED_NOFILE,
+ CB_BG_FILLED_NOFILE,
+ CB_SORT_FILENAME,
+ CB_SORT_IMAGENAME,
+ CB_SORT_MTIME,
+ CB_SORT_FILESIZE,
+ CB_SORT_RANDOMIZE,
+ CB_SAVE_IMAGE,
+ CB_SAVE_FILELIST,
+ CB_FIT,
+ CB_OPT_DRAW_FILENAME,
+ CB_OPT_DRAW_ACTIONS,
+ CB_OPT_KEEP_HTTP,
+ CB_OPT_FREEZE_WINDOW,
+ CB_OPT_FULLSCREEN,
+ CB_EDIT_ROTATE,
+ CB_OPT_AUTO_ZOOM,
+ CB_OPT_KEEP_ZOOM_VP
};
feh_menu *feh_menu_new(void)
@@ -923,7 +947,8 @@ void feh_menu_init_common()
feh_menu_add_entry(m, "By File Name", NULL, CB_SORT_FILENAME, 0, NULL);
feh_menu_add_entry(m, "By Image Name", NULL, CB_SORT_IMAGENAME, 0, NULL);
- if (opt.preload || (opt.sort > SORT_FILENAME))
+ feh_menu_add_entry(m, "By Modification Date", NULL, CB_SORT_MTIME, 0, NULL);
+ if (opt.preload || (opt.sort > SORT_MTIME))
feh_menu_add_entry(m, "By File Size", NULL, CB_SORT_FILESIZE, 0, NULL);
feh_menu_add_entry(m, "Randomize", NULL, CB_SORT_RANDOMIZE, 0, NULL);
@@ -1252,6 +1277,12 @@ void feh_menu_cb(feh_menu * m, feh_menu_item * i, int action, unsigned short dat
slideshow_change_image(m->fehwin, SLIDE_FIRST, 1);
}
break;
+ case CB_SORT_MTIME:
+ filelist = gib_list_sort(filelist, feh_cmp_mtime);
+ if (opt.jump_on_resort) {
+ slideshow_change_image(m->fehwin, SLIDE_FIRST, 1);
+ }
+ break;
case CB_SORT_FILESIZE:
filelist = gib_list_sort(filelist, feh_cmp_size);
if (opt.jump_on_resort) {