From 11b175d7028e49fa2b7f6611226d5584fcf28977 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Sun, 18 Nov 2001 18:06:51 +0000 Subject: [PATCH] After calls to statusbar_item_register() and statusbar_item_unregister(), the statusbars should be redrawn. This also fixes the crash at quit when using statusbar perl scripts. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2058 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/fe-text/statusbar.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/fe-text/statusbar.c b/src/fe-text/statusbar.c index 578054cc..ec621064 100644 --- a/src/fe-text/statusbar.c +++ b/src/fe-text/statusbar.c @@ -46,12 +46,14 @@ STATUSBAR_GROUP_REC *active_statusbar_group; static GHashTable *sbar_item_defs, *sbar_item_funcs; static GHashTable *sbar_signal_items, *sbar_item_signals; static GHashTable *named_sbar_items; +static int statusbar_need_recreate_items; void statusbar_item_register(const char *name, const char *value, STATUSBAR_FUNC func) { gpointer hkey, hvalue; + statusbar_need_recreate_items = TRUE; if (value != NULL) { if (g_hash_table_lookup_extended(sbar_item_defs, name, &hkey, &hvalue)) { @@ -75,6 +77,7 @@ void statusbar_item_unregister(const char *name) { gpointer key, value; + statusbar_need_recreate_items = TRUE; if (g_hash_table_lookup_extended(sbar_item_defs, name, &key, &value)) { g_hash_table_remove(sbar_item_defs, key); @@ -300,6 +303,9 @@ static void statusbar_calc_item_positions(STATUSBAR_REC *bar) void statusbar_redraw(STATUSBAR_REC *bar, int force) { + if (statusbar_need_recreate_items) + return; /* don't bother yet */ + if (bar != NULL) { if (force) { irssi_set_dirty(); @@ -949,6 +955,11 @@ void statusbar_redraw_dirty(void) { GSList *tmp; + if (statusbar_recreate_items) { + statusbar_need_recreate_items = FALSE; + statusbars_recreate_items(); + } + for (tmp = active_statusbar_group->bars; tmp != NULL; tmp = tmp->next) { STATUSBAR_REC *rec = tmp->data; @@ -1051,6 +1062,7 @@ static void sig_setup_reload(void) void statusbar_init(void) { + statusbar_need_recreate_items = FALSE; statusbar_groups = NULL; active_statusbar_group = NULL; sbar_item_defs = g_hash_table_new((GHashFunc) g_str_hash,