diff options
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. */ |