1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-30 14:56:39 +02:00

core: add hdata "hotlist"

This commit is contained in:
Sebastien Helleu
2012-07-21 17:32:41 +02:00
parent 7a3e8cf198
commit f426446521
19 changed files with 124 additions and 12 deletions
+29
View File
@@ -32,6 +32,7 @@
#include "../core/weechat.h"
#include "../core/wee-config.h"
#include "../core/wee-hashtable.h"
#include "../core/wee-hdata.h"
#include "../core/wee-hook.h"
#include "../core/wee-infolist.h"
#include "../core/wee-log.h"
@@ -460,6 +461,34 @@ gui_hotlist_remove_buffer (struct t_gui_buffer *buffer)
gui_hotlist_changed_signal ();
}
/*
* gui_hotlist_hdata_hotlist_cb: return hdata for hotlist
*/
struct t_hdata *
gui_hotlist_hdata_hotlist_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) data;
hdata = hdata_new (NULL, hdata_name, "prev_hotlist", "next_hotlist");
if (hdata)
{
HDATA_VAR(struct t_gui_hotlist, priority, INTEGER, NULL, NULL);
HDATA_VAR(struct t_gui_hotlist, creation_time.tv_sec, TIME, NULL, NULL);
HDATA_VAR(struct t_gui_hotlist, creation_time.tv_usec, LONG, NULL, NULL);
HDATA_VAR(struct t_gui_hotlist, buffer, POINTER, NULL, NULL);
HDATA_VAR(struct t_gui_hotlist, count, INTEGER, GUI_HOTLIST_NUM_PRIORITIES_STR, NULL);
HDATA_VAR(struct t_gui_hotlist, prev_hotlist, POINTER, NULL, hdata_name);
HDATA_VAR(struct t_gui_hotlist, next_hotlist, POINTER, NULL, hdata_name);
HDATA_LIST(gui_hotlist);
HDATA_LIST(last_gui_hotlist);
}
return hdata;
}
/*
* gui_hotlist_add_to_infolist: add a hotlist in an infolist
* return 1 if ok, 0 if error
+3
View File
@@ -29,6 +29,7 @@ enum t_gui_hotlist_priority
/* number of priorities */
GUI_HOTLIST_NUM_PRIORITIES,
};
#define GUI_HOTLIST_NUM_PRIORITIES_STR "4"
#define GUI_HOTLIST_MIN 0
#define GUI_HOTLIST_MAX (GUI_HOTLIST_NUM_PRIORITIES - 1)
@@ -59,6 +60,8 @@ extern struct t_gui_hotlist *gui_hotlist_add (struct t_gui_buffer *buffer,
extern void gui_hotlist_resort ();
extern void gui_hotlist_clear ();
extern void gui_hotlist_remove_buffer (struct t_gui_buffer *buffer);
extern struct t_hdata *gui_hotlist_hdata_hotlist_cb (void *data,
const char *hdata_name);
extern int gui_hotlist_add_to_infolist (struct t_infolist *infolist,
struct t_gui_hotlist *hotlist);
extern void gui_hotlist_print_log ();
+2
View File
@@ -1129,6 +1129,8 @@ plugin_api_init ()
&gui_filter_hdata_filter_cb, NULL);
hook_hdata (NULL, "history", N_("history of commands in buffer"),
&gui_history_hdata_history_cb, NULL);
hook_hdata (NULL, "hotlist", N_("hotlist"),
&gui_hotlist_hdata_hotlist_cb, NULL);
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)"),