diff options
Diffstat (limited to 'src/plugins/fset')
-rw-r--r-- | src/plugins/fset/fset-bar-item.c | 79 |
1 files changed, 50 insertions, 29 deletions
diff --git a/src/plugins/fset/fset-bar-item.c b/src/plugins/fset/fset-bar-item.c index 2d7fd5a58..eb069e130 100644 --- a/src/plugins/fset/fset-bar-item.c +++ b/src/plugins/fset/fset-bar-item.c @@ -58,7 +58,7 @@ fset_bar_item_fset_cb (const void *pointer, void *data, { struct t_fset_option *ptr_fset_option; struct t_config_option *ptr_option; - char str_help[8192], **string_values; + char str_help[8192], **default_and_values; const char **ptr_string_values; int i; @@ -78,10 +78,45 @@ fset_bar_item_fset_cb (const void *pointer, void *data, if (!ptr_fset_option) return NULL; - string_values = weechat_string_dyn_alloc (256); - if (!string_values) + default_and_values = weechat_string_dyn_alloc (256); + if (!default_and_values) return NULL; + weechat_string_dyn_concat (default_and_values, weechat_color ("bar_fg")); + weechat_string_dyn_concat (default_and_values, _("default:")); + weechat_string_dyn_concat (default_and_values, " "); + if (ptr_fset_option->default_value) + { + if (ptr_fset_option->type == FSET_OPTION_TYPE_STRING) + { + weechat_string_dyn_concat (default_and_values, + weechat_color ( + weechat_config_string ( + fset_config_color_help_quotes))); + weechat_string_dyn_concat (default_and_values, "\""); + } + weechat_string_dyn_concat ( + default_and_values, + weechat_color (weechat_config_string (fset_config_color_help_default_value))); + weechat_string_dyn_concat (default_and_values, + ptr_fset_option->default_value); + if (ptr_fset_option->type == FSET_OPTION_TYPE_STRING) + { + weechat_string_dyn_concat (default_and_values, + weechat_color ( + weechat_config_string ( + fset_config_color_help_quotes))); + weechat_string_dyn_concat (default_and_values, "\""); + } + } + else + { + weechat_string_dyn_concat ( + default_and_values, + weechat_color (weechat_config_string (fset_config_color_help_default_value))); + weechat_string_dyn_concat (default_and_values, FSET_OPTION_VALUE_NULL); + } + if (ptr_fset_option->string_values && ptr_fset_option->string_values[0]) { ptr_option = weechat_config_get (ptr_fset_option->name); @@ -91,59 +126,45 @@ fset_bar_item_fset_cb (const void *pointer, void *data, ptr_option, "string_values"); if (ptr_string_values) { - weechat_string_dyn_concat (string_values, + weechat_string_dyn_concat (default_and_values, weechat_color ("bar_fg")); - weechat_string_dyn_concat (string_values, ", "); - weechat_string_dyn_concat (string_values, _("values:")); - weechat_string_dyn_concat (string_values, " "); + weechat_string_dyn_concat (default_and_values, ", "); + weechat_string_dyn_concat (default_and_values, _("values:")); + weechat_string_dyn_concat (default_and_values, " "); for (i = 0; ptr_string_values[i]; i++) { if (i > 0) { - weechat_string_dyn_concat (string_values, + weechat_string_dyn_concat (default_and_values, weechat_color ("bar_fg")); - weechat_string_dyn_concat (string_values, ", "); + weechat_string_dyn_concat (default_and_values, ", "); } weechat_string_dyn_concat ( - string_values, - weechat_color ( - weechat_config_string ( - fset_config_color_help_quotes))); - weechat_string_dyn_concat (string_values, "\""); - weechat_string_dyn_concat ( - string_values, + default_and_values, weechat_color ( weechat_config_string ( fset_config_color_help_string_values))); - weechat_string_dyn_concat (string_values, + weechat_string_dyn_concat (default_and_values, ptr_string_values[i]); - weechat_string_dyn_concat ( - string_values, - weechat_color ( - weechat_config_string ( - fset_config_color_help_quotes))); - weechat_string_dyn_concat (string_values, "\""); } } } } snprintf (str_help, sizeof (str_help), - _("%s%s%s: %s %s[%sdefault: %s%s%s%s]%s"), + /* TRANSLATORS: "%s%s%s:" at beginning of string it the name of option */ + _("%s%s%s: %s %s[%s%s]%s"), weechat_color (weechat_config_string (fset_config_color_help_name)), ptr_fset_option->name, weechat_color ("bar_fg"), (ptr_fset_option->description && ptr_fset_option->description[0]) ? _(ptr_fset_option->description) : _("(no description)"), weechat_color ("bar_delim"), - weechat_color ("bar_fg"), - weechat_color (weechat_config_string (fset_config_color_help_default_value)), - ptr_fset_option->default_value, - *string_values, + *default_and_values, weechat_color ("bar_delim"), weechat_color ("bar_fg")); - weechat_string_dyn_free (string_values, 1); + weechat_string_dyn_free (default_and_values, 1); return strdup (str_help); } |