summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/command.c5
-rw-r--r--src/common/weechat.c3
-rw-r--r--src/common/weeconfig.c23
-rw-r--r--src/common/weeconfig.h2
4 files changed, 29 insertions, 4 deletions
diff --git a/src/common/command.c b/src/common/command.c
index edb57abe2..d8d5909a7 100644
--- a/src/common/command.c
+++ b/src/common/command.c
@@ -3458,7 +3458,6 @@ weechat_cmd_set (t_irc_server *server, t_irc_channel *channel,
{
if (config_option_set_value (ptr_option, value) == 0)
{
- (void) (ptr_option->handler_change());
gui_printf (NULL, "\n");
gui_printf (NULL, "%s[%s%s%s]\n",
GUI_COLOR(COLOR_WIN_CHAT_DARK),
@@ -3466,6 +3465,7 @@ weechat_cmd_set (t_irc_server *server, t_irc_channel *channel,
config_get_section (ptr_option),
GUI_COLOR(COLOR_WIN_CHAT_DARK));
weechat_cmd_set_display_option (ptr_option, NULL, NULL);
+ (void) (ptr_option->handler_change());
}
else
{
@@ -3982,7 +3982,8 @@ weechat_cmd_upgrade (t_irc_server *server, t_irc_channel *channel,
#ifdef PLUGINS
plugin_end ();
#endif
- (void) config_write (NULL);
+ if (cfg_look_save_on_exit)
+ (void) config_write (NULL);
gui_main_end ();
fifo_remove ();
weechat_log_close ();
diff --git a/src/common/weechat.c b/src/common/weechat.c
index 2062316d4..646276ba1 100644
--- a/src/common/weechat.c
+++ b/src/common/weechat.c
@@ -1102,7 +1102,8 @@ main (int argc, char *argv[])
plugin_end (); /* end plugin interface(s) */
#endif
server_disconnect_all (); /* disconnect from all servers */
- (void) config_write (NULL); /* save config file */
+ if (cfg_look_save_on_exit)
+ (void) config_write (NULL); /* save config file */
command_index_free (); /* free commands index */
dcc_end (); /* remove all DCC */
server_free_all (); /* free all servers */
diff --git a/src/common/weeconfig.c b/src/common/weeconfig.c
index 20d5604b2..2150a3814 100644
--- a/src/common/weeconfig.c
+++ b/src/common/weeconfig.c
@@ -64,6 +64,7 @@ t_config_section config_sections[CONFIG_NUMBER_SECTIONS] =
/* config, look & feel section */
+int cfg_look_save_on_exit;
int cfg_look_set_title;
int cfg_look_startup_logo;
int cfg_look_startup_version;
@@ -111,7 +112,11 @@ char *cfg_look_read_marker;
char *cfg_look_input_format;
t_config_option weechat_options_look[] =
-{ { "look_set_title", N_("set title for window (terminal for Curses GUI) with name and version"),
+{ { "look_save_on_exit", N_("save config file on exit"),
+ N_("save config file on exit"),
+ OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
+ NULL, NULL, &cfg_look_save_on_exit, NULL, config_change_save_on_exit },
+ { "look_set_title", N_("set title for window (terminal for Curses GUI) with name and version"),
N_("set title for window (terminal for Curses GUI) with name and version"),
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
NULL, NULL, &cfg_look_set_title, NULL, config_change_title },
@@ -1103,6 +1108,22 @@ config_change_noop ()
}
/*
+ * config_change_save_on_exit: called when "save_on_exit" flag is changed
+ */
+
+void
+config_change_save_on_exit ()
+{
+ if (!cfg_look_save_on_exit)
+ {
+ gui_printf (NULL, "\n");
+ gui_printf (NULL, _("%s you should now issue /save to write "
+ "\"save_on_exit\" option in config file.\n"),
+ WEECHAT_WARNING);
+ }
+}
+
+/*
* config_change_title: called when title is changed
*/
diff --git a/src/common/weeconfig.h b/src/common/weeconfig.h
index 6f7e271cd..998993035 100644
--- a/src/common/weeconfig.h
+++ b/src/common/weeconfig.h
@@ -87,6 +87,7 @@ struct t_config_option
void (*handler_change)();
};
+extern int cfg_look_save_on_exit;
extern int cfg_look_set_title;
extern int cfg_look_startup_logo;
extern int cfg_look_startup_version;
@@ -246,6 +247,7 @@ extern t_config_option * weechat_options [CONFIG_NUMBER_SECTIONS];
extern char *config_get_section ();
extern void config_change_noop ();
+extern void config_change_save_on_exit ();
extern void config_change_title ();
extern void config_change_buffers ();
extern void config_change_buffer_content ();