From c8b2a6a08485abfe6a8fb849b68ec574af8879e5 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Mon, 13 Jun 2011 12:32:27 +0200 Subject: core: add "hdata" (direct access to WeeChat/plugin data) --- src/gui/gui-bar.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'src/gui/gui-bar.c') 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 +#include #include #include #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); @@ -2142,6 +2146,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 -- cgit v1.2.3