1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-02 15:53:12 +02:00

typing: add option typing.look.item_text (closes #2305)

This commit is contained in:
Sébastien Helleu
2026-03-09 23:58:11 +01:00
parent f048ea9eac
commit 87a683ebdb
18 changed files with 152 additions and 41 deletions
+8 -3
View File
@@ -79,6 +79,7 @@ typing_bar_item_typing (const void *pointer, void *data,
{
struct t_hashtable *ptr_nicks;
char **str_nicks_typing, **str_typing, *str_typing_cut;
const char *ptr_text;
int max_length;
/* make C compiler happy */
@@ -103,9 +104,13 @@ typing_bar_item_typing (const void *pointer, void *data,
&typing_bar_item_nicks_map_cb, str_nicks_typing);
str_typing = weechat_string_dyn_alloc (256);
/* TRANSLATORS: this text is displayed before the list of nicks typing in the bar item "typing", it must be as short as possible */
weechat_string_dyn_concat (str_typing, _("Typing:"), -1);
weechat_string_dyn_concat (str_typing, " ", -1);
ptr_text = weechat_config_string (typing_config_look_item_text);
if (!ptr_text || !ptr_text[0])
{
/* TRANSLATORS: this text is displayed before the list of nicks typing in the bar item "typing", it must be as short as possible */
ptr_text = _("Typing: ");
}
weechat_string_dyn_concat (str_typing, ptr_text, -1);
weechat_string_dyn_concat (str_typing, *str_nicks_typing, -1);
weechat_string_dyn_free (str_nicks_typing, 1);
+28
View File
@@ -47,6 +47,7 @@ struct t_config_option *typing_config_look_enabled_nicks = NULL;
struct t_config_option *typing_config_look_enabled_self = NULL;
struct t_config_option *typing_config_look_input_min_chars = NULL;
struct t_config_option *typing_config_look_item_max_length = NULL;
struct t_config_option *typing_config_look_item_text = NULL;
/*
@@ -103,6 +104,22 @@ typing_config_change_item_max_length (const void *pointer, void *data,
weechat_bar_item_update (TYPING_BAR_ITEM_NAME);
}
/*
* Callback for changes on options "typing.look.item_text".
*/
void
typing_config_change_item_text (const void *pointer, void *data,
struct t_config_option *option)
{
/* make C compiler happy */
(void) pointer;
(void) data;
(void) option;
weechat_bar_item_update (TYPING_BAR_ITEM_NAME);
}
/*
* Initializes typing configuration file.
*
@@ -187,6 +204,17 @@ typing_config_init (void)
NULL, NULL, NULL,
&typing_config_change_item_max_length, NULL, NULL,
NULL, NULL, NULL);
typing_config_look_item_text = weechat_config_new_option (
typing_config_file, typing_config_section_look,
"item_text", "string",
N_("text to display before the nicks in the bar item \"typing\"; "
"if set, it is used instead of the translated string \"Typing: \" "
"which is used by default"),
NULL, 0, 0, "", NULL, 0,
NULL, NULL, NULL,
&typing_config_change_item_text, NULL, NULL,
NULL, NULL, NULL);
}
return 1;
+1
View File
@@ -32,6 +32,7 @@ extern struct t_config_option *typing_config_look_enabled_nicks;
extern struct t_config_option *typing_config_look_enabled_self;
extern struct t_config_option *typing_config_look_input_min_chars;
extern struct t_config_option *typing_config_look_item_max_length;
extern struct t_config_option *typing_config_look_item_text;
extern int typing_config_init (void);
extern int typing_config_read (void);