1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-29 22:36:38 +02:00

core: add infolist "layout" and hdata "layout", "layout_buffer" and "layout_window" (thanks to Nils Görs)

This commit is contained in:
Sebastien Helleu
2013-05-14 21:11:58 +02:00
parent 0c66b91007
commit c7e8e6856d
4 changed files with 156 additions and 1 deletions
+29
View File
@@ -56,6 +56,7 @@
#include "../gui/gui-history.h"
#include "../gui/gui-hotlist.h"
#include "../gui/gui-key.h"
#include "../gui/gui-layout.h"
#include "../gui/gui-line.h"
#include "../gui/gui-nicklist.h"
#include "../gui/gui-window.h"
@@ -412,6 +413,7 @@ plugin_api_infolist_get_internal (void *data, const char *infolist_name,
struct t_gui_hotlist *ptr_hotlist;
struct t_gui_key *ptr_key;
struct t_weechat_plugin *ptr_plugin;
struct t_gui_layout *ptr_layout;
int context, number, i;
char *error;
@@ -713,6 +715,23 @@ plugin_api_infolist_get_internal (void *data, const char *infolist_name,
return ptr_infolist;
}
}
else if (string_strcasecmp (infolist_name, "layout") == 0)
{
ptr_infolist = infolist_new ();
if (ptr_infolist)
{
for (ptr_layout = gui_layouts; ptr_layout;
ptr_layout = ptr_layout->next_layout)
{
if (!gui_layout_add_to_infolist (ptr_infolist,ptr_layout))
{
infolist_free (ptr_infolist);
return NULL;
}
}
return ptr_infolist;
}
}
else if (string_strcasecmp (infolist_name, "nicklist") == 0)
{
/* invalid buffer pointer ? */
@@ -1108,6 +1127,10 @@ plugin_api_init ()
N_("context (\"default\", \"search\", \"cursor\" or "
"\"mouse\") (optional)"),
&plugin_api_infolist_get_internal, NULL);
hook_infolist (NULL, "layout", N_("list of layouts"),
NULL,
NULL,
&plugin_api_infolist_get_internal, NULL);
hook_infolist (NULL, "nicklist", N_("nicks in nicklist for a buffer"),
N_("buffer pointer"),
N_("nick_xxx or group_xxx to get only nick/group xxx "
@@ -1159,6 +1182,12 @@ plugin_api_init ()
&gui_buffer_hdata_input_undo_cb, NULL);
hook_hdata (NULL, "key", N_("a key (keyboard shortcut)"),
&gui_key_hdata_key_cb, NULL);
hook_hdata (NULL, "layout", N_("layout"),
&gui_layout_hdata_layout_cb, NULL);
hook_hdata (NULL, "layout_buffer", N_("buffer layout"),
&gui_layout_hdata_layout_buffer_cb, NULL);
hook_hdata (NULL, "layout_window", N_("window layout"),
&gui_layout_hdata_layout_window_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"),