Code

options: get_key_names: use bool
authorJonathan Neuschäfer <j.neuschaefer@gmx.net>
Thu, 22 Dec 2011 21:13:04 +0000 (22:13 +0100)
committerJonathan Neuschäfer <j.neuschaefer@gmx.net>
Thu, 22 Dec 2011 21:42:04 +0000 (22:42 +0100)
(And true/false in calls to it)

src/command.c
src/command.h
src/main.c
src/screen_search.c
src/title_bar.c

index 4f525605141784058873f04a00c9c29832a3c63a..656bb18e389db0bd89a1389be818a861d2a7a3e1 100644 (file)
@@ -330,7 +330,9 @@ command_dump_keys(void)
 {
        for (int i = 0; cmds[i].description; i++)
                if (cmds[i].command != CMD_NONE)
-                       printf(" %20s : %s\n", get_key_names(cmds[i].command,1),cmds[i].name);
+                       printf(" %20s : %s\n",
+                              get_key_names(cmds[i].command, true),
+                              cmds[i].name);
 }
 
 #ifndef NCMPC_MINI
@@ -349,7 +351,7 @@ set_key_flags(command_definition_t *cp, command_t command, int flags)
 #endif
 
 const char *
-get_key_names(command_t command, int all)
+get_key_names(command_t command, bool all)
 {
        for (int i = 0; cmds[i].description; i++) {
                if (cmds[i].command == command) {
index 3a7d61d9d6322c2d13eea2bb84dc17eb959bf5c8..225d76e5fb4bfa5e4a7c00a9ea26eaf6a89d4083 100644 (file)
@@ -23,6 +23,7 @@
 #include "config.h"
 
 #include <stddef.h>
+#include <stdbool.h>
 
 #ifndef NCMPC_MINI
 #include <stdio.h>
@@ -142,7 +143,7 @@ int write_key_bindings(FILE *f, int all);
 const char *key2str(int key);
 const char *get_key_description(command_t command);
 const char *get_key_command_name(command_t command);
-const char *get_key_names(command_t command, int all);
+const char *get_key_names(command_t command, bool all);
 command_t get_key_command(int key);
 command_t get_key_command_from_name(char *name);
 int assign_keys(command_t command, int keys[MAX_COMMAND_KEYS]);
index 1581e78875658f50fd487015c2cc566fd248d435..ffc310fcee2b183d862c77e9c2bf83f8166929df 100644 (file)
@@ -313,7 +313,7 @@ timer_reconnect(G_GNUC_UNUSED gpointer data)
 
        char *name = default_settings_name();
        screen_status_printf(_("Connecting to %s...  [Press %s to abort]"),
-                            name, get_key_names(CMD_QUIT,0) );
+                            name, get_key_names(CMD_QUIT, false));
        g_free(name);
        doupdate();
 
@@ -527,7 +527,7 @@ timer_check_key_bindings(G_GNUC_UNUSED gpointer data)
           and this is a hint for the user what to press to correct
           that */
        g_snprintf(comment, sizeof(comment), _("press %s for the key editor"),
-                  get_key_names(CMD_SCREEN_KEYDEF, 0));
+                  get_key_names(CMD_SCREEN_KEYDEF, false));
        g_strlcat(buf, comment, sizeof(buf));
        g_strlcat(buf, ")", sizeof(buf));
 #endif
index 5e9226e6cff234246638f1121bf1c15447ae2860..81ca8e4840c3fe7e9a71e753575146b152c78fad 100644 (file)
@@ -382,7 +382,7 @@ screen_search_open(G_GNUC_UNUSED struct mpdclient *c)
        //    search_new(screen, c);
        // else
        screen_status_printf(_("Press %s for a new search"),
-                            get_key_names(CMD_SCREEN_SEARCH,0));
+                            get_key_names(CMD_SCREEN_SEARCH, false));
        search_check_mode();
 }
 
@@ -416,7 +416,7 @@ screen_search_get_title(char *str, size_t size)
                           _(mode[options.search_mode].label));
        else
                g_snprintf(str, size, _("Search: Press %s for a new search [%s]"),
-                          get_key_names(CMD_SCREEN_SEARCH,0),
+                          get_key_names(CMD_SCREEN_SEARCH, false),
                           _(mode[options.search_mode].label));
 
        return str;
index bbbd6de2c5f6ce340bdc6f767455182514ceb950..7fdce0c21dd9a0f63fa83106bf8d27a65943ffd4 100644 (file)
@@ -37,7 +37,7 @@ static void
 print_hotkey(WINDOW *w, command_t cmd, const char *label)
 {
        colors_use(w, COLOR_TITLE_BOLD);
-       waddstr(w, get_key_names(cmd, FALSE));
+       waddstr(w, get_key_names(cmd, false));
        colors_use(w, COLOR_TITLE);
        waddch(w, ':');
        waddstr(w, label);