From: Max Kellermann Date: Sat, 3 Oct 2009 17:18:59 +0000 (+0200) Subject: screen_file: don't use mpdclient_filelist_get() X-Git-Tag: release-0.16~195 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=40feefe6dc7dd4349182c0b4e7cdf045e4b658fa;p=ncmpc.git screen_file: don't use mpdclient_filelist_get() Use libmpdclient's mpd_send_list_meta() instead. This way, we don't have to use filelist_prepend() to the first NULL entry. --- diff --git a/src/screen_file.c b/src/screen_file.c index 116d329..43c28c2 100644 --- a/src/screen_file.c +++ b/src/screen_file.c @@ -54,16 +54,29 @@ screen_file_repaint(void) static void screen_file_reload(struct mpdclient *c) { + struct mpd_connection *connection; + if (browser.filelist != NULL) filelist_free(browser.filelist); - browser.filelist = mpdclient_filelist_get(c, current_path); - if (browser.filelist == NULL) - browser.filelist = filelist_new(); - + browser.filelist = filelist_new(); if (*current_path != 0) /* add a dummy entry for ./.. */ - filelist_prepend(browser.filelist, NULL); + filelist_append(browser.filelist, NULL); + + if (!mpdclient_is_connected(c)) + return; + + connection = c->connection; + + mpd_send_list_meta(connection, current_path); + filelist_recv(browser.filelist, connection); + + if (mpd_response_finish(connection)) + filelist_sort_dir_play(browser.filelist, + compare_filelist_entry_path); + else + mpdclient_handle_error(c); } /**