buflist: add option buflist.look.enabled

v2.8-utf8proc
Sébastien Helleu 2017-05-05 23:24:02 +02:00
parent b58d9910e3
commit 90a9a1fb96
26 changed files with 228 additions and 75 deletions

View File

@ -27,14 +27,29 @@ A new plugin called "buflist" has been added, it replaces the script "buffers.pl
If the script is installed, you will see two sidebars with list of buffers.
If you fell in love with buflist, you can uninstall the script and remove its bar
with these commands:
If you fell in love with buflist and that the script buffers.pl is installed,
you can uninstall the script and remove its bar with these commands:
----
/script remove buffers.pl
/bar del buffers
----
If you don't want the list of buffers, you can disable buflist:
----
/set buflist.look.enabled off
----
To save extra memory, you can even unload the buflist plugin, remove the bar and
prevent the plugin from loading on next startup:
----
/plugin unload buflist
/bar del buflist
/set weechat.plugin.autoload "*,!buflist"
----
[[v1.8_aspell_options]]
=== Aspell options

View File

@ -86,6 +86,12 @@
** Werte: beliebige Zeichenkette
** Standardwert: `+"${buffer.hidden}==0"+`
* [[option_buflist.look.enabled]] *buflist.look.enabled*
** Beschreibung: pass:none[enable buflist]
** Typ: boolesch
** Werte: on, off
** Standardwert: `+on+`
* [[option_buflist.look.mouse_jump_visited_buffer]] *buflist.look.mouse_jump_visited_buffer*
** Beschreibung: pass:none[ist diese Einstellung aktiviert, kann mit der linken/rechten Maustaste auf dem aktuellen Buffer zum vorherigen/nächsten Buffer gesprungen werden]
** Typ: boolesch

View File

@ -86,6 +86,12 @@
** values: any string
** default value: `+"${buffer.hidden}==0"+`
* [[option_buflist.look.enabled]] *buflist.look.enabled*
** description: pass:none[enable buflist]
** type: boolean
** values: on, off
** default value: `+on+`
* [[option_buflist.look.mouse_jump_visited_buffer]] *buflist.look.mouse_jump_visited_buffer*
** description: pass:none[if enabled, clicks with left/right buttons on the line with current buffer jump to previous/next visited buffer]
** type: boolean

View File

@ -86,6 +86,12 @@
** valeurs: toute chaîne
** valeur par défaut: `+"${buffer.hidden}==0"+`
* [[option_buflist.look.enabled]] *buflist.look.enabled*
** description: pass:none[activer buflist]
** type: booléen
** valeurs: on, off
** valeur par défaut: `+on+`
* [[option_buflist.look.mouse_jump_visited_buffer]] *buflist.look.mouse_jump_visited_buffer*
** description: pass:none[si activé, les clics avec les boutons gauche/droit sur la ligne avec le tampon courant sautent au tampon visité avant/après]
** type: booléen

View File

@ -86,6 +86,12 @@
** valori: qualsiasi stringa
** valore predefinito: `+"${buffer.hidden}==0"+`
* [[option_buflist.look.enabled]] *buflist.look.enabled*
** descrizione: pass:none[enable buflist]
** tipo: bool
** valori: on, off
** valore predefinito: `+on+`
* [[option_buflist.look.mouse_jump_visited_buffer]] *buflist.look.mouse_jump_visited_buffer*
** descrizione: pass:none[if enabled, clicks with left/right buttons on the line with current buffer jump to previous/next visited buffer]
** tipo: bool

View File

@ -86,6 +86,12 @@
** 値: 未制約文字列
** デフォルト値: `+"${buffer.hidden}==0"+`
* [[option_buflist.look.enabled]] *buflist.look.enabled*
** 説明: pass:none[enable buflist]
** タイプ: ブール
** 値: on, off
** デフォルト値: `+on+`
* [[option_buflist.look.mouse_jump_visited_buffer]] *buflist.look.mouse_jump_visited_buffer*
** 説明: pass:none[有効の場合、現在のバッファを示す行で左または右ボタンをクリックすることで一つ前または次の訪問済みバッファに移動します]
** タイプ: ブール

