summaryrefslogtreecommitdiff
path: root/src/fe-text/statusbar.c
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2001-11-18 18:06:51 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2001-11-18 18:06:51 +0000
commit11b175d7028e49fa2b7f6611226d5584fcf28977 (patch)
tree021e7a8834c3db06730d8311b43ed080a6bed65f /src/fe-text/statusbar.c
parent1fdd933d25c70ffcb808d050b93b1eb1f29e53d0 (diff)
downloadirssi-11b175d7028e49fa2b7f6611226d5584fcf28977.zip
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
Diffstat (limited to 'src/fe-text/statusbar.c')
-rw-r--r--src/fe-text/statusbar.c12
1 files changed, 12 insertions, 0 deletions
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,