From 7db8895f8cfb3d58b8e9b4c7a5a64a4df9bb1af0 Mon Sep 17 00:00:00 2001 From: guns Date: Sat, 28 May 2016 00:29:28 -0500 Subject: New sort option: dirname Sort filelist by dirname, then by name. This results in file entries sorting before subdirectory entries. Useful in conjunction with upcoming prev_dir and next_dir navigation actions. --- src/menu.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/menu.c') diff --git a/src/menu.c b/src/menu.c index f315093..ddb2db1 100644 --- a/src/menu.c +++ b/src/menu.c @@ -67,6 +67,7 @@ enum { CB_BG_FILLED_NOFILE, CB_SORT_FILENAME, CB_SORT_IMAGENAME, + CB_SORT_DIRNAME, CB_SORT_MTIME, CB_SORT_FILESIZE, CB_SORT_RANDOMIZE, @@ -947,6 +948,7 @@ 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); + feh_menu_add_entry(m, "By Directory Name", NULL, CB_SORT_DIRNAME, 0, NULL); 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); @@ -1277,6 +1279,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_DIRNAME: + filelist = gib_list_sort(filelist, feh_cmp_dirname); + if (opt.jump_on_resort) { + 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) { -- cgit v1.2.3