From 9816c8cbce202c97c5d6fd14260ff7e18a6a97c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Sat, 25 Mar 2017 21:39:59 +0100 Subject: [PATCH] buflist: add option buflist.look.signals_refresh --- doc/de/autogen/user/buflist_options.adoc | 6 ++ doc/en/autogen/user/buflist_options.adoc | 6 ++ doc/fr/autogen/user/buflist_options.adoc | 6 ++ doc/it/autogen/user/buflist_options.adoc | 6 ++ doc/ja/autogen/user/buflist_options.adoc | 6 ++ doc/pl/autogen/user/buflist_options.adoc | 6 ++ po/cs.po | 8 +- po/de.po | 10 ++- po/es.po | 8 +- po/fr.po | 11 ++- po/hu.po | 7 +- po/it.po | 8 +- po/ja.po | 8 +- po/pl.po | 8 +- po/pt.po | 8 +- po/pt_BR.po | 8 +- po/ru.po | 7 +- po/tr.po | 7 +- po/weechat.pot | 7 +- src/plugins/buflist/buflist-config.c | 105 +++++++++++++++++++++++ src/plugins/buflist/buflist-config.h | 3 + src/plugins/buflist/buflist.c | 36 -------- 22 files changed, 235 insertions(+), 50 deletions(-) diff --git a/doc/de/autogen/user/buflist_options.adoc b/doc/de/autogen/user/buflist_options.adoc index b5dd1ab51..62a7e805b 100644 --- a/doc/de/autogen/user/buflist_options.adoc +++ b/doc/de/autogen/user/buflist_options.adoc @@ -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 diff --git a/doc/en/autogen/user/buflist_options.adoc b/doc/en/autogen/user/buflist_options.adoc index e72baa172..bde041a38 100644 --- a/doc/en/autogen/user/buflist_options.adoc +++ b/doc/en/autogen/user/buflist_options.adoc @@ -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 diff --git a/doc/fr/autogen/user/buflist_options.adoc b/doc/fr/autogen/user/buflist_options.adoc index fe81e65e8..46c05431a 100644 --- a/doc/fr/autogen/user/buflist_options.adoc +++ b/doc/fr/autogen/user/buflist_options.adoc @@ -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 diff --git a/doc/it/autogen/user/buflist_options.adoc b/doc/it/autogen/user/buflist_options.adoc index bb8b7d445..06b88b05b 100644 --- a/doc/it/autogen/user/buflist_options.adoc +++ b/doc/it/autogen/user/buflist_options.adoc @@ -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 diff --git a/doc/ja/autogen/user/buflist_options.adoc b/doc/ja/autogen/user/buflist_options.adoc index 7fb32e17c..5689b13ed 100644 --- a/doc/ja/autogen/user/buflist_options.adoc +++ b/doc/ja/autogen/user/buflist_options.adoc @@ -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] ** タイプ: 文字列 diff --git a/doc/pl/autogen/user/buflist_options.adoc b/doc/pl/autogen/user/buflist_options.adoc index 86a8a470d..e65dd88d6 100644 --- a/doc/pl/autogen/user/buflist_options.adoc +++ b/doc/pl/autogen/user/buflist_options.adoc @@ -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 diff --git a/po/cs.po b/po/cs.po index 77e56ec65..cd69f03f0 100644 --- a/po/cs.po +++ b/po/cs.po @@ -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 \n" "Language-Team: weechat-dev \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 " diff --git a/po/de.po b/po/de.po index 34cf2ec78..9a11ccbd9 100644 --- a/po/de.po +++ b/po/de.po @@ -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 \n" "Language-Team: German \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 " diff --git a/po/es.po b/po/es.po index ad7ce896e..9775b46a9 100644 --- a/po/es.po +++ b/po/es.po @@ -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 \n" "Language-Team: weechat-dev \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 " diff --git a/po/fr.po b/po/fr.po index 6715ef398..2721d8102 100644 --- a/po/fr.po +++ b/po/fr.po @@ -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 \n" "Language-Team: weechat-dev \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)" diff --git a/po/hu.po b/po/hu.po index 04e959801..a38a8d420 100644 --- a/po/hu.po +++ b/po/hu.po @@ -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 \n" "Language-Team: weechat-dev \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 " diff --git a/po/it.po b/po/it.po index 8a43aa147..3ff44023b 100644 --- a/po/it.po +++ b/po/it.po @@ -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 \n" "Language-Team: weechat-dev \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 " diff --git a/po/ja.po b/po/ja.po index 7999dc9d2..2ab3e3bdd 100644 --- a/po/ja.po +++ b/po/ja.po @@ -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 \n" "Language-Team: Japanese \n" "Language-Team: weechat-dev \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 " diff --git a/po/pt.po b/po/pt.po index 5667e2ed8..d13bc2f69 100644 --- a/po/pt.po +++ b/po/pt.po @@ -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 \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 " diff --git a/po/pt_BR.po b/po/pt_BR.po index b21816d73..d00ccf950 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -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 \n" "Language-Team: weechat-dev \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 " diff --git a/po/ru.po b/po/ru.po index 37dda148a..025ffddec 100644 --- a/po/ru.po +++ b/po/ru.po @@ -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 \n" "Language-Team: weechat-dev \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 " diff --git a/po/tr.po b/po/tr.po index b233bb7d7..55c8ba19f 100644 --- a/po/tr.po +++ b/po/tr.po @@ -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 \n" "Language-Team: weechat-dev \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)" diff --git a/po/weechat.pot b/po/weechat.pot index 9d48ae592..ded7ff317 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -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 \n" "Language-Team: weechat-dev \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)" diff --git a/src/plugins/buflist/buflist-config.c b/src/plugins/buflist/buflist-config.c index 48f5a4766..d61ac9a6a 100644 --- a/src/plugins/buflist/buflist-config.c +++ b/src/plugins/buflist/buflist-config.c @@ -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); diff --git a/src/plugins/buflist/buflist-config.h b/src/plugins/buflist/buflist-config.h index e7991a034..87c7fbf8b 100644 --- a/src/plugins/buflist/buflist-config.h +++ b/src/plugins/buflist/buflist-config.h @@ -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; diff --git a/src/plugins/buflist/buflist.c b/src/plugins/buflist/buflist.c index 1a6d772df..4918d2917 100644 --- a/src/plugins/buflist/buflist.c +++ b/src/plugins/buflist/buflist.c @@ -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",