From 1585593bda17b46ee063283e5f576b1ca41edfc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Bostr=C3=B6m?= Date: Tue, 27 Nov 2012 12:30:57 +0100 Subject: [PATCH] core: display default values for changed config options in output of /set --- ChangeLog | 3 +- po/cs.po | 6 ++- po/de.po | 6 ++- po/es.po | 6 ++- po/fr.po | 7 ++- po/hu.po | 6 ++- po/it.po | 6 ++- po/ja.po | 6 ++- po/pl.po | 6 ++- po/pt_BR.po | 6 ++- po/ru.po | 6 ++- po/weechat.pot | 5 +- src/core/wee-command.c | 108 ++++++++++++++++++++++++++++++++++++----- 13 files changed, 153 insertions(+), 24 deletions(-) diff --git a/ChangeLog b/ChangeLog index 956f94f3d..b855373e1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,12 +1,13 @@ WeeChat ChangeLog ================= Sébastien Helleu -v0.4.0-dev, 2012-11-23 +v0.4.0-dev, 2012-11-27 Version 0.4.0 (under dev!) -------------------------- +* core: display default values for changed config options in output of /set * core: stop cmake if gcrypt lib is not found (bug #37671) * core: add incomplete mouse events "event-down" and "event-drag" (task #11840) * core: add command /eval, use expression in conditions for bars diff --git a/po/cs.po b/po/cs.po index f8fb05078..34e9194d7 100644 --- a/po/cs.po +++ b/po/cs.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-11-23 20:19+0100\n" +"POT-Creation-Date: 2012-11-26 17:35+0100\n" "PO-Revision-Date: 2012-09-29 11:42+0200\n" "Last-Translator: Jiri Golembiovsky \n" "Language-Team: weechat-dev \n" @@ -684,6 +684,10 @@ msgstr "Volby uloženy do %s" msgid "%sError: failed to save options to %s" msgstr "%sChyba: selhalo uložení voleb do %s" +#, fuzzy +msgid "default: " +msgstr "výchozí hodnota" + msgid "(unknown)" msgstr "(neznámý)" diff --git a/po/de.po b/po/de.po index a97c44159..70e7fdee3 100644 --- a/po/de.po +++ b/po/de.po @@ -23,7 +23,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-11-23 20:19+0100\n" +"POT-Creation-Date: 2012-11-26 17:35+0100\n" "PO-Revision-Date: 2012-11-04 15:41+0100\n" "Last-Translator: Nils Görs \n" "Language-Team: German \n" @@ -704,6 +704,10 @@ msgstr "Optionen gesichert unter: %s" msgid "%sError: failed to save options to %s" msgstr "%sFehler: Optionen konnten nicht unter %s gesichert werden" +#, fuzzy +msgid "default: " +msgstr "Standardwert" + msgid "(unknown)" msgstr "(unbekannt)" diff --git a/po/es.po b/po/es.po index b9ae63b0f..f4e2a0596 100644 --- a/po/es.po +++ b/po/es.po @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-11-23 20:19+0100\n" +"POT-Creation-Date: 2012-11-26 17:35+0100\n" "PO-Revision-Date: 2012-09-29 11:42+0200\n" "Last-Translator: Elián Hanisch \n" "Language-Team: weechat-dev \n" @@ -687,6 +687,10 @@ msgstr "Opciones guardadas en %s" msgid "%sError: failed to save options to %s" msgstr "%sError: no se pudo guardar las opciones en %s" +#, fuzzy +msgid "default: " +msgstr "valor por defecto" + msgid "(unknown)" msgstr "(desconocido)" diff --git a/po/fr.po b/po/fr.po index 772fb749a..44503e805 100644 --- a/po/fr.po +++ b/po/fr.po @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-11-23 20:19+0100\n" -"PO-Revision-Date: 2012-11-23 20:20+0100\n" +"POT-Creation-Date: 2012-11-26 17:35+0100\n" +"PO-Revision-Date: 2012-11-26 15:08+0100\n" "Last-Translator: Sebastien Helleu \n" "Language-Team: weechat-dev \n" "Language: French\n" @@ -691,6 +691,9 @@ msgstr "Options sauvegardées dans %s" msgid "%sError: failed to save options to %s" msgstr "%sErreur: impossible de sauvegarder les options dans %s" +msgid "default: " +msgstr "défaut: " + msgid "(unknown)" msgstr "(inconnu)" diff --git a/po/hu.po b/po/hu.po index f3a228684..8d0251e24 100644 --- a/po/hu.po +++ b/po/hu.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-11-23 20:19+0100\n" +"POT-Creation-Date: 2012-11-26 17:35+0100\n" "PO-Revision-Date: 2012-09-29 11:42+0200\n" "Last-Translator: Andras Voroskoi \n" "Language-Team: weechat-dev \n" @@ -722,6 +722,10 @@ msgstr "Modul beállítások elmentve\n" msgid "%sError: failed to save options to %s" msgstr "%s nem sikerült a modul opciókat elmenteni\n" +#, fuzzy +msgid "default: " +msgstr " . alapérték: %d\n" + msgid "(unknown)" msgstr "(ismeretlen)" diff --git a/po/it.po b/po/it.po index 8663df3d6..9153d447e 100644 --- a/po/it.po +++ b/po/it.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-11-23 20:19+0100\n" +"POT-Creation-Date: 2012-11-26 17:35+0100\n" "PO-Revision-Date: 2012-09-29 11:42+0200\n" "Last-Translator: Marco Paolone \n" "Language-Team: weechat-dev \n" @@ -684,6 +684,10 @@ msgstr "Opzioni salvate in %s" msgid "%sError: failed to save options to %s" msgstr "%sErrore: impossibile salvare le opzioni in %s" +#, fuzzy +msgid "default: " +msgstr "valore predefinito" + msgid "(unknown)" msgstr "(sconosciuto)" diff --git a/po/ja.po b/po/ja.po index dbd0e9481..73fcadf23 100644 --- a/po/ja.po +++ b/po/ja.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-11-23 20:19+0100\n" +"POT-Creation-Date: 2012-11-26 17:35+0100\n" "PO-Revision-Date: 2012-09-29 11:42+0200\n" "Last-Translator: AYANOKOUZI, Ryuunosuke \n" "Language-Team: Japanese \n" @@ -683,6 +683,10 @@ msgstr "%s にオプションを保存しました" msgid "%sError: failed to save options to %s" msgstr "%sエラー: %s へのオプションの保存に失敗しました" +#, fuzzy +msgid "default: " +msgstr "デフォルト値" + msgid "(unknown)" msgstr "(未定義)" diff --git a/po/pl.po b/po/pl.po index 16fbabe05..9e1ae989c 100644 --- a/po/pl.po +++ b/po/pl.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-11-23 20:19+0100\n" +"POT-Creation-Date: 2012-11-26 17:35+0100\n" "PO-Revision-Date: 2012-09-29 11:42+0200\n" "Last-Translator: Krzysztof Korościk \n" "Language-Team: weechat-dev \n" @@ -690,6 +690,10 @@ msgstr "Ustawienia zapisano do %s" msgid "%sError: failed to save options to %s" msgstr "%sBłąd: nie udało się zapisać ustawień do %s" +#, fuzzy +msgid "default: " +msgstr "domyślna wartość" + msgid "(unknown)" msgstr "(nieznane)" diff --git a/po/pt_BR.po b/po/pt_BR.po index 92f1f06d7..e0cb52794 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-11-23 20:19+0100\n" +"POT-Creation-Date: 2012-11-26 17:35+0100\n" "PO-Revision-Date: 2012-09-29 11:43+0200\n" "Last-Translator: Sergio Durigan Junior \n" "Language-Team: weechat-dev \n" @@ -720,6 +720,10 @@ msgstr "Opções salvas para %s" msgid "%sError: failed to save options to %s" msgstr "%sErro: falhou ao salvar as opções para %s" +#, fuzzy +msgid "default: " +msgstr "valor padrão" + msgid "(unknown)" msgstr "(desconhecido)" diff --git a/po/ru.po b/po/ru.po index a472c07f6..9471dc942 100644 --- a/po/ru.po +++ b/po/ru.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-11-23 20:19+0100\n" +"POT-Creation-Date: 2012-11-26 17:35+0100\n" "PO-Revision-Date: 2012-09-29 11:43+0200\n" "Last-Translator: Aleksey V Zapparov AKA ixti \n" "Language-Team: weechat-dev \n" @@ -735,6 +735,10 @@ msgstr "Настройки pluginов сохранены\n" msgid "%sError: failed to save options to %s" msgstr "%s не могу сохранить конфигурационный файл pluginов\n" +#, fuzzy +msgid "default: " +msgstr " . значение по умолчанию: %d\n" + msgid "(unknown)" msgstr "(неизвестен)" diff --git a/po/weechat.pot b/po/weechat.pot index a469b470c..4c710108c 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-11-23 20:19+0100\n" +"POT-Creation-Date: 2012-11-26 17:35+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -635,6 +635,9 @@ msgstr "" msgid "%sError: failed to save options to %s" msgstr "" +msgid "default: " +msgstr "" + msgid "(unknown)" msgstr "" diff --git a/src/core/wee-command.c b/src/core/wee-command.c index 830b40bae..0957c7b66 100644 --- a/src/core/wee-command.c +++ b/src/core/wee-command.c @@ -4348,52 +4348,110 @@ command_set_display_option (struct t_config_option *option, const char *message) { const char *color_name; + char str_default[128]; + const char *display_undefined = _("(undefined)"); + const char *display_default; + + display_default = NULL; if (option->value) { + if (!option->default_value) + { + display_default = display_undefined; + } switch (option->type) { case CONFIG_OPTION_TYPE_BOOLEAN: + if (option->default_value + && (CONFIG_BOOLEAN(option) != CONFIG_BOOLEAN_DEFAULT(option))) + { + snprintf (str_default, sizeof (str_default), "%s", + (CONFIG_BOOLEAN_DEFAULT(option)) ? "on" : "off"); + display_default = str_default; + } gui_chat_printf_date_tags (NULL, 0, GUI_CHAT_TAG_NO_HIGHLIGHT, - "%s%s.%s.%s%s = %s%s", + "%s%s.%s.%s%s = %s%s%s%s%s%s%s%s%s%s", (message) ? message : " ", option->config_file->name, option->section->name, option->name, GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS), GUI_COLOR(GUI_COLOR_CHAT_VALUE), - (CONFIG_BOOLEAN(option) == CONFIG_BOOLEAN_TRUE) ? - "on" : "off"); + (CONFIG_BOOLEAN(option) == CONFIG_BOOLEAN_TRUE) ? "on" : "off", + (display_default) ? GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS) : "", + (display_default) ? " (" : "", + (display_default) ? GUI_COLOR(GUI_COLOR_CHAT) : "", + (display_default) ? _("default: ") : "", + (display_default) ? GUI_COLOR(GUI_COLOR_CHAT_VALUE) : "", + (display_default) ? display_default : "", + (display_default) ? GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS) : "", + (display_default) ? ")" : ""); break; case CONFIG_OPTION_TYPE_INTEGER: + if (option->default_value + && (CONFIG_INTEGER(option) != CONFIG_INTEGER_DEFAULT(option))) + { + if (option->string_values) + { + display_default = option->string_values[CONFIG_INTEGER_DEFAULT(option)]; + } + else + { + snprintf (str_default, sizeof (str_default), + "%d", CONFIG_INTEGER_DEFAULT(option)); + display_default = str_default; + } + } if (option->string_values) { gui_chat_printf_date_tags (NULL, 0, GUI_CHAT_TAG_NO_HIGHLIGHT, - "%s%s.%s.%s%s = %s%s", + "%s%s.%s.%s%s = %s%s%s%s%s%s%s%s%s%s", (message) ? message : " ", option->config_file->name, option->section->name, option->name, GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS), GUI_COLOR(GUI_COLOR_CHAT_VALUE), - option->string_values[CONFIG_INTEGER(option)]); + option->string_values[CONFIG_INTEGER(option)], + (display_default) ? GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS) : "", + (display_default) ? " (" : "", + (display_default) ? GUI_COLOR(GUI_COLOR_CHAT) : "", + (display_default) ? _("default: ") : "", + (display_default) ? GUI_COLOR(GUI_COLOR_CHAT_VALUE) : "", + (display_default) ? display_default : "", + (display_default) ? GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS) : "", + (display_default) ? ")" : ""); } else { gui_chat_printf_date_tags (NULL, 0, GUI_CHAT_TAG_NO_HIGHLIGHT, - "%s%s.%s.%s%s = %s%d", + "%s%s.%s.%s%s = %s%d%s%s%s%s%s%s%s%s", (message) ? message : " ", option->config_file->name, option->section->name, option->name, GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS), GUI_COLOR(GUI_COLOR_CHAT_VALUE), - CONFIG_INTEGER(option)); + CONFIG_INTEGER(option), + (display_default) ? GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS) : "", + (display_default) ? " (" : "", + (display_default) ? GUI_COLOR(GUI_COLOR_CHAT) : "", + (display_default) ? _("default: ") : "", + (display_default) ? GUI_COLOR(GUI_COLOR_CHAT_VALUE) : "", + (display_default) ? display_default : "", + (display_default) ? GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS) : "", + (display_default) ? ")" : ""); } break; case CONFIG_OPTION_TYPE_STRING: + if (option->default_value + && (strcmp (CONFIG_STRING(option), CONFIG_STRING_DEFAULT(option)) != 0)) + { + display_default = CONFIG_STRING_DEFAULT(option); + } gui_chat_printf_date_tags (NULL, 0, GUI_CHAT_TAG_NO_HIGHLIGHT, - "%s%s.%s.%s%s = \"%s%s%s\"", + "%s%s.%s.%s%s = \"%s%s%s\"%s%s%s%s%s%s%s%s%s%s%s", (message) ? message : " ", option->config_file->name, option->section->name, @@ -4401,19 +4459,47 @@ command_set_display_option (struct t_config_option *option, GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS), GUI_COLOR(GUI_COLOR_CHAT_VALUE), CONFIG_STRING(option), - GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS)); + GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS), + (display_default) ? GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS) : "", + (display_default) ? " (" : "", + (display_default) ? GUI_COLOR(GUI_COLOR_CHAT) : "", + (display_default) ? _("default: ") : "", + (display_default) ? GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS) : "", + (display_default) && display_default != display_undefined ? "\"" : "", + (display_default) ? GUI_COLOR(GUI_COLOR_CHAT_VALUE) : "", + (display_default) ? display_default : "", + (display_default) ? GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS) : "", + (display_default) && display_default != display_undefined ? "\"" : "", + (display_default) ? ")" : ""); break; case CONFIG_OPTION_TYPE_COLOR: + if (option->default_value + && (CONFIG_COLOR(option) != CONFIG_COLOR_DEFAULT(option))) + { + display_default = gui_color_get_name (CONFIG_COLOR_DEFAULT(option)); + if (display_default == NULL) + { + display_default = _("(unknown)"); + } + } color_name = gui_color_get_name (CONFIG_COLOR(option)); gui_chat_printf_date_tags (NULL, 0, GUI_CHAT_TAG_NO_HIGHLIGHT, - "%s%s.%s.%s%s = %s%s", + "%s%s.%s.%s%s = %s%s%s%s%s%s%s%s%s%s", (message) ? message : " ", option->config_file->name, option->section->name, option->name, GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS), GUI_COLOR(GUI_COLOR_CHAT_VALUE), - (color_name) ? color_name : _("(unknown)")); + (color_name) ? color_name : _("(unknown)"), + (display_default) ? GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS) : "", + (display_default) ? " (" : "", + (display_default) ? GUI_COLOR(GUI_COLOR_CHAT) : "", + (display_default) ? _("default: ") : "", + (display_default) ? GUI_COLOR(GUI_COLOR_CHAT_VALUE) : "", + (display_default) ? display_default : "", + (display_default) ? GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS) : "", + (display_default) ? ")" : ""); break; case CONFIG_NUM_OPTION_TYPES: /* make C compiler happy */