From: Jonathan Neuschäfer Date: Sat, 17 Dec 2011 21:54:46 +0000 (+0100) Subject: use screen_get_yesno X-Git-Tag: release-0.20~30 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=efcebe262a89885328ab1068c1644b38f93ca618;p=ncmpc.git use screen_get_yesno --- diff --git a/src/screen_file.c b/src/screen_file.c index 4eb8943..da7969b 100644 --- a/src/screen_file.c +++ b/src/screen_file.c @@ -202,7 +202,6 @@ handle_delete(struct mpdclient *c) struct mpd_entity *entity; const struct mpd_playlist *playlist; char *str, *buf; - int key; if (connection == NULL) return; @@ -229,9 +228,10 @@ handle_delete(struct mpdclient *c) str = utf8_to_locale(g_basename(mpd_playlist_get_path(playlist))); buf = g_strdup_printf(_("Delete playlist %s [%s/%s] ? "), str, YES, NO); g_free(str); - key = tolower(screen_getch(buf)); + bool delete = screen_get_yesno(buf, false); g_free(buf); - if( key != YES[0] ) { + + if (!delete) { /* translators: a dialog was aborted by the user */ screen_status_printf(_("Aborted")); return; diff --git a/src/screen_queue.c b/src/screen_queue.c index b21dc3a..7fb3aea 100644 --- a/src/screen_queue.c +++ b/src/screen_queue.c @@ -287,14 +287,14 @@ playlist_save(struct mpdclient *c, char *name, char *defaultname) mpd_connection_get_server_error(connection) == MPD_SERVER_ERROR_EXIST && mpd_connection_clear_error(connection)) { char *buf; - int key; + bool replace; buf = g_strdup_printf(_("Replace %s [%s/%s] ? "), filename, YES, NO); - key = tolower(screen_getch(buf)); + replace = screen_get_yesno(buf, false); g_free(buf); - if (key != YES[0]) { + if (!replace) { g_free(filename_utf8); g_free(filename); screen_status_printf(_("Aborted"));