diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2011-06-26 18:15:42 +0200 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2011-06-26 18:15:42 +0200 |
commit | 19bc95b96189de5a645adbe7b3487d5de1b835e7 (patch) | |
tree | b68d3d98d3d643bc02fba218db7f7ed6cd07ea2c /src/gui/gui-bar.c | |
parent | 2a630031fd3c868733e3038c3e19ad4b53a8d8ce (diff) | |
download | weechat-19bc95b96189de5a645adbe7b3487d5de1b835e7.zip |
core: many improvements on hdata
New features:
- add optional hdata name for variables in hdata
- add plugin API functions: hdata_get_var_hdata
- use hashtable to store hdata (created by WeeChat and plugins)
- free hdata and infolists created by plugin on plugin unload
- free all hdata on exit
- add "free" option to command /debug hdata
- remove hdata for hooks
Diffstat (limited to 'src/gui/gui-bar.c')
-rw-r--r-- | src/gui/gui-bar.c | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/src/gui/gui-bar.c b/src/gui/gui-bar.c index 49d0dc3d0..381f4fdcb 100644 --- a/src/gui/gui-bar.c +++ b/src/gui/gui-bar.c @@ -68,8 +68,6 @@ 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); @@ -2158,28 +2156,24 @@ gui_bar_hdata_bar_cb (void *data, const char *hdata_name) /* 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"); + hdata = hdata_new (NULL, 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_VAR(struct t_gui_bar, name, STRING, NULL); + HDATA_VAR(struct t_gui_bar, options, POINTER, NULL); + HDATA_VAR(struct t_gui_bar, conditions_count, INTEGER, NULL); + HDATA_VAR(struct t_gui_bar, conditions_array, POINTER, NULL); + HDATA_VAR(struct t_gui_bar, items_count, INTEGER, NULL); + HDATA_VAR(struct t_gui_bar, items_subcount, POINTER, NULL); + HDATA_VAR(struct t_gui_bar, items_array, POINTER, NULL); + HDATA_VAR(struct t_gui_bar, bar_window, POINTER, NULL); + HDATA_VAR(struct t_gui_bar, bar_refresh_needed, INTEGER, NULL); + HDATA_VAR(struct t_gui_bar, prev_bar, POINTER, hdata_name); + HDATA_VAR(struct t_gui_bar, next_bar, POINTER, hdata_name); HDATA_LIST(gui_bars); HDATA_LIST(last_gui_bar); } - return gui_bar_hdata_bar; + return hdata; } /* |