diff options
-rw-r--r-- | win.c | 17 |
1 files changed, 12 insertions, 5 deletions
@@ -22,7 +22,7 @@ static void SetupFonts(); static TCHAR *TSZFromSZ(char *, int); static int Attach(void); -static void UpdateName(HWND, int); +static void UpdateName(HWND, NMLISTVIEW *); static void UpdateList(HWND); static void ShowEpisode(HWND, int); static int Watched(int); @@ -264,7 +264,7 @@ HandleListViewNotify(HWND hWnd, LPARAM lParam) if ((pNmLv->uChanged & LVIF_STATE) && (pNmLv->uNewState & LVIS_FOCUSED)) { g_SelectedItem = pNmLv->iItem; - UpdateName(hWnd, pNmLv->lParam); + UpdateName(hWnd, pNmLv); //ShowEpisode(hWnd, pNmLv->lParam); } break; @@ -415,13 +415,15 @@ ShowEpisode(HWND hWnd, int iEpisode) /* Update episode name. */ void -UpdateName(HWND hWnd, int iEpisode) +UpdateName(HWND hWnd, NMLISTVIEW *pNmLv) { char *szName; + HWND hListView; + TCHAR *tszName; term_t t; t = PL_new_term_refs(3); - if (!PL_put_integer(t+0, iEpisode)) + if (!PL_put_integer(t+0, pNmLv->lParam)) return; PL_call_predicate(NULL, PL_Q_NORMAL, @@ -431,7 +433,12 @@ UpdateName(HWND hWnd, int iEpisode) if (!PL_get_atom_chars(t+1, &szName)) return; - printf("%s\n", szName); + tszName = TSZFromSZ(szName, CP_UTF8); + if (!tszName) + return; + + hListView = GetDlgItem(hWnd, IDC_LISTVIEW); + ListView_SetItemText(hListView, pNmLv->iItem, 1, tszName); } /* Update episode list. */ |