diff options
author | John Ankarström <john@ankarstrom.se> | 2022-04-27 14:20:07 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2022-04-27 14:20:07 +0200 |
commit | dd855b6091c1eb9835cd2466ed2e225dd4f850a4 (patch) | |
tree | 62e7f22f035c65889510ef63ed9b7d87582a6a4e /c/episodelistview.c | |
parent | c884c09ac88c0d22a21f839593d77c7173c41b60 (diff) | |
download | EpisodeBrowser-dd855b6091c1eb9835cd2466ed2e225dd4f850a4.tar.gz |
Update episode order after rating.
Diffstat (limited to 'c/episodelistview.c')
-rw-r--r-- | c/episodelistview.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/c/episodelistview.c b/c/episodelistview.c index eaa7e1b..08bd0db 100644 --- a/c/episodelistview.c +++ b/c/episodelistview.c @@ -42,6 +42,16 @@ ElvCreate() return HElv; } +void +ElvDoSort() +{ + int iEpFocus; + ListView_SortItemsEx(HElv, ElvSort, ISort); + iEpFocus = ListView_GetNextItem(HElv, -1, LVNI_FOCUSED); + if (iEpFocus == -1) return; + ListView_EnsureVisible(HElv, iEpFocus, TRUE); +} + LRESULT ElvHandleNotify(LPARAM lParam) { @@ -60,17 +70,14 @@ ElvHandleNotify(LPARAM lParam) break; case LVN_COLUMNCLICK: /* Sort by column. */ { - int iColumn, iEpFocus; + int iColumn; term_t t; t = T(1); iColumn = lpNmLv->iSubItem+1; ISort = abs(ISort) == iColumn? -ISort: iColumn; PI(t,ISort) goto s; P("cfg","set_sort",1,t); - s: ListView_SortItemsEx(HElv, ElvSort, ISort); - iEpFocus = ListView_GetNextItem(HElv, -1, LVNI_FOCUSED); - if (iEpFocus == -1) break; - ListView_EnsureVisible(HElv, iEpFocus, TRUE); + s: ElvDoSort(); break; } case NM_CUSTOMDRAW: /* Make unwatched episodes bold. */ |