View File

@ -86,6 +86,12 @@
** wartości: dowolny ciąg
** domyślna wartość: `+"${buffer.hidden}==0"+`
* [[option_buflist.look.enabled]] *buflist.look.enabled*
** opis: pass:none[enable buflist]
** typ: bool
** wartości: on, off
** domyślna wartość: `+on+`
* [[option_buflist.look.mouse_jump_visited_buffer]] *buflist.look.mouse_jump_visited_buffer*
** opis: pass:none[if enabled, clicks with left/right buttons on the line with current buffer jump to previous/next visited buffer]
** typ: bool

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2017-05-02 07:33+0200\n"
"POT-Creation-Date: 2017-05-05 23:16+0200\n"
"PO-Revision-Date: 2017-01-06 21:59+0100\n"
"Last-Translator: Ondřej Súkup <mimi.vx@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -4966,6 +4966,9 @@ msgid ""
"=core.weechat) || ${buffer.active}==1)\""
msgstr ""
msgid "enable buflist"
msgstr ""
msgid ""
"if enabled, clicks with left/right buttons on the line with current buffer "
"jump to previous/next visited buffer"

View File

@ -19,7 +19,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2017-05-02 07:33+0200\n"
"POT-Creation-Date: 2017-05-05 23:16+0200\n"
"PO-Revision-Date: 2017-05-03 23:14+0200\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German <kde-i18n-de@kde.org>\n"
@ -5909,6 +5909,9 @@ msgstr ""
"\"${buffer.hidden}==0 && ((${type}!=server && ${buffer.full_name}!=core."
"weechat) || ${buffer.active}==1)\""
msgid "enable buflist"
msgstr ""
msgid ""
"if enabled, clicks with left/right buttons on the line with current buffer "
"jump to previous/next visited buffer"

View File

@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2017-05-02 07:33+0200\n"
"POT-Creation-Date: 2017-05-05 23:16+0200\n"
"PO-Revision-Date: 2017-01-06 22:01+0100\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -5179,6 +5179,9 @@ msgid ""
"=core.weechat) || ${buffer.active}==1)\""
msgstr ""
msgid "enable buflist"
msgstr ""
msgid ""
"if enabled, clicks with left/right buttons on the line with current buffer "
"jump to previous/next visited buffer"

View File

