From 2711bc4afed3e6a81c961e8898149bc2d7309452 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Fri, 18 Mar 2011 15:35:54 +0100 Subject: Create default bars only if no bar is defined in configuration file --- ChangeLog | 1 + src/core/wee-config.c | 51 ++++++++++++++++++++++++++++++++++----------------- 2 files changed, 35 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index dd994bfc1..f81e3558a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,7 @@ v0.3.5-dev, 2011-03-18 Version 0.3.5 (under dev!) -------------------------- +* core: create default bars only if no bar is defined in configuration file * core: add new option weechat.look.highlight_tags (force highlight on tags) * core: fix bug with repeat of last completion ("%*"), which failed when many templates are used in completion diff --git a/src/core/wee-config.c b/src/core/wee-config.c index 91a4f1b8c..61324018f 100644 --- a/src/core/wee-config.c +++ b/src/core/wee-config.c @@ -526,6 +526,38 @@ config_day_change_timer_cb (void *data, int remaining_calls) return WEECHAT_RC_OK; } +/* + * config_weechat_init_after_read: initialize some things after reading (or + * reloading) configuration file + */ + +void +config_weechat_init_after_read () +{ + gui_buffer_notify_set_all (); + + proxy_use_temp_proxies (); + + gui_bar_use_temp_bars (); + if (gui_bars) + { + /* + * at least one bar defined => just ensure that at least one bar is + * using item "input_text" + */ + gui_bar_create_default_input (); + } + else + { + /* no bar defined => create default bars */ + gui_bar_create_default (); + } + + /* if no key was found config file, then we use default bindings */ + if (!gui_keys) + gui_keyboard_default_bindings (); +} + /* * config_weechat_reload_cb: reload WeeChat configuration file * return one of these values: @@ -564,15 +596,7 @@ config_weechat_reload_cb (void *data, struct t_config_file *config_file) rc = config_file_reload (config_file); if (rc == WEECHAT_CONFIG_READ_OK) - { - gui_buffer_notify_set_all (); - proxy_use_temp_proxies (); - gui_bar_use_temp_bars (); - gui_bar_create_default (); - /* if no key was found config file, then we use default bindings */ - if (!gui_keys) - gui_keyboard_default_bindings (); - } + config_weechat_init_after_read (); return rc; } @@ -2428,14 +2452,7 @@ config_weechat_read () rc = config_file_read (weechat_config_file); if (rc == WEECHAT_CONFIG_READ_OK) - { - proxy_use_temp_proxies (); - gui_bar_use_temp_bars (); - gui_bar_create_default (); - /* if no key was found config file, then we use default bindings */ - if (!gui_keys) - gui_keyboard_default_bindings (); - } + config_weechat_init_after_read (); if (rc != WEECHAT_CONFIG_READ_OK) { -- cgit v1.2.3