buflist: add option buflist.look.signals_refresh

This commit is contained in:
Sébastien Helleu 2017-03-25 21:39:59 +01:00
parent 370fbeb5a3
commit 9816c8cbce
22 changed files with 235 additions and 50 deletions

View File

@ -62,6 +62,12 @@
** Werte: beliebige Zeichenkette
** Standardwert: `+" ${color:green}[${color:brown}${lag}${color:green}]"+`
* [[option_buflist.look.signals_refresh]] *buflist.look.signals_refresh*
** Beschreibung: pass:none[comma-separated list of signals that are hooked and trigger the refresh of buffers list]
** Typ: Zeichenkette
** Werte: beliebige Zeichenkette
** Standardwert: `+"buffer_opened,buffer_closed,buffer_merged,buffer_unmerged,buffer_moved,buffer_renamed,buffer_switch,buffer_hidden,buffer_unhidden,buffer_localvar_added,buffer_localvar_changed,window_switch,hotlist_changed"+`
* [[option_buflist.look.sort]] *buflist.look.sort*
** Beschreibung: pass:none[comma-separated list of fields to sort buffers; each field is a hdata variable of buffer; char "-" can be used before field to reverse order]
** Typ: Zeichenkette

View File

@ -62,6 +62,12 @@
** values: any string
** default value: `+" ${color:green}[${color:brown}${lag}${color:green}]"+`
* [[option_buflist.look.signals_refresh]] *buflist.look.signals_refresh*
** description: pass:none[comma-separated list of signals that are hooked and trigger the refresh of buffers list]
** type: string
** values: any string
** default value: `+"buffer_opened,buffer_closed,buffer_merged,buffer_unmerged,buffer_moved,buffer_renamed,buffer_switch,buffer_hidden,buffer_unhidden,buffer_localvar_added,buffer_localvar_changed,window_switch,hotlist_changed"+`
* [[option_buflist.look.sort]] *buflist.look.sort*
** description: pass:none[comma-separated list of fields to sort buffers; each field is a hdata variable of buffer; char "-" can be used before field to reverse order]
** type: string

View File

