summaryrefslogtreecommitdiff
path: root/src/plugins/fset
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2017-06-09 22:04:30 +0200
committerSébastien Helleu <flashcode@flashtux.org>2017-06-25 16:35:28 +0200
commit6bbc2f3f4ccc15b6bdef6da8d39e5a12270fbb5f (patch)
treeb105438f40af23177d3a01c28fa5ea791e0f1b33 /src/plugins/fset
parent986ccff8851a36a03b41fc407d3c579dd55273f8 (diff)
downloadweechat-6bbc2f3f4ccc15b6bdef6da8d39e5a12270fbb5f.zip
fset: add allowed values for integers in help bar, rename option fset.color.help_string_values to fset.color.help_values
Diffstat (limited to 'src/plugins/fset')
-rw-r--r--src/plugins/fset/fset-bar-item.c49
-rw-r--r--src/plugins/fset/fset-config.c8
-rw-r--r--src/plugins/fset/fset-config.h2
3 files changed, 44 insertions, 15 deletions
diff --git a/src/plugins/fset/fset-bar-item.c b/src/plugins/fset/fset-bar-item.c
index 227dd9396..0f5024df5 100644
--- a/src/plugins/fset/fset-bar-item.c
+++ b/src/plugins/fset/fset-bar-item.c
@@ -117,35 +117,64 @@ fset_bar_item_fset_cb (const void *pointer, void *data,
weechat_string_dyn_concat (default_and_values, FSET_OPTION_VALUE_NULL);
}
- if (ptr_fset_option->string_values && ptr_fset_option->string_values[0])
+ if ((ptr_fset_option->string_values && ptr_fset_option->string_values[0])
+ || (ptr_fset_option->type == FSET_OPTION_TYPE_INTEGER))
{
ptr_option = weechat_config_get (ptr_fset_option->name);
if (ptr_option)
{
- ptr_string_values = weechat_config_option_get_pointer (
- ptr_option, "string_values");
- if (ptr_string_values)
+ ptr_string_values = NULL;
+ if (ptr_fset_option->string_values && ptr_fset_option->string_values[0])
+ {
+ ptr_string_values = weechat_config_option_get_pointer (
+ ptr_option, "string_values");
+ }
+ if (ptr_string_values
+ || (ptr_fset_option->type == FSET_OPTION_TYPE_INTEGER))
{
weechat_string_dyn_concat (default_and_values,
weechat_color ("bar_fg"));
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 (ptr_string_values)
{
- if (i > 0)
+ for (i = 0; ptr_string_values[i]; i++)
{
+ if (i > 0)
+ {
+ weechat_string_dyn_concat (default_and_values,
+ weechat_color ("bar_fg"));
+ weechat_string_dyn_concat (default_and_values, ", ");
+ }
+ weechat_string_dyn_concat (
+ default_and_values,
+ weechat_color (
+ weechat_config_string (
+ fset_config_color_help_values)));
weechat_string_dyn_concat (default_and_values,
- weechat_color ("bar_fg"));
- weechat_string_dyn_concat (default_and_values, ", ");
+ ptr_string_values[i]);
}
+ }
+ else
+ {
+ weechat_string_dyn_concat (
+ default_and_values,
+ weechat_color (
+ weechat_config_string (
+ fset_config_color_help_values)));
+ weechat_string_dyn_concat (default_and_values,
+ ptr_fset_option->min);
+ weechat_string_dyn_concat (default_and_values,
+ weechat_color ("bar_fg"));
+ weechat_string_dyn_concat (default_and_values, " ... ");
weechat_string_dyn_concat (
default_and_values,
weechat_color (
weechat_config_string (
- fset_config_color_help_string_values)));
+ fset_config_color_help_values)));
weechat_string_dyn_concat (default_and_values,
- ptr_string_values[i]);
+ ptr_fset_option->max);
}
}
}
diff --git a/src/plugins/fset/fset-config.c b/src/plugins/fset/fset-config.c
index 5dac8c165..f295438cf 100644
--- a/src/plugins/fset/fset-config.c
+++ b/src/plugins/fset/fset-config.c
@@ -61,7 +61,7 @@ struct t_config_option *fset_config_color_help_default_value;
struct t_config_option *fset_config_color_help_description;
struct t_config_option *fset_config_color_help_name;
struct t_config_option *fset_config_color_help_quotes;
-struct t_config_option *fset_config_color_help_string_values;
+struct t_config_option *fset_config_color_help_values;
struct t_config_option *fset_config_color_marked[2];
struct t_config_option *fset_config_color_max[2];
struct t_config_option *fset_config_color_min[2];
@@ -539,10 +539,10 @@ fset_config_init ()
NULL, NULL, NULL,
&fset_config_change_color_cb, NULL, NULL,
NULL, NULL, NULL);
- fset_config_color_help_string_values = weechat_config_new_option (
+ fset_config_color_help_values = weechat_config_new_option (
fset_config_file, ptr_section,
- "help_string_values", "color",
- N_("color for string values"),
+ "help_values", "color",
+ N_("color for allowed values"),
NULL, 0, 0, "default", NULL, 0,
NULL, NULL, NULL,
&fset_config_change_color_cb, NULL, NULL,
diff --git a/src/plugins/fset/fset-config.h b/src/plugins/fset/fset-config.h
index 184992f87..ac8399a2a 100644
--- a/src/plugins/fset/fset-config.h
+++ b/src/plugins/fset/fset-config.h
@@ -47,7 +47,7 @@ extern struct t_config_option *fset_config_color_help_default_value;
extern struct t_config_option *fset_config_color_help_description;
extern struct t_config_option *fset_config_color_help_name;
extern struct t_config_option *fset_config_color_help_quotes;
-extern struct t_config_option *fset_config_color_help_string_values;
+extern struct t_config_option *fset_config_color_help_values;
extern struct t_config_option *fset_config_color_marked[2];
extern struct t_config_option *fset_config_color_max[2];
extern struct t_config_option *fset_config_color_min[2];