summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2017-05-18 20:34:25 +0200
committerSébastien Helleu <flashcode@flashtux.org>2017-05-18 20:34:25 +0200
commit2eebde035a79eacd8696b79910fd469e635b6f0e (patch)
tree0558e770ec4e7eb665920c61a30bab2edac3aaf5 /src
parent33ccc29a3f0176f46a83387459936f2f8b92d1e4 (diff)
downloadweechat-2eebde035a79eacd8696b79910fd469e635b6f0e.zip
buflist: add option "bar" in command /buflist, do not automatically add the bar when buflist is disabled (closes #994)
Diffstat (limited to 'src')
-rw-r--r--src/plugins/buflist/buflist-command.c13
-rw-r--r--src/plugins/buflist/buflist.c21
-rw-r--r--src/plugins/buflist/buflist.h1
3 files changed, 27 insertions, 8 deletions
diff --git a/src/plugins/buflist/buflist-command.c b/src/plugins/buflist/buflist-command.c
index 8a006a34b..b3256170f 100644
--- a/src/plugins/buflist/buflist-command.c
+++ b/src/plugins/buflist/buflist-command.c
@@ -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);
}
diff --git a/src/plugins/buflist/buflist.c b/src/plugins/buflist/buflist.c
index 7c98cc7e0..666b8ea64 100644
--- a/src/plugins/buflist/buflist.c
+++ b/src/plugins/buflist/buflist.c
@@ -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 ();
diff --git a/src/plugins/buflist/buflist.h b/src/plugins/buflist/buflist.h
index a998dfed4..94dc7bd33 100644
--- a/src/plugins/buflist/buflist.h
+++ b/src/plugins/buflist/buflist.h
@@ -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);