From bdb3382cc7190a0ff8ddddf32e7998d4582e590c Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 6 Jan 2009 17:57:46 +0100 Subject: command: check_key_bindings() returns message without comment The comment "press %s for the key editor" is only used by timer_check_key_bindings(), move it there. This lets us merge the two error messages in check_key_bindings() and eases the translator's work. --- src/command.c | 9 --------- src/main.c | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/command.c b/src/command.c index 35efb0ccb..685fa7056 100644 --- a/src/command.c +++ b/src/command.c @@ -481,20 +481,11 @@ check_key_bindings(command_definition_t *cp, char *buf, size_t bufsize) if (cp[i].keys[j] && (cmd = find_key_command(cp[i].keys[j],cp)) != cp[i].command) { if (buf) { -#ifdef ENABLE_KEYDEF_SCREEN - g_snprintf(buf, bufsize, - _("Key %s assigned to %s and %s (press %s for the key editor)"), - key2str(cp[i].keys[j]), - get_key_command_name(cp[i].command), - get_key_command_name(cmd), - get_key_names(CMD_SCREEN_KEYDEF,0)); -#else g_snprintf(buf, bufsize, _("Key %s assigned to %s and %s\n"), key2str(cp[i].keys[j]), get_key_command_name(cp[i].command), get_key_command_name(cmd)); -#endif } else fprintf(stderr, _("Key %s assigned to %s and %s\n"), diff --git a/src/main.c b/src/main.c index 01f0a4272..2edf2d4ec 100644 --- a/src/main.c +++ b/src/main.c @@ -346,6 +346,9 @@ static gboolean timer_check_key_bindings(G_GNUC_UNUSED gpointer data) { char buf[256]; +#ifdef ENABLE_KEYDEF_SCREEN + char comment[64]; +#endif gboolean key_error; key_error = check_key_bindings(NULL, buf, sizeof(buf)); @@ -354,7 +357,20 @@ timer_check_key_bindings(G_GNUC_UNUSED gpointer data) process */ return FALSE; +#ifdef ENABLE_KEYDEF_SCREEN + g_strchomp(buf); + g_strlcat(buf, " (", sizeof(buf)); + /* to translators: a key was bound twice in the key editor, + 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)); + g_strlcat(buf, comment, sizeof(buf)); + g_strlcat(buf, ")", sizeof(buf)); +#endif + screen_status_printf("%s", buf); + doupdate(); return TRUE; } -- cgit v1.2.3