From cda63f03d417e906f369efe4c966265db2fa5159 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Thu, 15 Nov 2001 18:57:31 +0000 Subject: [PATCH] When overriding default statusbars, don't forget the type/placement/position/visible settings if they're not specified in new statusbar config. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2022 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/fe-text/statusbar-config.c | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/src/fe-text/statusbar-config.c b/src/fe-text/statusbar-config.c index 390ce193..f9ea05f2 100644 --- a/src/fe-text/statusbar-config.c +++ b/src/fe-text/statusbar-config.c @@ -141,16 +141,13 @@ static void statusbar_read(STATUSBAR_GROUP_REC *group, CONFIG_NODE *node) { STATUSBAR_CONFIG_REC *bar; GSList *tmp; - int type, placement, position, visible; + int visible; const char *visible_str; bar = statusbar_config_find(group, node->key); + visible = bar == NULL ? STATUSBAR_VISIBLE_ALWAYS : bar->visible; - type = STATUSBAR_TYPE_ROOT; - placement = STATUSBAR_BOTTOM; - position = 0; - visible = STATUSBAR_VISIBLE_ALWAYS; - + /* first make sure we want to see this statusbar */ visible_str = config_node_get_str(node, "visible", ""); if (strcmp(visible_str, "active") == 0) visible = STATUSBAR_VISIBLE_ACTIVE; @@ -164,20 +161,20 @@ static void statusbar_read(STATUSBAR_GROUP_REC *group, CONFIG_NODE *node) return; } - if (strcmp(config_node_get_str(node, "type", ""), "window") == 0) - type = STATUSBAR_TYPE_WINDOW; - if (strcmp(config_node_get_str(node, "placement", ""), "top") == 0) - placement = STATUSBAR_TOP; - position = config_node_get_int(node, "position", 0); - - if (bar == NULL) + if (bar == NULL) { bar = statusbar_config_create(group, node->key); - - bar->type = type; - bar->placement = placement; - bar->position = position; + bar->type = STATUSBAR_TYPE_ROOT; + bar->placement = STATUSBAR_BOTTOM; + bar->position = 0; + } bar->visible = visible; + if (strcmp(config_node_get_str(node, "type", ""), "window") == 0) + bar->type = STATUSBAR_TYPE_WINDOW; + if (strcmp(config_node_get_str(node, "placement", ""), "top") == 0) + bar->placement = STATUSBAR_TOP; + bar->position = config_node_get_int(node, "position", 0); + node = config_node_section(node, "items", -1); if (node != NULL) { /* we're overriding the items - destroy the old */