From 5d0a74a43e58aa10b824f88094378013c8ac2d12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Fri, 6 Jun 2014 19:39:19 +0200 Subject: [PATCH] core: add option weechat.look.hotlist_remove (closes #99) --- ChangeLog.asciidoc | 1 + doc/de/autogen/user/weechat_options.asciidoc | 5 +++++ doc/en/autogen/user/weechat_options.asciidoc | 5 +++++ doc/fr/autogen/user/weechat_options.asciidoc | 5 +++++ doc/it/autogen/user/weechat_options.asciidoc | 5 +++++ doc/ja/autogen/user/weechat_options.asciidoc | 5 +++++ doc/pl/autogen/user/weechat_options.asciidoc | 5 +++++ po/cs.po | 7 ++++++- po/de.po | 7 ++++++- po/es.po | 7 ++++++- po/fr.po | 11 ++++++++-- po/hu.po | 7 ++++++- po/it.po | 7 ++++++- po/ja.po | 7 ++++++- po/pl.po | 7 ++++++- po/pt_BR.po | 7 ++++++- po/ru.po | 7 ++++++- po/tr.po | 7 ++++++- po/weechat.pot | 7 ++++++- src/core/wee-config.c | 8 ++++++++ src/core/wee-config.h | 7 +++++++ src/gui/gui-hotlist.c | 21 ++++++++++++++++---- 22 files changed, 138 insertions(+), 17 deletions(-) diff --git a/ChangeLog.asciidoc b/ChangeLog.asciidoc index 00eb7c459..f4ac57b81 100644 --- a/ChangeLog.asciidoc +++ b/ChangeLog.asciidoc @@ -55,6 +55,7 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes] * core: fix "/window scroll -N" on a buffer with free content * core: add option weechat.look.hotlist_add_conditions, remove option weechat.look.hotlist_add_buffer_if_away +* core: add option weechat.look.hotlist_remove (closes #99) * core: fix recursive calls to function eval_expression * core: mute all buffers by default in command /mute (replace option -all by -core) diff --git a/doc/de/autogen/user/weechat_options.asciidoc b/doc/de/autogen/user/weechat_options.asciidoc index b09e92412..d536b538a 100644 --- a/doc/de/autogen/user/weechat_options.asciidoc +++ b/doc/de/autogen/user/weechat_options.asciidoc @@ -603,6 +603,11 @@ ** Typ: Zeichenkette ** Werte: beliebige Zeichenkette (Standardwert: `"H: "`) +* [[option_weechat.look.hotlist_remove]] *weechat.look.hotlist_remove* +** Beschreibung: `remove buffers in hotlist: buffer = remove buffer by buffer, merged = remove all visible merged buffers at once` +** Typ: integer +** Werte: buffer, merged (Standardwert: `buffer`) + * [[option_weechat.look.hotlist_short_names]] *weechat.look.hotlist_short_names* ** Beschreibung: `ist diese Option aktiviert, wird der Kurzname der zusammengefügten Buffer in der Hotlist dargestellt (die Darstellung geschieht nach dem ersten '.' im Namen)` ** Typ: boolesch diff --git a/doc/en/autogen/user/weechat_options.asciidoc b/doc/en/autogen/user/weechat_options.asciidoc index 1ffead404..636bc7668 100644 --- a/doc/en/autogen/user/weechat_options.asciidoc +++ b/doc/en/autogen/user/weechat_options.asciidoc @@ -603,6 +603,11 @@ ** type: string ** values: any string (default value: `"H: "`) +* [[option_weechat.look.hotlist_remove]] *weechat.look.hotlist_remove* +** description: `remove buffers in hotlist: buffer = remove buffer by buffer, merged = remove all visible merged buffers at once` +** type: integer +** values: buffer, merged (default value: `buffer`) + * [[option_weechat.look.hotlist_short_names]] *weechat.look.hotlist_short_names* ** description: `if set, uses short names to display buffer names in hotlist (start after first '.' in name)` ** type: boolean diff --git a/doc/fr/autogen/user/weechat_options.asciidoc b/doc/fr/autogen/user/weechat_options.asciidoc index 9b20eb041..4141f2b14 100644 --- a/doc/fr/autogen/user/weechat_options.asciidoc +++ b/doc/fr/autogen/user/weechat_options.asciidoc @@ -603,6 +603,11 @@ ** type: chaîne ** valeurs: toute chaîne (valeur par défaut: `"H: "`) +* [[option_weechat.look.hotlist_remove]] *weechat.look.hotlist_remove* +** description: `supprimer les tampons de la liste d'activité : buffer = supprimer tampon par tampon, merged = supprimer tous les tampons mélangés visibles d'un seul coup` +** type: entier +** valeurs: buffer, merged (valeur par défaut: `buffer`) + * [[option_weechat.look.hotlist_short_names]] *weechat.look.hotlist_short_names* ** description: `si défini, utilise des noms courts pour afficher les noms de tampons dans la hotlist (commence après le premier '.' dans le nom)` ** type: booléen diff --git a/doc/it/autogen/user/weechat_options.asciidoc b/doc/it/autogen/user/weechat_options.asciidoc index 966009962..460a7f9ea 100644 --- a/doc/it/autogen/user/weechat_options.asciidoc +++ b/doc/it/autogen/user/weechat_options.asciidoc @@ -603,6 +603,11 @@ ** tipo: stringa ** valori: qualsiasi stringa (valore predefinito: `"H: "`) +* [[option_weechat.look.hotlist_remove]] *weechat.look.hotlist_remove* +** descrizione: `remove buffers in hotlist: buffer = remove buffer by buffer, merged = remove all visible merged buffers at once` +** tipo: intero +** valori: buffer, merged (valore predefinito: `buffer`) + * [[option_weechat.look.hotlist_short_names]] *weechat.look.hotlist_short_names* ** descrizione: `se impostato, usa i nomi brevi per visualizzare i nomi dei buffer nella hotlist (inizia dopo il primo '.' nel nome)` ** tipo: bool diff --git a/doc/ja/autogen/user/weechat_options.asciidoc b/doc/ja/autogen/user/weechat_options.asciidoc index 0b5bc29e1..72381c727 100644 --- a/doc/ja/autogen/user/weechat_options.asciidoc +++ b/doc/ja/autogen/user/weechat_options.asciidoc @@ -603,6 +603,11 @@ ** タイプ: 文字列 ** 値: 未制約文字列 (デフォルト値: `"H: "`) +* [[option_weechat.look.hotlist_remove]] *weechat.look.hotlist_remove* +** 説明: `remove buffers in hotlist: buffer = remove buffer by buffer, merged = remove all visible merged buffers at once` +** タイプ: 整数 +** 値: buffer, merged (デフォルト値: `buffer`) + * [[option_weechat.look.hotlist_short_names]] *weechat.look.hotlist_short_names* ** 説明: `セットされた場合、ホットリストではバッファ名に短い名前を使う (名前に含まれる最初の '.' 以降)` ** タイプ: ブール diff --git a/doc/pl/autogen/user/weechat_options.asciidoc b/doc/pl/autogen/user/weechat_options.asciidoc index 7e4fe32f7..f19d0ba48 100644 --- a/doc/pl/autogen/user/weechat_options.asciidoc +++ b/doc/pl/autogen/user/weechat_options.asciidoc @@ -603,6 +603,11 @@ ** typ: ciąg ** wartości: dowolny ciąg (domyślna wartość: `"H: "`) +* [[option_weechat.look.hotlist_remove]] *weechat.look.hotlist_remove* +** opis: `remove buffers in hotlist: buffer = remove buffer by buffer, merged = remove all visible merged buffers at once` +** typ: liczba +** wartości: buffer, merged (domyślna wartość: `buffer`) + * [[option_weechat.look.hotlist_short_names]] *weechat.look.hotlist_short_names* ** opis: `jeśli ustawione, używa krótkich nazw do wyświetlania nazw buforów w hotliście (zaczyna po pierwszym wystąpieniu '.' w nazwie)` ** typ: bool diff --git a/po/cs.po b/po/cs.po index a466f94da..a00043902 100644 --- a/po/cs.po +++ b/po/cs.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-05-26 07:50+0200\n" +"POT-Creation-Date: 2014-06-06 19:29+0200\n" "PO-Revision-Date: 2014-04-19 13:08+0200\n" "Last-Translator: Jiri Golembiovsky \n" "Language-Team: weechat-dev \n" @@ -2943,6 +2943,11 @@ msgstr "" msgid "text displayed at the beginning of the hotlist" msgstr "řetězec zobrazený mezi buffery v hotlistu" +msgid "" +"remove buffers in hotlist: buffer = remove buffer by buffer, merged = remove " +"all visible merged buffers at once" +msgstr "" + msgid "" "if set, uses short names to display buffer names in hotlist (start after " "first '.' in name)" diff --git a/po/de.po b/po/de.po index 2b58cad44..d79681f1e 100644 --- a/po/de.po +++ b/po/de.po @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-05-26 07:50+0200\n" +"POT-Creation-Date: 2014-06-06 19:29+0200\n" "PO-Revision-Date: 2014-05-26 19:19+0100\n" "Last-Translator: Nils Görs \n" "Language-Team: German \n" @@ -3451,6 +3451,11 @@ msgstr "" msgid "text displayed at the beginning of the hotlist" msgstr "Text der vor der Hotlist angezeigt werden soll" +msgid "" +"remove buffers in hotlist: buffer = remove buffer by buffer, merged = remove " +"all visible merged buffers at once" +msgstr "" + msgid "" "if set, uses short names to display buffer names in hotlist (start after " "first '.' in name)" diff --git a/po/es.po b/po/es.po index 8546f99eb..20dff715b 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: 2014-05-26 07:50+0200\n" +"POT-Creation-Date: 2014-06-06 19:29+0200\n" "PO-Revision-Date: 2014-04-19 13:08+0200\n" "Last-Translator: Elián Hanisch \n" "Language-Team: weechat-dev \n" @@ -3106,6 +3106,11 @@ msgstr "" msgid "text displayed at the beginning of the hotlist" msgstr "cadena mostrada entre los buffers en la lista de actividad" +msgid "" +"remove buffers in hotlist: buffer = remove buffer by buffer, merged = remove " +"all visible merged buffers at once" +msgstr "" + msgid "" "if set, uses short names to display buffer names in hotlist (start after " "first '.' in name)" diff --git a/po/fr.po b/po/fr.po index 16e529d14..af592ac21 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: 2014-05-26 07:50+0200\n" -"PO-Revision-Date: 2014-05-26 07:51+0200\n" +"POT-Creation-Date: 2014-06-06 19:29+0200\n" +"PO-Revision-Date: 2014-06-06 19:30+0200\n" "Last-Translator: Sébastien Helleu \n" "Language-Team: weechat-dev \n" "Language: fr\n" @@ -3362,6 +3362,13 @@ msgstr "" msgid "text displayed at the beginning of the hotlist" msgstr "chaîne affichée au début de la hotlist" +msgid "" +"remove buffers in hotlist: buffer = remove buffer by buffer, merged = remove " +"all visible merged buffers at once" +msgstr "" +"supprimer les tampons de la liste d'activité : buffer = supprimer tampon par " +"tampon, merged = supprimer tous les tampons mélangés visibles d'un seul coup" + msgid "" "if set, uses short names to display buffer names in hotlist (start after " "first '.' in name)" diff --git a/po/hu.po b/po/hu.po index 8c0162305..3b1c7e6d8 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: 2014-05-26 07:50+0200\n" +"POT-Creation-Date: 2014-06-06 19:29+0200\n" "PO-Revision-Date: 2014-04-05 16:12+0200\n" "Last-Translator: Andras Voroskoi \n" "Language-Team: weechat-dev \n" @@ -2575,6 +2575,11 @@ msgstr "" msgid "text displayed at the beginning of the hotlist" msgstr "kiemelendő szavak listája" +msgid "" +"remove buffers in hotlist: buffer = remove buffer by buffer, merged = remove " +"all visible merged buffers at once" +msgstr "" + msgid "" "if set, uses short names to display buffer names in hotlist (start after " "first '.' in name)" diff --git a/po/it.po b/po/it.po index fb8ea41b0..94548901e 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: 2014-05-26 07:50+0200\n" +"POT-Creation-Date: 2014-06-06 19:29+0200\n" "PO-Revision-Date: 2014-04-19 13:08+0200\n" "Last-Translator: Esteban I. Ruiz Moreno \n" "Language-Team: weechat-dev \n" @@ -3199,6 +3199,11 @@ msgstr "" msgid "text displayed at the beginning of the hotlist" msgstr "testo mostrato in cima alla hotlist" +msgid "" +"remove buffers in hotlist: buffer = remove buffer by buffer, merged = remove " +"all visible merged buffers at once" +msgstr "" + msgid "" "if set, uses short names to display buffer names in hotlist (start after " "first '.' in name)" diff --git a/po/ja.po b/po/ja.po index 2471520c6..9edb0ab2d 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: 2014-05-26 07:50+0200\n" +"POT-Creation-Date: 2014-06-06 19:29+0200\n" "PO-Revision-Date: 2014-05-15 12:40+0900\n" "Last-Translator: AYANOKOUZI, Ryuunosuke \n" "Language-Team: Japanese \n" @@ -3255,6 +3255,11 @@ msgstr "" msgid "text displayed at the beginning of the hotlist" msgstr "ホットリストの最初に表示されるテキスト" +msgid "" +"remove buffers in hotlist: buffer = remove buffer by buffer, merged = remove " +"all visible merged buffers at once" +msgstr "" + msgid "" "if set, uses short names to display buffer names in hotlist (start after " "first '.' in name)" diff --git a/po/pl.po b/po/pl.po index 6eb2abad7..452a8fe76 100644 --- a/po/pl.po +++ b/po/pl.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-05-26 07:50+0200\n" +"POT-Creation-Date: 2014-06-06 19:29+0200\n" "PO-Revision-Date: 2014-04-19 13:08+0200\n" "Last-Translator: Krzysztof Korościk \n" "Language-Team: weechat-dev \n" @@ -3311,6 +3311,11 @@ msgstr "" msgid "text displayed at the beginning of the hotlist" msgstr "ciąg znaków wyświetlany na początku hotlisty" +msgid "" +"remove buffers in hotlist: buffer = remove buffer by buffer, merged = remove " +"all visible merged buffers at once" +msgstr "" + msgid "" "if set, uses short names to display buffer names in hotlist (start after " "first '.' in name)" diff --git a/po/pt_BR.po b/po/pt_BR.po index a452ca133..cbd084bb1 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: 2014-05-26 07:50+0200\n" +"POT-Creation-Date: 2014-06-06 19:29+0200\n" "PO-Revision-Date: 2014-04-05 16:12+0200\n" "Last-Translator: Sergio Durigan Junior \n" "Language-Team: weechat-dev \n" @@ -3034,6 +3034,11 @@ msgstr "" msgid "text displayed at the beginning of the hotlist" msgstr "string exibida entre buffers na lista de atividade" +msgid "" +"remove buffers in hotlist: buffer = remove buffer by buffer, merged = remove " +"all visible merged buffers at once" +msgstr "" + msgid "" "if set, uses short names to display buffer names in hotlist (start after " "first '.' in name)" diff --git a/po/ru.po b/po/ru.po index acec80b31..89c6544b6 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: 2014-05-26 07:50+0200\n" +"POT-Creation-Date: 2014-06-06 19:29+0200\n" "PO-Revision-Date: 2014-04-05 16:12+0200\n" "Last-Translator: Aleksey V Zapparov AKA ixti \n" "Language-Team: weechat-dev \n" @@ -2602,6 +2602,11 @@ msgstr "" msgid "text displayed at the beginning of the hotlist" msgstr "максимальная длина имён в хотлисте" +msgid "" +"remove buffers in hotlist: buffer = remove buffer by buffer, merged = remove " +"all visible merged buffers at once" +msgstr "" + msgid "" "if set, uses short names to display buffer names in hotlist (start after " "first '.' in name)" diff --git a/po/tr.po b/po/tr.po index 68b56255c..5a3befd12 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: 2014-05-26 07:50+0200\n" +"POT-Creation-Date: 2014-06-06 19:29+0200\n" "PO-Revision-Date: 2014-03-24 14:23+0100\n" "Last-Translator: Hasan Kiran \n" "Language-Team: weechat-dev \n" @@ -2322,6 +2322,11 @@ msgstr "" msgid "text displayed at the beginning of the hotlist" msgstr "" +msgid "" +"remove buffers in hotlist: buffer = remove buffer by buffer, merged = remove " +"all visible merged buffers at once" +msgstr "" + msgid "" "if set, uses short names to display buffer names in hotlist (start after " "first '.' in name)" diff --git a/po/weechat.pot b/po/weechat.pot index afc518929..c5ebdae31 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.1-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-05-26 07:50+0200\n" +"POT-Creation-Date: 2014-06-06 19:29+0200\n" "PO-Revision-Date: 2013-02-14 18:20+0100\n" "Last-Translator: FULL NAME \n" "Language-Team: weechat-dev \n" @@ -2323,6 +2323,11 @@ msgstr "" msgid "text displayed at the beginning of the hotlist" msgstr "" +msgid "" +"remove buffers in hotlist: buffer = remove buffer by buffer, merged = remove " +"all visible merged buffers at once" +msgstr "" + msgid "" "if set, uses short names to display buffer names in hotlist (start after " "first '.' in name)" diff --git a/src/core/wee-config.c b/src/core/wee-config.c index e6a4abd24..4b19bd83c 100644 --- a/src/core/wee-config.c +++ b/src/core/wee-config.c @@ -122,6 +122,7 @@ struct t_config_option *config_look_hotlist_names_length; struct t_config_option *config_look_hotlist_names_level; struct t_config_option *config_look_hotlist_names_merged_buffers; struct t_config_option *config_look_hotlist_prefix; +struct t_config_option *config_look_hotlist_remove; struct t_config_option *config_look_hotlist_short_names; struct t_config_option *config_look_hotlist_sort; struct t_config_option *config_look_hotlist_suffix; @@ -2351,6 +2352,13 @@ config_weechat_init_options () "hotlist_prefix", "string", N_("text displayed at the beginning of the hotlist"), NULL, 0, 0, "H: ", NULL, 0, NULL, NULL, &config_change_buffer_content, NULL, NULL, NULL); + config_look_hotlist_remove = config_file_new_option ( + weechat_config_file, ptr_section, + "hotlist_remove", "integer", + N_("remove buffers in hotlist: buffer = remove buffer by buffer, " + "merged = remove all visible merged buffers at once"), + "buffer|merged", + 0, 0, "buffer", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); config_look_hotlist_short_names = config_file_new_option ( weechat_config_file, ptr_section, "hotlist_short_names", "boolean", diff --git a/src/core/wee-config.h b/src/core/wee-config.h index 341983cb5..f6db4466d 100644 --- a/src/core/wee-config.h +++ b/src/core/wee-config.h @@ -66,6 +66,12 @@ enum t_config_look_prefix_buffer_align CONFIG_LOOK_PREFIX_BUFFER_ALIGN_RIGHT, }; +enum t_config_look_hotlist_remove +{ + CONFIG_LOOK_HOTLIST_REMOVE_BUFFER = 0, + CONFIG_LOOK_HOTLIST_REMOVE_MERGED, +}; + enum t_config_look_hotlist_sort { CONFIG_LOOK_HOTLIST_SORT_GROUP_TIME_ASC = 0, @@ -153,6 +159,7 @@ extern struct t_config_option *config_look_hotlist_names_length; extern struct t_config_option *config_look_hotlist_names_level; extern struct t_config_option *config_look_hotlist_names_merged_buffers; extern struct t_config_option *config_look_hotlist_prefix; +extern struct t_config_option *config_look_hotlist_remove; extern struct t_config_option *config_look_hotlist_short_names; extern struct t_config_option *config_look_hotlist_sort; extern struct t_config_option *config_look_hotlist_suffix; diff --git a/src/gui/gui-hotlist.c b/src/gui/gui-hotlist.c index a28f596f3..4bf71077c 100644 --- a/src/gui/gui-hotlist.c +++ b/src/gui/gui-hotlist.c @@ -489,7 +489,7 @@ gui_hotlist_clear () void gui_hotlist_remove_buffer (struct t_gui_buffer *buffer) { - int hotlist_changed; + int hotlist_changed, hotlist_remove, buffer_to_remove; struct t_gui_hotlist *ptr_hotlist, *next_hotlist; if (!buffer || weechat_upgrading) @@ -497,14 +497,27 @@ gui_hotlist_remove_buffer (struct t_gui_buffer *buffer) hotlist_changed = 0; + hotlist_remove = CONFIG_INTEGER(config_look_hotlist_remove); + ptr_hotlist = gui_hotlist; while (ptr_hotlist) { next_hotlist = ptr_hotlist->next_hotlist; - if ((ptr_hotlist->buffer->number == buffer->number) - && (!ptr_hotlist->buffer->zoomed - || (ptr_hotlist->buffer->active == 2))) + buffer_to_remove = 0; + switch (hotlist_remove) + { + case CONFIG_LOOK_HOTLIST_REMOVE_BUFFER: + buffer_to_remove = (ptr_hotlist->buffer == buffer); + break; + case CONFIG_LOOK_HOTLIST_REMOVE_MERGED: + buffer_to_remove = + ((ptr_hotlist->buffer->number == buffer->number) + && (!ptr_hotlist->buffer->zoomed + || (ptr_hotlist->buffer->active == 2))); + break; + } + if (buffer_to_remove) { gui_hotlist_free (&gui_hotlist, &last_gui_hotlist, ptr_hotlist); hotlist_changed = 1;