1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-29 06:16:40 +02:00

buflist: add option "bar" in command /buflist, do not automatically add the bar when buflist is disabled (closes #994)

This commit is contained in:
Sébastien Helleu
2017-05-18 20:34:25 +02:00
parent 33ccc29a3f
commit 2eebde035a
23 changed files with 231 additions and 160 deletions
+10 -3
View File
@@ -45,6 +45,12 @@ buflist_command_buflist (const void *pointer, void *data,
if (argc == 1)
return WEECHAT_RC_OK;
if (weechat_strcasecmp (argv[1], "bar") == 0)
{
buflist_add_bar ();
return WEECHAT_RC_OK;
}
if (weechat_strcasecmp (argv[1], "refresh") == 0)
{
buflist_bar_item_update ();
@@ -64,8 +70,9 @@ buflist_command_init ()
weechat_hook_command (
"buflist",
N_("bar item with list of buffers"),
"refresh",
N_("refresh: force the refresh of the \"buflist\" bar item\n"
"bar || refresh",
N_("bar: add the \"buflist\" bar\n"
"refresh: force the refresh of the \"buflist\" bar item\n"
"\n"
"The lines with buffers are displayed using string evaluation "
"(see /help eval for the format), with these options:\n"
@@ -115,6 +122,6 @@ buflist_command_init ()
" - ${hotlist}: the raw hotlist\n"
" - ${format_lag}: the lag for an IRC server buffer, empty if "
"there's no lag (evaluation of option buflist.format.lag)"),
"refresh",
"bar || refresh",
&buflist_command_buflist, NULL, NULL);
}
+16 -5
View File
@@ -45,7 +45,20 @@ struct t_hdata *buflist_hdata_hotlist = NULL;
/*
* Get IRC server and channel pointers for a buffer.
* Adds the buflist bar.
*/
void
buflist_add_bar ()
{
weechat_bar_new (BUFLIST_BAR_NAME, "off", "0", "root", "", "left",
"columns_vertical", "vertical", "0", "0",
"default", "default", "default", "on",
BUFLIST_BAR_ITEM_NAME);
}
/*
* Gets IRC server and channel pointers for a buffer.
*
* According to buffer:
* - non IRC buffer: both are NULL
@@ -443,10 +456,8 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
buflist_command_init ();
weechat_bar_new (BUFLIST_BAR_NAME, "off", "0", "root", "", "left",
"columns_vertical", "vertical", "0", "0",
"default", "default", "default", "on",
BUFLIST_BAR_ITEM_NAME);
if (weechat_config_boolean (buflist_config_look_enabled))
buflist_add_bar ();
buflist_bar_item_update ();
+1
View File
@@ -33,6 +33,7 @@ extern struct t_weechat_plugin *weechat_buflist_plugin;
extern struct t_hdata *buflist_hdata_buffer;
extern struct t_hdata *buflist_hdata_hotlist;
extern void buflist_add_bar ();
extern void buflist_buffer_get_irc_pointers(struct t_gui_buffer *buffer,
struct t_irc_server **server,
struct t_irc_channel **channel);