@ -62,6 +62,12 @@
** valeurs: toute chaîne
** valeur par défaut: `+" ${color:green}[${color:brown}${lag}${color:green}]"+`
* [[option_buflist.look.signals_refresh]] *buflist.look.signals_refresh*
** description: pass:none[liste de signaux séparés par des virgules qui sont accrochés et déclenchent l'affichage de la liste des tampons]
** type: chaîne
** valeurs: toute chaîne
** valeur par défaut: `+"buffer_opened,buffer_closed,buffer_merged,buffer_unmerged,buffer_moved,buffer_renamed,buffer_switch,buffer_hidden,buffer_unhidden,buffer_localvar_added,buffer_localvar_changed,window_switch,hotlist_changed"+`
* [[option_buflist.look.sort]] *buflist.look.sort*
** description: pass:none[liste de champs séparés par des virgules pour trier les tampons ; chaque champ est une variable hdata du tampon ; le caractère "-" peut être utilisé pour inverser l'ordre]
** type: chaîne

View File

@ -62,6 +62,12 @@
** valori: qualsiasi stringa
** valore predefinito: `+" ${color:green}[${color:brown}${lag}${color:green}]"+`
* [[option_buflist.look.signals_refresh]] *buflist.look.signals_refresh*
** descrizione: pass:none[comma-separated list of signals that are hooked and trigger the refresh of buffers list]
** tipo: stringa
** valori: qualsiasi stringa
** valore predefinito: `+"buffer_opened,buffer_closed,buffer_merged,buffer_unmerged,buffer_moved,buffer_renamed,buffer_switch,buffer_hidden,buffer_unhidden,buffer_localvar_added,buffer_localvar_changed,window_switch,hotlist_changed"+`
* [[option_buflist.look.sort]] *buflist.look.sort*
** descrizione: pass:none[comma-separated list of fields to sort buffers; each field is a hdata variable of buffer; char "-" can be used before field to reverse order]
** tipo: stringa

View File

@ -62,6 +62,12 @@
** 値: 未制約文字列
** デフォルト値: `+" ${color:green}[${color:brown}${lag}${color:green}]"+`
* [[option_buflist.look.signals_refresh]] *buflist.look.signals_refresh*
** 説明: pass:none[comma-separated list of signals that are hooked and trigger the refresh of buffers list]
** タイプ: 文字列
** 値: 未制約文字列
** デフォルト値: `+"buffer_opened,buffer_closed,buffer_merged,buffer_unmerged,buffer_moved,buffer_renamed,buffer_switch,buffer_hidden,buffer_unhidden,buffer_localvar_added,buffer_localvar_changed,window_switch,hotlist_changed"+`
* [[option_buflist.look.sort]] *buflist.look.sort*
** 説明: pass:none[comma-separated list of fields to sort buffers; each field is a hdata variable of buffer; char "-" can be used before field to reverse order]
** タイプ: 文字列

View File

@ -62,6 +62,12 @@
** wartości: dowolny ciąg
** domyślna wartość: `+" ${color:green}[${color:brown}${lag}${color:green}]"+`
* [[option_buflist.look.signals_refresh]] *buflist.look.signals_refresh*
** opis: pass:none[comma-separated list of signals that are hooked and trigger the refresh of buffers list]
** typ: ciąg
** wartości: dowolny ciąg
** domyślna wartość: `+"buffer_opened,buffer_closed,buffer_merged,buffer_unmerged,buffer_moved,buffer_renamed,buffer_switch,buffer_hidden,buffer_unhidden,buffer_localvar_added,buffer_localvar_changed,window_switch,hotlist_changed"+`
* [[option_buflist.look.sort]] *buflist.look.sort*
** opis: pass:none[comma-separated list of fields to sort buffers; each field is a hdata variable of buffer; char "-" can be used before field to reverse order]
** typ: ciąg

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-03-25 15:10+0100\n"
"POT-Creation-Date: 2017-03-25 21:32+0100\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"
@ -4919,6 +4919,12 @@ msgid ""
"variable of buffer; char \"-\" can be used before field to reverse order"
msgstr ""
#, fuzzy
msgid ""
"comma-separated list of signals that are hooked and trigger the refresh of "
"buffers list"
msgstr "čárkami oddělený seznam slovníků, které použít pro tento buffer"
#, fuzzy
msgid ""
"format of each line with a buffer (note: content is evaluated, see /help "

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-03-25 15:10+0100\n"
"POT-Creation-Date: 2017-03-25 21:32+0100\n"
"PO-Revision-Date: 2017-03-12 21:27+0100\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German <kde-i18n-de@kde.org>\n"
@ -5786,6 +5786,14 @@ msgid ""
"variable of buffer; char \"-\" can be used before field to reverse order"
msgstr ""
#, fuzzy
msgid ""
"comma-separated list of signals that are hooked and trigger the refresh of "
"buffers list"
msgstr ""
"durch Kommata getrennte Liste von Wörterbüchern, welche in diesem Buffer "
"genutzt werden sollen"
#, fuzzy
msgid ""
"format of each line with a buffer (note: content is evaluated, see /help "

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-03-25 15:10+0100\n"
"POT-Creation-Date: 2017-03-25 21:32+0100\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"
@ -5131,6 +5131,12 @@ msgid ""
"variable of buffer; char \"-\" can be used before field to reverse order"
msgstr ""
#, fuzzy
msgid ""
"comma-separated list of signals that are hooked and trigger the refresh of "
"buffers list"
msgstr "lista separada por comas de diccionarios para usar en este buffer"
#, fuzzy
msgid ""
"format of each line with a buffer (note: content is evaluated, see /help "

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-03-25 15:10+0100\n"
"PO-Revision-Date: 2017-03-25 15:11+0100\n"
"POT-Creation-Date: 2017-03-25 21:32+0100\n"
"PO-Revision-Date: 2017-03-25 21:33+0100\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: fr\n"
@ -5701,6 +5701,13 @@ msgstr ""
"champ est une variable hdata du tampon ; le caractère \"-\" peut être "
"utilisé pour inverser l'ordre"
msgid ""
"comma-separated list of signals that are hooked and trigger the refresh of "
"buffers list"
msgstr ""
"liste de signaux séparés par des virgules qui sont accrochés et déclenchent "
"l'affichage de la liste des tampons"
msgid ""
"format of each line with a buffer (note: content is evaluated, see /help "
"buflist)"

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-03-25 15:10+0100\n"
"POT-Creation-Date: 2017-03-25 21:32+0100\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"
@ -4456,6 +4456,11 @@ msgid ""
"variable of buffer; char \"-\" can be used before field to reverse order"
msgstr ""
msgid ""
"comma-separated list of signals that are hooked and trigger the refresh of "
"buffers list"
msgstr ""
#, fuzzy
msgid ""
"format of each line with a buffer (note: content is evaluated, see /help "

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-03-25 15:10+0100\n"
"POT-Creation-Date: 2017-03-25 21:32+0100\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"
@ -5270,6 +5270,12 @@ msgid ""
"variable of buffer; char \"-\" can be used before field to reverse order"
msgstr ""
#, fuzzy
msgid ""
"comma-separated list of signals that are hooked and trigger the refresh of "
"buffers list"
msgstr "elenco separato da virgole di dizionari da usare su questo buffer"
#, fuzzy
msgid ""
"format of each line with a buffer (note: content is evaluated, see /help "

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-03-25 15:10+0100\n"
"POT-Creation-Date: 2017-03-25 21:32+0100\n"
"PO-Revision-Date: 2017-03-20 09:00+0900\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/weechat/tree/master/"
@ -5404,6 +5404,12 @@ msgid ""
"variable of buffer; char \"-\" can be used before field to reverse order"
msgstr ""
#, fuzzy
msgid ""
"comma-separated list of signals that are hooked and trigger the refresh of "
"buffers list"
msgstr "このバッファで使用中の辞書のコンマ区切りリスト"
#, fuzzy
msgid ""
"format of each line with a buffer (note: content is evaluated, see /help "

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-03-25 15:10+0100\n"
"POT-Creation-Date: 2017-03-25 21:32+0100\n"
"PO-Revision-Date: 2017-01-06 22:05+0100\n"
"Last-Translator: Krzysztof Korościk <soltys@soltys.info>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -5523,6 +5523,12 @@ msgid ""
"variable of buffer; char \"-\" can be used before field to reverse order"
msgstr ""
#, fuzzy
msgid ""
"comma-separated list of signals that are hooked and trigger the refresh of "
"buffers list"
msgstr "oddzielona przecinkami lista słowników do użycia w tym buforze"
#, fuzzy
msgid ""
"format of each line with a buffer (note: content is evaluated, see /help "

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-03-25 15:10+0100\n"
"POT-Creation-Date: 2017-03-25 21:32+0100\n"
"PO-Revision-Date: 2017-01-14 21:39+0100\n"
"Last-Translator: Vasco Almeida <vascomalmeida@sapo.pt>\n"
"Language-Team: Portuguese <>\n"
@ -5525,6 +5525,12 @@ msgid ""
"variable of buffer; char \"-\" can be used before field to reverse order"
msgstr ""
#, fuzzy
msgid ""
"comma-separated list of signals that are hooked and trigger the refresh of "
"buffers list"
msgstr "lista de dicionários separados por vírgula para usar neste buffer"
#, fuzzy
msgid ""
"format of each line with a buffer (note: content is evaluated, see /help "

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-03-25 15:10+0100\n"
"POT-Creation-Date: 2017-03-25 21:32+0100\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"
@ -5072,6 +5072,12 @@ msgid ""
"variable of buffer; char \"-\" can be used before field to reverse order"
msgstr ""
#, fuzzy
msgid ""
"comma-separated list of signals that are hooked and trigger the refresh of "
"buffers list"
msgstr "lista de dicionários (separados por vírgula) para uso neste buffer"
#, fuzzy
msgid ""
"format of each line with a buffer (note: content is evaluated, see /help "

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-03-25 15:10+0100\n"
"POT-Creation-Date: 2017-03-25 21:32+0100\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"
@ -4494,6 +4494,11 @@ msgid ""
"variable of buffer; char \"-\" can be used before field to reverse order"
msgstr ""
msgid ""
"comma-separated list of signals that are hooked and trigger the refresh of "
"buffers list"
msgstr ""
#, fuzzy
msgid ""
"format of each line with a buffer (note: content is evaluated, see /help "

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-03-25 15:10+0100\n"
"POT-Creation-Date: 2017-03-25 21:32+0100\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"
@ -4060,6 +4060,11 @@ msgid ""
"variable of buffer; char \"-\" can be used before field to reverse order"
msgstr ""
msgid ""
"comma-separated list of signals that are hooked and trigger the refresh of "
"buffers list"
msgstr ""
msgid ""
"format of each line with a buffer (note: content is evaluated, see /help "
"buflist)"

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-03-25 15:10+0100\n"
"POT-Creation-Date: 2017-03-25 21:32+0100\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"
@ -4045,6 +4045,11 @@ msgid ""
"variable of buffer; char \"-\" can be used before field to reverse order"
msgstr ""
msgid ""
"comma-separated list of signals that are hooked and trigger the refresh of "
"buffers list"
msgstr ""
msgid ""
"format of each line with a buffer (note: content is evaluated, see /help "
"buflist)"

View File

@ -31,6 +31,7 @@ struct t_config_file *buflist_config_file = NULL;
/* buflist config, look section */
struct t_config_option *buflist_config_look_signals_refresh;
struct t_config_option *buflist_config_look_sort;
/* buflist config, format section */
@ -43,6 +44,8 @@ struct t_config_option *buflist_config_format_hotlist_level_none;
struct t_config_option *buflist_config_format_hotlist_separator;
struct t_config_option *buflist_config_format_lag;
struct t_hook **buflist_config_signals_refresh = NULL;
int buflist_config_num_signals_refresh = 0;
char **buflist_config_sort_fields = NULL;
int buflist_config_sort_fields_count = 0;
@ -70,6 +73,90 @@ buflist_config_change_sort (const void *pointer, void *data,
weechat_bar_item_update (BUFLIST_BAR_ITEM_NAME);
}
/*
* Frees the signals hooked for refresh.
*/
void
buflist_config_free_signals_refresh ()
{
int i;
if (!buflist_config_signals_refresh)
return;
for (i = 0; i < buflist_config_num_signals_refresh; i++)
{
weechat_unhook (buflist_config_signals_refresh[i]);
}
free (buflist_config_signals_refresh);
buflist_config_signals_refresh = NULL;
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;
}
/*
* 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)
{
char **signals;
int count, i;
/* make C compiler happy */
(void) pointer;
(void) data;
(void) option;
if (buflist_config_signals_refresh)
buflist_config_free_signals_refresh ();
signals = weechat_string_split (
weechat_config_string (buflist_config_look_signals_refresh),
",", 0, 0, &count);
if (signals && (count > 0))
{
buflist_config_signals_refresh = malloc (
count * sizeof (*buflist_config_signals_refresh));
if (buflist_config_signals_refresh)
{
buflist_config_num_signals_refresh = count;
for (i = 0; i < count; i++)
{
buflist_config_signals_refresh[i] = weechat_hook_signal (
signals[i], &buflist_config_signal_buffer_cb, NULL, NULL);
}
}
}
if (signals)
weechat_string_free_split (signals);
}
/*
* Callback for changes on format options.
*/
@ -130,6 +217,20 @@ buflist_config_init ()
NULL, NULL, NULL,
&buflist_config_change_sort, NULL, NULL,
NULL, NULL, NULL);
buflist_config_look_signals_refresh = weechat_config_new_option (
buflist_config_file, ptr_section,
"signals_refresh", "string",
N_("comma-separated list of signals that are hooked and trigger the "
"refresh of buffers list"),
NULL, 0, 0,
"buffer_opened,buffer_closed,buffer_merged,buffer_unmerged,"
"buffer_moved,buffer_renamed,buffer_switch,buffer_hidden,"
"buffer_unhidden,buffer_localvar_added,buffer_localvar_changed,"
"window_switch,hotlist_changed",
NULL, 0,
NULL, NULL, NULL,
&buflist_config_change_signals_refresh, NULL, NULL,
NULL, NULL, NULL);
/* format */
ptr_section = weechat_config_new_section (buflist_config_file, "format",
@ -273,6 +374,7 @@ buflist_config_read ()
if (rc == WEECHAT_CONFIG_READ_OK)
{
buflist_config_change_sort (NULL, NULL, NULL);
buflist_config_change_signals_refresh (NULL, NULL, NULL);
}
return rc;
@ -297,6 +399,9 @@ buflist_config_free ()
{
weechat_config_free (buflist_config_file);
if (buflist_config_signals_refresh)
buflist_config_free_signals_refresh ();
if (buflist_config_sort_fields)
{
weechat_string_free_split (buflist_config_sort_fields);

View File

@ -24,6 +24,9 @@
extern struct t_config_file *buflist_config_file;
extern struct t_config_option *buflist_config_look_signals_refresh;
extern struct t_config_option *buflist_config_look_sort;
extern struct t_config_option *buflist_config_format_buffer;
extern struct t_config_option *buflist_config_format_buffer_current;
extern struct t_config_option *buflist_config_format_hotlist;

View File

@ -220,27 +220,6 @@ buflist_sort_buffers ()
return buffers;
}
/*
* Callback for a signal on a buffer.
*/
int
buflist_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;
}
/*
* Initializes buflist plugin.
*/
@ -248,14 +227,6 @@ buflist_signal_buffer_cb (const void *pointer, void *data,
int
weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
{
char *signals_buffers[] =
{ "buffer_opened", "buffer_closed", "buffer_merged", "buffer_unmerged",
"buffer_moved", "buffer_renamed", "buffer_switch", "buffer_hidden",
"buffer_unhidden", "buffer_localvar_added", "buffer_localvar_changed",
"window_switch", "hotlist_changed", NULL
};
int i;
/* make C compiler happy */
(void) argc;
(void) argv;
@ -275,13 +246,6 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
buflist_command_init ();
/* hook some signals */
for (i = 0; signals_buffers[i]; i++)
{
weechat_hook_signal (signals_buffers[i],
&buflist_signal_buffer_cb, NULL, NULL);
}
weechat_bar_new (BUFLIST_BAR_NAME, "off", "0", "root", "", "left",
"columns_vertical", "vertical", "0", "0",
"default", "default", "default", "on",