diff options
author | guns <self@sungpae.com> | 2016-05-28 00:29:28 -0500 |
---|---|---|
committer | guns <self@sungpae.com> | 2016-05-28 00:29:28 -0500 |
commit | 7db8895f8cfb3d58b8e9b4c7a5a64a4df9bb1af0 (patch) | |
tree | 4dca4d3ad40931efb1012aaf866929f1a5287c33 /src/menu.c | |
parent | 5df711cbae423ed2b51b84d12a1e92f07de50de3 (diff) |
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.
Diffstat (limited to 'src/menu.c')
-rw-r--r-- | src/menu.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -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) { |