@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2017-05-02 07:33+0200\n"
"PO-Revision-Date: 2017-05-02 07:34+0200\n"
"POT-Creation-Date: 2017-05-05 23:16+0200\n"
"PO-Revision-Date: 2017-05-05 23:17+0200\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: fr\n"
@ -5778,6 +5778,9 @@ msgstr ""
"fusionnés avec le tampon \"core\" : \"${buffer.hidden}==0 && ((${type}!"
"=server && ${buffer.full_name}!=core.weechat) || ${buffer.active}==1)\""
msgid "enable buflist"
msgstr "activer buflist"
msgid ""
"if enabled, clicks with left/right buttons on the line with current buffer "
"jump to previous/next visited buffer"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2017-05-02 07:33+0200\n"
"POT-Creation-Date: 2017-05-05 23:16+0200\n"
"PO-Revision-Date: 2017-01-06 22:03+0100\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -4503,6 +4503,9 @@ msgid ""
"=core.weechat) || ${buffer.active}==1)\""
msgstr ""
msgid "enable buflist"
msgstr ""
msgid ""
"if enabled, clicks with left/right buttons on the line with current buffer "
"jump to previous/next visited buffer"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2017-05-02 07:33+0200\n"
"POT-Creation-Date: 2017-05-05 23:16+0200\n"
"PO-Revision-Date: 2017-01-06 22:04+0100\n"
"Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -5317,6 +5317,9 @@ msgid ""
"=core.weechat) || ${buffer.active}==1)\""
msgstr ""
msgid "enable buflist"
msgstr ""
msgid ""
"if enabled, clicks with left/right buttons on the line with current buffer "
"jump to previous/next visited buffer"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2017-05-02 07:33+0200\n"
"POT-Creation-Date: 2017-05-05 23:16+0200\n"
"PO-Revision-Date: 2017-05-02 09:00+0900\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/weechat/tree/master/"
@ -5509,6 +5509,9 @@ msgstr ""
"\"${buffer.hidden}==0 && ((${type}!=server && ${buffer.full_name}!=core."
"weechat) || ${buffer.active}==1)\""
msgid "enable buflist"
msgstr ""
msgid ""
"if enabled, clicks with left/right buttons on the line with current buffer "
"jump to previous/next visited buffer"

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2017-05-02 07:33+0200\n"
"POT-Creation-Date: 2017-05-05 23:16+0200\n"
"PO-Revision-Date: 2017-04-08 14:49+0200\n"
"Last-Translator: Krzysztof Korościk <soltys@soltys.info>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -5571,6 +5571,9 @@ msgid ""
"=core.weechat) || ${buffer.active}==1)\""
msgstr ""
msgid "enable buflist"
msgstr ""
msgid ""
"if enabled, clicks with left/right buttons on the line with current buffer "
"jump to previous/next visited buffer"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2017-05-02 07:33+0200\n"
"POT-Creation-Date: 2017-05-05 23:16+0200\n"
"PO-Revision-Date: 2017-04-08 14:50+0200\n"
"Last-Translator: Vasco Almeida <vascomalmeida@sapo.pt>\n"
"Language-Team: Portuguese <>\n"
@ -5573,6 +5573,9 @@ msgid ""
"=core.weechat) || ${buffer.active}==1)\""
msgstr ""
msgid "enable buflist"
msgstr ""
msgid ""
"if enabled, clicks with left/right buttons on the line with current buffer "
"jump to previous/next visited buffer"

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2017-05-02 07:33+0200\n"
"POT-Creation-Date: 2017-05-05 23:16+0200\n"
"PO-Revision-Date: 2016-09-03 08:24+0200\n"
"Last-Translator: Eduardo Elias <camponez@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -5119,6 +5119,9 @@ msgid ""
"=core.weechat) || ${buffer.active}==1)\""
msgstr ""
msgid "enable buflist"
msgstr ""
msgid ""
"if enabled, clicks with left/right buttons on the line with current buffer "
"jump to previous/next visited buffer"

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2017-05-02 07:33+0200\n"
"POT-Creation-Date: 2017-05-05 23:16+0200\n"
"PO-Revision-Date: 2017-01-06 22:06+0100\n"
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -4541,6 +4541,9 @@ msgid ""
"=core.weechat) || ${buffer.active}==1)\""
msgstr ""
msgid "enable buflist"
msgstr ""
msgid ""
"if enabled, clicks with left/right buttons on the line with current buffer "
"jump to previous/next visited buffer"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2017-05-02 07:33+0200\n"
"POT-Creation-Date: 2017-05-05 23:16+0200\n"
"PO-Revision-Date: 2017-01-06 22:07+0100\n"
"Last-Translator: Hasan Kiran <sunder67@hotmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -4106,6 +4106,9 @@ msgid ""
"=core.weechat) || ${buffer.active}==1)\""
msgstr ""
msgid "enable buflist"
msgstr ""
msgid ""
"if enabled, clicks with left/right buttons on the line with current buffer "
"jump to previous/next visited buffer"

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2017-05-02 07:33+0200\n"
"POT-Creation-Date: 2017-05-05 23:16+0200\n"
"PO-Revision-Date: 2014-08-16 10:27+0200\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -4091,6 +4091,9 @@ msgid ""
"=core.weechat) || ${buffer.active}==1)\""
msgstr ""
msgid "enable buflist"
msgstr ""
msgid ""
"if enabled, clicks with left/right buttons on the line with current buffer "
"jump to previous/next visited buffer"

View File

