aboutsummaryrefslogtreecommitdiff
path: root/c/episodelistview.c
diff options
context:
space:
mode:
Diffstat (limited to 'c/episodelistview.c')
-rw-r--r--c/episodelistview.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/c/episodelistview.c b/c/episodelistview.c
index 77eefca..37962b1 100644
--- a/c/episodelistview.c
+++ b/c/episodelistview.c
@@ -148,9 +148,8 @@ void
ElvUpdate()
{
fid_t f;
- int iTop;
+ int iLast, iTop;
LVITEM lviEpisode, lviName;
- qid_t q;
term_t t;
SendMessage(HElv, WM_SETREDRAW, FALSE, 0);
@@ -161,22 +160,22 @@ ElvUpdate()
lviName.mask = LVIF_TEXT;
F(f);
- t = T(2);
- q = Q("local_episodes","sort_episode_file",2,t);
+ t = T(1);
+ P("episode_data","last_episode",1,t) goto f;
+ GI(t,&iLast) goto f;
- for (int i = 0; Qn(q); i++) {
+ for (int i = 0; i < iLast; i++) {
char *szName;
fid_t f2;
- int cb, iEpisode, iItem, r;
+ int cb;
TCHAR *tszEpisode, *tszName;
term_t t2;
/* Format name string. */
- GI(t,&iEpisode) goto e;
F(f2);
t2 = T(3);
- PI(t2,iEpisode) goto e;
+ PI(t2,i+1) goto e;
tszName = NULL;
P("episode_data","lookup_episode_local",3,t2) goto skipname;
GAC(t2+1,&szName) goto skipname;
@@ -188,14 +187,14 @@ skipname:
cb = 100;
tszEpisode = malloc(cb*sizeof(TCHAR));
if (!tszEpisode) goto e1;
- _stprintf_s(tszEpisode, cb, TEXT("%d"), iEpisode);
+ _stprintf_s(tszEpisode, cb, TEXT("%d"), i+1);
/* Insert item. */
lviEpisode.iItem = i;
lviEpisode.iSubItem = 0;
lviEpisode.pszText = tszEpisode;
- lviEpisode.lParam = iEpisode;
+ lviEpisode.lParam = i+1;
ListView_InsertItem(HElv, &lviEpisode);
if (tszName) {
@@ -219,8 +218,7 @@ e: Fd(f2);
SendMessage(HElv, WM_SETREDRAW, TRUE, 0);
ElvRedraw();
- Qc(q);
- Fd(f);
+f: Fd(f);
}
/* Update episode name. */