mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-08 20:41:59 +03:00
Ticket #2541: MC saves configuration many times.
The problem: when mc quits with auto-save setup, the main confguration file is written 4 times. The solution: don't write ini when some part of setup is saved. Write ini only after save whole confguration. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
417d5504c1
commit
4e232774b2
@ -1571,6 +1571,9 @@ save_setup_cmd (void)
|
||||
if (save_setup (TRUE, TRUE))
|
||||
message (D_NORMAL, _("Setup"), _("Setup saved to %s%s%s"),
|
||||
mc_config_get_path (), PATH_SEP_STR, MC_CONFIG_FILE);
|
||||
else
|
||||
message (D_ERROR, _("Setup"), _("Unable to save setup to %s%s%s"),
|
||||
mc_config_get_path (), PATH_SEP_STR, MC_CONFIG_FILE);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
@ -515,7 +515,6 @@ save_panelize (void)
|
||||
mc_config_set_string (mc_main_config,
|
||||
panelize_section, current->label, current->command);
|
||||
}
|
||||
mc_config_save_file (mc_main_config, NULL);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
14
src/setup.c
14
src/setup.c
@ -1008,7 +1008,6 @@ save_setup (gboolean save_options, gboolean save_panel_options)
|
||||
|
||||
tmp_profile = g_build_filename (mc_config_get_path (), MC_CONFIG_FILE, NULL);
|
||||
ret = mc_config_save_to_file (mc_main_config, tmp_profile, NULL);
|
||||
|
||||
g_free (tmp_profile);
|
||||
}
|
||||
|
||||
@ -1056,12 +1055,8 @@ done_setup (void)
|
||||
void
|
||||
save_config (void)
|
||||
{
|
||||
char *profile;
|
||||
GError *error = NULL;
|
||||
size_t i;
|
||||
|
||||
profile = g_build_filename (mc_config_get_path (), MC_CONFIG_FILE, NULL);
|
||||
|
||||
/* Save integer options */
|
||||
for (i = 0; int_options[i].opt_name != NULL; i++)
|
||||
mc_config_set_int (mc_main_config, CONFIG_APP_SECTION, int_options[i].opt_name,
|
||||
@ -1071,11 +1066,6 @@ save_config (void)
|
||||
for (i = 0; str_options[i].opt_name != NULL; i++)
|
||||
mc_config_set_string (mc_main_config, CONFIG_APP_SECTION, str_options[i].opt_name,
|
||||
*str_options[i].opt_addr);
|
||||
|
||||
if (!mc_config_save_to_file (mc_main_config, profile, &error))
|
||||
setup_save_config_show_error (profile, &error);
|
||||
|
||||
g_free (profile);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
@ -1096,15 +1086,11 @@ setup_save_config_show_error (const char *filename, GError ** error)
|
||||
void
|
||||
save_layout (void)
|
||||
{
|
||||
char *profile;
|
||||
size_t i;
|
||||
|
||||
profile = g_build_filename (mc_config_get_path (), MC_CONFIG_FILE, NULL);
|
||||
/* Save integer options */
|
||||
for (i = 0; layout[i].opt_name != NULL; i++)
|
||||
mc_config_set_int (mc_main_config, "Layout", layout[i].opt_name, *layout[i].opt_addr);
|
||||
mc_config_save_to_file (mc_main_config, profile, NULL);
|
||||
g_free (profile);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
Loading…
Reference in New Issue
Block a user