summaryrefslogtreecommitdiff
path: root/src/gui/gui-bar.c
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2011-06-13 12:32:27 +0200
committerSebastien Helleu <flashcode@flashtux.org>2011-06-13 12:32:27 +0200
commitc8b2a6a08485abfe6a8fb849b68ec574af8879e5 (patch)
treee7b5202773f259439d7f1cac1239ea464769768b /src/gui/gui-bar.c
parent756252b95cb1b1988891c7a7525378c8feaa5f8e (diff)
downloadweechat-c8b2a6a08485abfe6a8fb849b68ec574af8879e5.zip
core: add "hdata" (direct access to WeeChat/plugin data)
Diffstat (limited to 'src/gui/gui-bar.c')
-rw-r--r--src/gui/gui-bar.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/gui/gui-bar.c b/src/gui/gui-bar.c
index b28b8bd3b..49d0dc3d0 100644
--- a/src/gui/gui-bar.c
+++ b/src/gui/gui-bar.c
@@ -26,11 +26,13 @@
#endif
#include <stdlib.h>
+#include <stddef.h>
#include <string.h>
#include <limits.h>
#include "../core/weechat.h"
#include "../core/wee-config.h"
+#include "../core/wee-hdata.h"
#include "../core/wee-hook.h"
#include "../core/wee-infolist.h"
#include "../core/wee-log.h"
@@ -66,6 +68,8 @@ struct t_gui_bar *last_gui_bar = NULL; /* last bar */
struct t_gui_bar *gui_temp_bars = NULL; /* bars used when reading config */
struct t_gui_bar *last_gui_temp_bar = NULL;
+struct t_hdata *gui_bar_hdata_bar = NULL;
+
void gui_bar_free_bar_windows (struct t_gui_bar *bar);
@@ -2143,6 +2147,42 @@ gui_bar_free_bar_windows (struct t_gui_bar *bar)
}
/*
+ * gui_bar_hdata_bar_cb: return hdata for bar
+ */
+
+struct t_hdata *
+gui_bar_hdata_bar_cb (void *data, const char *hdata_name)
+{
+ struct t_hdata *hdata;
+
+ /* make C compiler happy */
+ (void) data;
+
+ if (gui_bar_hdata_bar)
+ return gui_bar_hdata_bar;
+
+ hdata = hdata_new (hdata_name, "prev_bar", "next_bar");
+ if (hdata)
+ {
+ gui_bar_hdata_bar = hdata;
+ HDATA_VAR(struct t_gui_bar, name, STRING);
+ HDATA_VAR(struct t_gui_bar, options, POINTER);
+ HDATA_VAR(struct t_gui_bar, conditions_count, INTEGER);
+ HDATA_VAR(struct t_gui_bar, conditions_array, POINTER);
+ HDATA_VAR(struct t_gui_bar, items_count, INTEGER);
+ HDATA_VAR(struct t_gui_bar, items_subcount, POINTER);
+ HDATA_VAR(struct t_gui_bar, items_array, POINTER);
+ HDATA_VAR(struct t_gui_bar, bar_window, POINTER);
+ HDATA_VAR(struct t_gui_bar, bar_refresh_needed, INTEGER);
+ HDATA_VAR(struct t_gui_bar, prev_bar, POINTER);
+ HDATA_VAR(struct t_gui_bar, next_bar, POINTER);
+ HDATA_LIST(gui_bars);
+ HDATA_LIST(last_gui_bar);
+ }
+ return gui_bar_hdata_bar;
+}
+
+/*
* gui_bar_add_to_infolist: add a bar in an infolist
* return 1 if ok, 0 if error
*/