diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2011-07-05 15:36:42 +0200 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2011-07-05 15:36:42 +0200 |
commit | 3bea55b2f0759541b0d8930396eb4fc1f7d62ecc (patch) | |
tree | 08d5886e45a114e02e7a8aa9b30708466d102970 /src/plugins/plugin-api.c | |
parent | 5250b68d0a1d9871b9d89ff1253290372a747cf6 (diff) | |
download | weechat-3bea55b2f0759541b0d8930396eb4fc1f7d62ecc.zip |
core: add context "search" for keys (to define keys used during search in buffer with ctrl+"r")
Diffstat (limited to 'src/plugins/plugin-api.c')
-rw-r--r-- | src/plugins/plugin-api.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/plugins/plugin-api.c b/src/plugins/plugin-api.c index c2ebab2e4..e5b85558a 100644 --- a/src/plugins/plugin-api.c +++ b/src/plugins/plugin-api.c @@ -53,7 +53,7 @@ #include "../gui/gui-filter.h" #include "../gui/gui-history.h" #include "../gui/gui-hotlist.h" -#include "../gui/gui-keyboard.h" +#include "../gui/gui-key.h" #include "../gui/gui-line.h" #include "../gui/gui-nicklist.h" #include "../gui/gui-window.h" @@ -353,10 +353,10 @@ plugin_api_info_get_internal (void *data, const char *info_name, } else if (string_strcasecmp (info_name, "inactivity") == 0) { - if (gui_keyboard_last_activity_time == 0) + if (gui_key_last_activity_time == 0) inactivity = 0; else - inactivity = time (NULL) - gui_keyboard_last_activity_time; + inactivity = time (NULL) - gui_key_last_activity_time; snprintf (value, sizeof (value), "%ld", (long int)inactivity); return value; } @@ -394,6 +394,7 @@ plugin_api_infolist_get_internal (void *data, const char *infolist_name, struct t_gui_key *ptr_key; struct t_weechat_plugin *ptr_plugin; char buffer_full_name[1024]; + int context; /* make C compiler happy */ (void) data; @@ -678,12 +679,17 @@ plugin_api_infolist_get_internal (void *data, const char *infolist_name, ptr_infolist = infolist_new (); if (ptr_infolist) { - for (ptr_key = gui_keys; ptr_key; ptr_key = ptr_key->next_key) + context = gui_key_search_context (arguments); + if (context >= 0) { - if (!gui_keyboard_add_to_infolist (ptr_infolist, ptr_key)) + for (ptr_key = gui_keys[context]; ptr_key; + ptr_key = ptr_key->next_key) { - infolist_free (ptr_infolist); - return NULL; + if (!gui_key_add_to_infolist (ptr_infolist, ptr_key)) + { + infolist_free (ptr_infolist); + return NULL; + } } } return ptr_infolist; @@ -1074,7 +1080,7 @@ plugin_api_init () hook_hdata (NULL, "input_undo", N_("structure with undo for input line"), &gui_buffer_hdata_input_undo_cb, NULL); hook_hdata (NULL, "key", N_("a key (keyboard shortcut)"), - &gui_keyboard_hdata_key_cb, NULL); + &gui_key_hdata_key_cb, NULL); hook_hdata (NULL, "lines", N_("structure with lines"), &gui_line_hdata_lines_cb, NULL); hook_hdata (NULL, "line", N_("structure with one line"), |