Added macros for Layout and Misc sections of main config file.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Этот коммит содержится в:
родитель
dea3aa9023
Коммит
67a4c6d521
@ -7,6 +7,8 @@
|
||||
|
||||
#define CONFIG_APP_SECTION "Midnight-Commander"
|
||||
#define CONFIG_PANELS_SECTION "Panels"
|
||||
#define CONFIG_LAYOUT_SECTION "Layout"
|
||||
#define CONFIG_MISC_SECTION "Misc"
|
||||
|
||||
/*** enums ***************************************************************************************/
|
||||
|
||||
|
@ -298,8 +298,8 @@ find_load_options (void)
|
||||
mc_config_get_bool (mc_main_config, "FindFile", "ignore_dirs_enable", TRUE);
|
||||
|
||||
/* Back compatibility: try load old parameter at first */
|
||||
ignore_dirs = mc_config_get_string (mc_main_config, "Misc", "find_ignore_dirs", "");
|
||||
mc_config_del_key (mc_main_config, "Misc", "find_ignore_dirs");
|
||||
ignore_dirs = mc_config_get_string (mc_main_config, CONFIG_MISC_SECTION, "find_ignore_dirs", "");
|
||||
mc_config_del_key (mc_main_config, CONFIG_MISC_SECTION, "find_ignore_dirs");
|
||||
|
||||
/* Then load new parameters */
|
||||
options.ignore_dirs = mc_config_get_string (mc_main_config, "FindFile", "ignore_dirs", "");
|
||||
|
@ -147,7 +147,8 @@ check_codeset (void)
|
||||
if (mc_global.display_codepage == -1)
|
||||
mc_global.display_codepage = 0;
|
||||
|
||||
mc_config_set_string (mc_main_config, "Misc", "display_codepage", cp_display);
|
||||
mc_config_set_string (mc_main_config, CONFIG_MISC_SECTION, "display_codepage",
|
||||
cp_display);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
51
src/setup.c
51
src/setup.c
@ -557,7 +557,7 @@ load_layout (void)
|
||||
|
||||
/* actual options override legacy ones */
|
||||
for (i = 0; layout[i].opt_name != NULL; i++)
|
||||
*layout[i].opt_addr = mc_config_get_int (mc_main_config, "Layout",
|
||||
*layout[i].opt_addr = mc_config_get_int (mc_main_config, CONFIG_LAYOUT_SECTION,
|
||||
layout[i].opt_name, *layout[i].opt_addr);
|
||||
|
||||
/* remove legacy options */
|
||||
@ -940,13 +940,15 @@ load_setup (void)
|
||||
|
||||
/* Load time formats */
|
||||
user_recent_timeformat =
|
||||
mc_config_get_string (mc_main_config, "Misc", "timeformat_recent", FMTTIME);
|
||||
user_old_timeformat = mc_config_get_string (mc_main_config, "Misc", "timeformat_old", FMTYEAR);
|
||||
mc_config_get_string (mc_main_config, CONFIG_MISC_SECTION, "timeformat_recent", FMTTIME);
|
||||
user_old_timeformat =
|
||||
mc_config_get_string (mc_main_config, CONFIG_MISC_SECTION, "timeformat_old", FMTYEAR);
|
||||
|
||||
#ifdef ENABLE_VFS_FTP
|
||||
ftpfs_proxy_host = mc_config_get_string (mc_main_config, "Misc", "ftp_proxy_host", "gate");
|
||||
ftpfs_ignore_chattr_errors = mc_config_get_bool (mc_main_config, CONFIG_APP_SECTION,
|
||||
"ignore_ftp_chattr_errors", TRUE);
|
||||
ftpfs_proxy_host =
|
||||
mc_config_get_string (mc_main_config, CONFIG_MISC_SECTION, "ftp_proxy_host", "gate");
|
||||
ftpfs_ignore_chattr_errors =
|
||||
mc_config_get_bool (mc_main_config, CONFIG_APP_SECTION, "ignore_ftp_chattr_errors", TRUE);
|
||||
ftpfs_init_passwd ();
|
||||
#endif /* ENABLE_VFS_FTP */
|
||||
|
||||
@ -965,14 +967,14 @@ load_setup (void)
|
||||
#ifdef HAVE_CHARSET
|
||||
if (codepages->len > 1)
|
||||
{
|
||||
buffer = mc_config_get_string (mc_main_config, "Misc", "display_codepage", "");
|
||||
buffer = mc_config_get_string (mc_main_config, CONFIG_MISC_SECTION, "display_codepage", "");
|
||||
if (buffer[0] != '\0')
|
||||
{
|
||||
mc_global.display_codepage = get_codepage_index (buffer);
|
||||
cp_display = get_codepage_id (mc_global.display_codepage);
|
||||
}
|
||||
g_free (buffer);
|
||||
buffer = mc_config_get_string (mc_main_config, "Misc", "source_codepage", "");
|
||||
buffer = mc_config_get_string (mc_main_config, CONFIG_MISC_SECTION, "source_codepage", "");
|
||||
if (buffer[0] != '\0')
|
||||
{
|
||||
default_source_codepage = get_codepage_index (buffer);
|
||||
@ -982,7 +984,8 @@ load_setup (void)
|
||||
g_free (buffer);
|
||||
}
|
||||
|
||||
autodetect_codeset = mc_config_get_string (mc_main_config, "Misc", "autodetect_codeset", "");
|
||||
autodetect_codeset =
|
||||
mc_config_get_string (mc_main_config, CONFIG_MISC_SECTION, "autodetect_codeset", "");
|
||||
if ((autodetect_codeset[0] != '\0') && (strcmp (autodetect_codeset, "off") != 0))
|
||||
is_autodetect_codeset_enabled = TRUE;
|
||||
|
||||
@ -992,8 +995,10 @@ load_setup (void)
|
||||
mc_global.utf8_display = str_isutf8 (buffer);
|
||||
#endif /* HAVE_CHARSET */
|
||||
|
||||
clipboard_store_path = mc_config_get_string (mc_main_config, "Misc", "clipboard_store", "");
|
||||
clipboard_paste_path = mc_config_get_string (mc_main_config, "Misc", "clipboard_paste", "");
|
||||
clipboard_store_path =
|
||||
mc_config_get_string (mc_main_config, CONFIG_MISC_SECTION, "clipboard_store", "");
|
||||
clipboard_paste_path =
|
||||
mc_config_get_string (mc_main_config, CONFIG_MISC_SECTION, "clipboard_paste", "");
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
@ -1021,20 +1026,25 @@ save_setup (gboolean save_options, gboolean save_panel_options)
|
||||
/* directory_history_save (); */
|
||||
|
||||
#ifdef ENABLE_VFS_FTP
|
||||
mc_config_set_string (mc_main_config, "Misc", "ftpfs_password", ftpfs_anonymous_passwd);
|
||||
mc_config_set_string (mc_main_config, CONFIG_MISC_SECTION, "ftpfs_password",
|
||||
ftpfs_anonymous_passwd);
|
||||
if (ftpfs_proxy_host)
|
||||
mc_config_set_string (mc_main_config, "Misc", "ftp_proxy_host", ftpfs_proxy_host);
|
||||
mc_config_set_string (mc_main_config, CONFIG_MISC_SECTION, "ftp_proxy_host",
|
||||
ftpfs_proxy_host);
|
||||
#endif /* ENABLE_VFS_FTP */
|
||||
|
||||
#ifdef HAVE_CHARSET
|
||||
mc_config_set_string (mc_main_config, "Misc", "display_codepage",
|
||||
mc_config_set_string (mc_main_config, CONFIG_MISC_SECTION, "display_codepage",
|
||||
get_codepage_id (mc_global.display_codepage));
|
||||
mc_config_set_string (mc_main_config, "Misc", "source_codepage",
|
||||
mc_config_set_string (mc_main_config, CONFIG_MISC_SECTION, "source_codepage",
|
||||
get_codepage_id (default_source_codepage));
|
||||
mc_config_set_string (mc_main_config, "Misc", "autodetect_codeset", autodetect_codeset);
|
||||
mc_config_set_string (mc_main_config, CONFIG_MISC_SECTION, "autodetect_codeset",
|
||||
autodetect_codeset);
|
||||
#endif /* HAVE_CHARSET */
|
||||
mc_config_set_string (mc_main_config, "Misc", "clipboard_store", clipboard_store_path);
|
||||
mc_config_set_string (mc_main_config, "Misc", "clipboard_paste", clipboard_paste_path);
|
||||
mc_config_set_string (mc_main_config, CONFIG_MISC_SECTION, "clipboard_store",
|
||||
clipboard_store_path);
|
||||
mc_config_set_string (mc_main_config, CONFIG_MISC_SECTION, "clipboard_paste",
|
||||
clipboard_paste_path);
|
||||
|
||||
tmp_profile = mc_config_get_full_path (MC_CONFIG_FILE);
|
||||
ret = mc_config_save_to_file (mc_main_config, tmp_profile, NULL);
|
||||
@ -1120,7 +1130,8 @@ save_layout (void)
|
||||
|
||||
/* 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_set_int (mc_main_config, CONFIG_LAYOUT_SECTION, layout[i].opt_name,
|
||||
*layout[i].opt_addr);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
@ -1154,7 +1165,7 @@ load_anon_passwd (void)
|
||||
{
|
||||
char *buffer;
|
||||
|
||||
buffer = mc_config_get_string (mc_main_config, "Misc", "ftpfs_password", "");
|
||||
buffer = mc_config_get_string (mc_main_config, CONFIG_MISC_SECTION, "ftpfs_password", "");
|
||||
|
||||
if ((buffer != NULL) && (buffer[0] != '\0'))
|
||||
return buffer;
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user