@ -37,6 +37,17 @@ struct t_hashtable *buflist_hashtable_options_conditions = NULL;
struct t_arraylist *buflist_list_buffers = NULL;
/*
* Updates buflist bar item if buflist is enabled.
*/
void
buflist_bar_item_update ()
{
if (weechat_config_boolean (buflist_config_look_enabled))
weechat_bar_item_update (BUFLIST_BAR_ITEM_NAME);
}
/*
* Returns content of bar item "buffer_plugin": bar item with buffer plugin.
*/
@ -79,6 +90,9 @@ buflist_bar_item_buflist_cb (const void *pointer, void *data,
(void) buffer;
(void) extra_info;
if (!weechat_config_boolean (buflist_config_look_enabled))
return NULL;
prev_number = -1;
buflist = weechat_string_dyn_alloc (256);

View File

@ -24,6 +24,7 @@
extern struct t_arraylist *buflist_list_buffers;
extern void buflist_bar_item_update ();
extern int buflist_bar_item_init ();
extern void buflist_bar_item_end ();

View File

@ -52,7 +52,7 @@ buflist_command_buflist (const void *pointer, void *data,
if (weechat_strcasecmp (argv[1], "refresh") == 0)
{
weechat_bar_item_update (BUFLIST_BAR_ITEM_NAME);
buflist_bar_item_update ();
return WEECHAT_RC_OK;
}

View File

@ -33,6 +33,7 @@ struct t_config_file *buflist_config_file = NULL;
/* buflist config, look section */
struct t_config_option *buflist_config_look_display_conditions;
struct t_config_option *buflist_config_look_enabled;
struct t_config_option *buflist_config_look_mouse_jump_visited_buffer;
struct t_config_option *buflist_config_look_mouse_move_buffer;
struct t_config_option *buflist_config_look_mouse_wheel;
@ -60,29 +61,6 @@ char **buflist_config_sort_fields = NULL;
int buflist_config_sort_fields_count = 0;
/*
* Callback for changes on option "buflist.look.sort".
*/
void
buflist_config_change_sort (const void *pointer, void *data,
struct t_config_option *option)
{
/* make C compiler happy */
(void) pointer;
(void) data;
(void) option;
if (buflist_config_sort_fields)
weechat_string_free_split (buflist_config_sort_fields);
buflist_config_sort_fields = weechat_string_split (
weechat_config_string (buflist_config_look_sort),
",", 0, 0, &buflist_config_sort_fields_count);
weechat_bar_item_update (BUFLIST_BAR_ITEM_NAME);
}
/*
* Frees the signals hooked for refresh.
*/
@ -106,27 +84,6 @@ buflist_config_free_signals_refresh ()
buflist_config_num_signals_refresh = 0;
}
/*
* Callback for a signal on a buffer.
*/
int
buflist_config_signal_buffer_cb (const void *pointer, void *data,
const char *signal, const char *type_data,
void *signal_data)
{
/* make C compiler happy */
(void) pointer;
(void) data;
(void) signal;
(void) type_data;
(void) signal_data;
weechat_bar_item_update (BUFLIST_BAR_ITEM_NAME);
return WEECHAT_RC_OK;
}
/*
* Compares two signals to add them in the sorted arraylist.
*
@ -148,26 +105,38 @@ buflist_config_compare_signals (void *data, struct t_arraylist *arraylist,
}
/*
* Callback for changes on option "buflist.look.signals_refresh".
* Callback for a signal on a buffer.
*/
int
buflist_config_signal_buffer_cb (const void *pointer, void *data,
const char *signal, const char *type_data,
void *signal_data)
{
/* make C compiler happy */
(void) pointer;
(void) data;
(void) signal;
(void) type_data;
(void) signal_data;
buflist_bar_item_update ();
return WEECHAT_RC_OK;
}
/*
* Hooks the signals for refresh.
*/
void
buflist_config_change_signals_refresh (const void *pointer, void *data,
struct t_config_option *option)
buflist_config_hook_signals_refresh ()
{
char **all_signals, **signals;
const char *ptr_signals_refresh;
struct t_arraylist *signals_list;
int count, i;
/* make C compiler happy */
(void) pointer;
(void) data;
(void) option;
if (buflist_config_signals_refresh)
buflist_config_free_signals_refresh ();
all_signals = weechat_string_dyn_alloc (256);
if (!all_signals)
return;
@ -232,6 +201,76 @@ buflist_config_change_signals_refresh (const void *pointer, void *data,
weechat_string_dyn_free (all_signals, 1);
}
/*
* Callback for changes on option "buflist.look.enabled".
*/
void
buflist_config_change_enabled (const void *pointer, void *data,
struct t_config_option *option)
{
/* make C compiler happy */
(void) pointer;
(void) data;
(void) option;
buflist_config_free_signals_refresh ();
if (weechat_config_boolean (buflist_config_look_enabled))
{
/* buflist enabled */
buflist_config_hook_signals_refresh ();
weechat_command (NULL, "/mute /bar show buflist");
buflist_bar_item_update ();
}
else
{
/* buflist disabled */
weechat_command (NULL, "/mute /bar hide buflist");
weechat_bar_item_update (BUFLIST_BAR_ITEM_NAME);
}
}
/*
* Callback for changes on option "buflist.look.sort".
*/
void
buflist_config_change_sort (const void *pointer, void *data,
struct t_config_option *option)
{
/* make C compiler happy */
(void) pointer;
(void) data;
(void) option;
if (buflist_config_sort_fields)
weechat_string_free_split (buflist_config_sort_fields);
buflist_config_sort_fields = weechat_string_split (
weechat_config_string (buflist_config_look_sort),
",", 0, 0, &buflist_config_sort_fields_count);
buflist_bar_item_update ();
}
/*
* Callback for changes on option "buflist.look.signals_refresh".
*/
void
buflist_config_change_signals_refresh (const void *pointer, void *data,
struct t_config_option *option)
{
/* make C compiler happy */
(void) pointer;
(void) data;
(void) option;
buflist_config_free_signals_refresh ();
buflist_config_hook_signals_refresh ();
}
/*
* Callback for changes on option "buflist.look.nick_prefix".
*/
@ -246,7 +285,7 @@ buflist_config_change_nick_prefix (const void *pointer, void *data,
(void) option;
buflist_config_change_signals_refresh (NULL, NULL, NULL);
weechat_bar_item_update (BUFLIST_BAR_ITEM_NAME);
buflist_bar_item_update ();
}
/*
@ -262,7 +301,7 @@ buflist_config_change_buflist (const void *pointer, void *data,
(void) data;
(void) option;
weechat_bar_item_update (BUFLIST_BAR_ITEM_NAME);
buflist_bar_item_update ();
}
/*
@ -309,6 +348,14 @@ buflist_config_init ()
NULL, NULL, NULL,
&buflist_config_change_buflist, NULL, NULL,
NULL, NULL, NULL);
buflist_config_look_enabled = weechat_config_new_option (
buflist_config_file, ptr_section,
"enabled", "boolean",
N_("enable buflist"),
NULL, 0, 0, "on", NULL, 0,
NULL, NULL, NULL,
&buflist_config_change_enabled, NULL, NULL,
NULL, NULL, NULL);
buflist_config_look_mouse_jump_visited_buffer = weechat_config_new_option (
buflist_config_file, ptr_section,
"mouse_jump_visited_buffer", "boolean",

View File

@ -33,6 +33,7 @@
extern struct t_config_file *buflist_config_file;
extern struct t_config_option *buflist_config_look_display_conditions;
extern struct t_config_option *buflist_config_look_enabled;
extern struct t_config_option *buflist_config_look_mouse_jump_visited_buffer;
extern struct t_config_option *buflist_config_look_mouse_move_buffer;
extern struct t_config_option *buflist_config_look_mouse_wheel;

View File

@ -448,7 +448,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
"default", "default", "default", "on",
BUFLIST_BAR_ITEM_NAME);
weechat_bar_item_update (BUFLIST_BAR_ITEM_NAME);
buflist_bar_item_update ();
buflist_mouse_init ();