Code

use screen_get_yesno
authorJonathan Neuschäfer <j.neuschaefer@gmx.net>
Sat, 17 Dec 2011 21:54:46 +0000 (22:54 +0100)
committerJonathan Neuschäfer <j.neuschaefer@gmx.net>
Thu, 22 Dec 2011 12:01:20 +0000 (13:01 +0100)
src/screen_file.c
src/screen_queue.c

index 4eb8943d1810effaa6cb1ef1c33610acb631e2ce..da7969b7221d00e1da14d845551bf6f449799a61 100644 (file)
@@ -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;
index b21dc3aa0536d21b5365919f14e8f04880d34460..7fb3aeadf8a4097ce058e859d72d822b3b1ba541 100644 (file)
@@ -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"));