From 947ae241ceea9a665a3b667aaf6e5449bbe63aa5 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Sat, 16 May 2009 00:47:14 +0200 Subject: [PATCH] Add infolist "key" with key bindings --- doc/de/autogen/infolists.xml | 5 +++++ doc/en/autogen/infolists.xml | 5 +++++ doc/fr/autogen/infolists.xml | 5 +++++ po/cs.po | 6 +++++- po/de.po | 6 +++++- po/es.po | 6 +++++- po/fr.po | 7 +++++-- po/hu.po | 6 +++++- po/pl.po | 6 +++++- po/ru.po | 6 +++++- po/weechat.pot | 5 ++++- src/gui/gui-keyboard.c | 35 +++++++++++++++++++++++++++++++++++ src/gui/gui-keyboard.h | 2 ++ src/plugins/plugin-api.c | 19 +++++++++++++++++++ 14 files changed, 110 insertions(+), 9 deletions(-) diff --git a/doc/de/autogen/infolists.xml b/doc/de/autogen/infolists.xml index c80b8c298..b57b8cf29 100644 --- a/doc/de/autogen/infolists.xml +++ b/doc/de/autogen/infolists.xml @@ -106,6 +106,11 @@ hotlist list of buffers in hotlist + + weechat + key + list of key bindings + weechat nicklist diff --git a/doc/en/autogen/infolists.xml b/doc/en/autogen/infolists.xml index c80b8c298..b57b8cf29 100644 --- a/doc/en/autogen/infolists.xml +++ b/doc/en/autogen/infolists.xml @@ -106,6 +106,11 @@ hotlist list of buffers in hotlist + + weechat + key + list of key bindings + weechat nicklist diff --git a/doc/fr/autogen/infolists.xml b/doc/fr/autogen/infolists.xml index 9236919e5..389d25e69 100644 --- a/doc/fr/autogen/infolists.xml +++ b/doc/fr/autogen/infolists.xml @@ -106,6 +106,11 @@ hotlist liste des tampons dans la hotlist + + weechat + key + liste des associations de touches + weechat nicklist diff --git a/po/cs.po b/po/cs.po index 933ebb615..06276bbd1 100644 --- a/po/cs.po +++ b/po/cs.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2009-05-12 17:51+0200\n" +"POT-Creation-Date: 2009-05-16 00:36+0200\n" "PO-Revision-Date: 2009-05-11 13:02+0200\n" "Last-Translator: Jiri Golembiovsky \n" "Language-Team: weechat-dev \n" @@ -4874,6 +4874,10 @@ msgstr "Seznam pro aliasy:\n" msgid "list of buffers in hotlist" msgstr "zobrazit historii příkazů bufferu" +#, fuzzy +msgid "list of key bindings" +msgstr "Seznam pro aliasy:\n" + #, fuzzy msgid "nicks in nicklist for a buffer" msgstr "nevalidní délka pro buffer" diff --git a/po/de.po b/po/de.po index da2abf6a1..09ec116df 100644 --- a/po/de.po +++ b/po/de.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2009-05-12 17:51+0200\n" +"POT-Creation-Date: 2009-05-16 00:36+0200\n" "PO-Revision-Date: 2009-05-11 13:02+0200\n" "Last-Translator: Thomas Schuetz \n" "Language-Team: weechat-dev \n" @@ -4824,6 +4824,10 @@ msgstr "Liste der Aliases:\n" msgid "list of buffers in hotlist" msgstr "Maximale Länge der Namen in der Hotlist" +#, fuzzy +msgid "list of key bindings" +msgstr "Liste der /ignore-Regeln:\n" + #, fuzzy msgid "nicks in nicklist for a buffer" msgstr "Fehlerhafte Pufferlänge" diff --git a/po/es.po b/po/es.po index f040316bb..368097185 100644 --- a/po/es.po +++ b/po/es.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2009-05-12 17:51+0200\n" +"POT-Creation-Date: 2009-05-16 00:36+0200\n" "PO-Revision-Date: 2009-05-11 13:02+0200\n" "Last-Translator: Roberto González Cardenete \n" "Language-Team: weechat-dev \n" @@ -4812,6 +4812,10 @@ msgstr "Lista de alias:\n" msgid "list of buffers in hotlist" msgstr "longitud máxima de nombres en la hotlist" +#, fuzzy +msgid "list of key bindings" +msgstr "Lista de ignores:\n" + #, fuzzy msgid "nicks in nicklist for a buffer" msgstr "longitud inválida para un búfer" diff --git a/po/fr.po b/po/fr.po index 1b2c0f077..6cbf011ad 100644 --- a/po/fr.po +++ b/po/fr.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2009-05-12 17:51+0200\n" -"PO-Revision-Date: 2009-05-12 17:51+0200\n" +"POT-Creation-Date: 2009-05-16 00:36+0200\n" +"PO-Revision-Date: 2009-05-16 00:36+0200\n" "Last-Translator: FlashCode \n" "Language-Team: weechat-dev \n" "MIME-Version: 1.0\n" @@ -5007,6 +5007,9 @@ msgstr "liste des hooks" msgid "list of buffers in hotlist" msgstr "liste des tampons dans la hotlist" +msgid "list of key bindings" +msgstr "liste des associations de touches" + msgid "nicks in nicklist for a buffer" msgstr "pseudos dans la liste des pseudos pour un tampon" diff --git a/po/hu.po b/po/hu.po index 4fa2de432..8528351b3 100644 --- a/po/hu.po +++ b/po/hu.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2009-05-12 17:51+0200\n" +"POT-Creation-Date: 2009-05-16 00:36+0200\n" "PO-Revision-Date: 2009-05-11 13:02+0200\n" "Last-Translator: Andras Voroskoi \n" "Language-Team: weechat-dev \n" @@ -4882,6 +4882,10 @@ msgstr "Aliaszok listája:\n" msgid "list of buffers in hotlist" msgstr "kiemelendő szavak listája" +#, fuzzy +msgid "list of key bindings" +msgstr "Mellőzések listája:\n" + #, fuzzy msgid "nicks in nicklist for a buffer" msgstr "érvénytelen pufferhossz" diff --git a/po/pl.po b/po/pl.po index 770a85342..b39fc80c8 100644 --- a/po/pl.po +++ b/po/pl.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2009-05-12 17:51+0200\n" +"POT-Creation-Date: 2009-05-16 00:36+0200\n" "PO-Revision-Date: 2009-05-11 13:02+0200\n" "Last-Translator: \n" "Language-Team: Polish\n" @@ -4210,6 +4210,10 @@ msgstr "" msgid "list of buffers in hotlist" msgstr "" +#, fuzzy +msgid "list of key bindings" +msgstr "Nie przypisano klawiszy" + msgid "nicks in nicklist for a buffer" msgstr "" diff --git a/po/ru.po b/po/ru.po index aa9845b4b..6d43340ee 100644 --- a/po/ru.po +++ b/po/ru.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2009-05-12 17:51+0200\n" +"POT-Creation-Date: 2009-05-16 00:36+0200\n" "PO-Revision-Date: 2009-05-11 13:02+0200\n" "Last-Translator: Pavel Shevchuk \n" "Language-Team: weechat-dev \n" @@ -4858,6 +4858,10 @@ msgstr "Список сокращений:\n" msgid "list of buffers in hotlist" msgstr "максимальная длина имён в хотлисте" +#, fuzzy +msgid "list of key bindings" +msgstr "Список игнорирования:\n" + #, fuzzy msgid "nicks in nicklist for a buffer" msgstr "некорректная длина буфера" diff --git a/po/weechat.pot b/po/weechat.pot index 36ad66441..8638fdeca 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2009-05-12 17:51+0200\n" +"POT-Creation-Date: 2009-05-16 00:36+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -4173,6 +4173,9 @@ msgstr "" msgid "list of buffers in hotlist" msgstr "" +msgid "list of key bindings" +msgstr "" + msgid "nicks in nicklist for a buffer" msgstr "" diff --git a/src/gui/gui-keyboard.c b/src/gui/gui-keyboard.c index a8c9bbd29..27d60105c 100644 --- a/src/gui/gui-keyboard.c +++ b/src/gui/gui-keyboard.c @@ -28,6 +28,7 @@ #include #include "../core/weechat.h" +#include "../core/wee-infolist.h" #include "../core/wee-input.h" #include "../core/wee-log.h" #include "../core/wee-string.h" @@ -701,6 +702,40 @@ gui_keyboard_end () gui_keyboard_free_all (&gui_keys, &last_gui_key); } +/* + * gui_keyboard_add_to_infolist: add a key in an infolist + * return 1 if ok, 0 if error + */ + +int +gui_keyboard_add_to_infolist (struct t_infolist *infolist, + struct t_gui_key *key) +{ + struct t_infolist_item *ptr_item; + char *expanded_key; + + if (!infolist || !key) + return 0; + + ptr_item = infolist_new_item (infolist); + if (!ptr_item) + return 0; + + if (!infolist_new_var_string (ptr_item, "key_internal", key->key)) + return 0; + expanded_key = gui_keyboard_get_expanded_name (key->key); + if (expanded_key) + { + if (!infolist_new_var_string (ptr_item, "key", expanded_key)) + return 0; + free (expanded_key); + } + if (!infolist_new_var_string (ptr_item, "command", key->command)) + return 0; + + return 1; +} + /* * gui_keyboard_print_log: print key infos in log (usually for crash dump) */ diff --git a/src/gui/gui-keyboard.h b/src/gui/gui-keyboard.h index 5aea4b427..73dda8d00 100644 --- a/src/gui/gui-keyboard.h +++ b/src/gui/gui-keyboard.h @@ -74,6 +74,8 @@ extern int gui_keyboard_get_paste_lines (); extern void gui_keyboard_paste_accept (); extern void gui_keyboard_paste_cancel (); extern void gui_keyboard_end (); +extern int gui_keyboard_add_to_infolist (struct t_infolist *infolist, + struct t_gui_key *key); extern void gui_keyboard_print_log (struct t_gui_buffer *buffer); /* keyboard functions (GUI dependent) */ diff --git a/src/plugins/plugin-api.c b/src/plugins/plugin-api.c index fb4483b26..a9028e356 100644 --- a/src/plugins/plugin-api.c +++ b/src/plugins/plugin-api.c @@ -316,6 +316,7 @@ plugin_api_infolist_get_internal (void *data, const char *infolist_name, struct t_gui_filter *ptr_filter; struct t_gui_window *ptr_window; struct t_gui_hotlist *ptr_hotlist; + struct t_gui_key *ptr_key; struct t_weechat_plugin *ptr_plugin; char buffer_full_name[1024]; @@ -574,6 +575,22 @@ plugin_api_infolist_get_internal (void *data, const char *infolist_name, return ptr_infolist; } } + else if (string_strcasecmp (infolist_name, "key") == 0) + { + ptr_infolist = infolist_new (); + if (ptr_infolist) + { + for (ptr_key = gui_keys; ptr_key; ptr_key = ptr_key->next_key) + { + if (!gui_keyboard_add_to_infolist (ptr_infolist, ptr_key)) + { + infolist_free (ptr_infolist); + return NULL; + } + } + return ptr_infolist; + } + } else if (string_strcasecmp (infolist_name, "nicklist") == 0) { /* invalid buffer pointer ? */ @@ -883,6 +900,8 @@ plugin_api_init () &plugin_api_infolist_get_internal, NULL); hook_infolist (NULL, "hotlist", N_("list of buffers in hotlist"), &plugin_api_infolist_get_internal, NULL); + hook_infolist (NULL, "key", N_("list of key bindings"), + &plugin_api_infolist_get_internal, NULL); hook_infolist (NULL, "nicklist", N_("nicks in nicklist for a buffer"), &plugin_api_infolist_get_internal, NULL); hook_infolist (NULL, "option", N_("list of options"),