mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
Get rid of global variables mc_main_config and mc_panels_config.
Use mc_global.main_config and mc_global.panels_congig instead. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
1c2060c28f
commit
2151edaff2
@ -95,6 +95,7 @@
|
|||||||
|
|
||||||
#include "fs.h"
|
#include "fs.h"
|
||||||
#include "shell.h"
|
#include "shell.h"
|
||||||
|
#include "mcconfig.h"
|
||||||
|
|
||||||
#ifdef USE_MAINTAINER_MODE
|
#ifdef USE_MAINTAINER_MODE
|
||||||
#include "lib/logging.h"
|
#include "lib/logging.h"
|
||||||
@ -181,6 +182,9 @@ typedef struct
|
|||||||
/* share_data_dir: Area for default settings from developers */
|
/* share_data_dir: Area for default settings from developers */
|
||||||
char *share_data_dir;
|
char *share_data_dir;
|
||||||
|
|
||||||
|
mc_config_t *main_config;
|
||||||
|
mc_config_t *panels_config;
|
||||||
|
|
||||||
#ifdef HAVE_CHARSET
|
#ifdef HAVE_CHARSET
|
||||||
/* Numbers of (file I/O) and (input/display) codepages. -1 if not selected */
|
/* Numbers of (file I/O) and (input/display) codepages. -1 if not selected */
|
||||||
int source_codepage;
|
int source_codepage;
|
||||||
|
@ -84,7 +84,7 @@ is_logging_enabled (void)
|
|||||||
return logging_enabled;
|
return logging_enabled;
|
||||||
|
|
||||||
logging_enabled =
|
logging_enabled =
|
||||||
mc_config_get_bool (mc_main_config, CONFIG_GROUP_NAME, CONFIG_KEY_NAME, FALSE);
|
mc_config_get_bool (mc_global.main_config, CONFIG_GROUP_NAME, CONFIG_KEY_NAME, FALSE);
|
||||||
logging_initialized = TRUE;
|
logging_initialized = TRUE;
|
||||||
|
|
||||||
return logging_enabled;
|
return logging_enabled;
|
||||||
@ -101,8 +101,9 @@ get_log_filename (void)
|
|||||||
if (env_filename != NULL)
|
if (env_filename != NULL)
|
||||||
return g_strdup (env_filename);
|
return g_strdup (env_filename);
|
||||||
|
|
||||||
if (mc_config_has_param (mc_main_config, CONFIG_GROUP_NAME, CONFIG_KEY_NAME_FILE))
|
if (mc_config_has_param (mc_global.main_config, CONFIG_GROUP_NAME, CONFIG_KEY_NAME_FILE))
|
||||||
return mc_config_get_string (mc_main_config, CONFIG_GROUP_NAME, CONFIG_KEY_NAME_FILE, NULL);
|
return mc_config_get_string (mc_global.main_config, CONFIG_GROUP_NAME, CONFIG_KEY_NAME_FILE,
|
||||||
|
NULL);
|
||||||
|
|
||||||
return mc_config_get_full_path ("mc.log");
|
return mc_config_get_full_path ("mc.log");
|
||||||
}
|
}
|
||||||
|
@ -23,9 +23,6 @@ typedef struct mc_config_t
|
|||||||
|
|
||||||
/*** global variables defined in .c file *********************************************************/
|
/*** global variables defined in .c file *********************************************************/
|
||||||
|
|
||||||
extern mc_config_t *mc_main_config;
|
|
||||||
extern mc_config_t *mc_panels_config;
|
|
||||||
|
|
||||||
/*** declarations of public functions ************************************************************/
|
/*** declarations of public functions ************************************************************/
|
||||||
|
|
||||||
/* mcconfig/common.c: */
|
/* mcconfig/common.c: */
|
||||||
|
@ -34,9 +34,6 @@
|
|||||||
|
|
||||||
/*** global variables **************************************************/
|
/*** global variables **************************************************/
|
||||||
|
|
||||||
mc_config_t *mc_main_config;
|
|
||||||
mc_config_t *mc_panels_config;
|
|
||||||
|
|
||||||
/*** file scope macro definitions **************************************/
|
/*** file scope macro definitions **************************************/
|
||||||
|
|
||||||
/*** file scope type declarations **************************************/
|
/*** file scope type declarations **************************************/
|
||||||
|
@ -76,7 +76,7 @@ mc_skin_get_default_name (void)
|
|||||||
return g_strdup (tmp_str);
|
return g_strdup (tmp_str);
|
||||||
|
|
||||||
/* from config. Or 'default' if no present in config */
|
/* from config. Or 'default' if no present in config */
|
||||||
return mc_config_get_string (mc_main_config, CONFIG_APP_SECTION, "skin", "default");
|
return mc_config_get_string (mc_global.main_config, CONFIG_APP_SECTION, "skin", "default");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
@ -1216,7 +1216,7 @@ save_file_position (const vfs_path_t * filename_vpath, long line, long column, o
|
|||||||
gboolean src_error = FALSE;
|
gboolean src_error = FALSE;
|
||||||
|
|
||||||
if (filepos_max_saved_entries == 0)
|
if (filepos_max_saved_entries == 0)
|
||||||
filepos_max_saved_entries = mc_config_get_int (mc_main_config, CONFIG_APP_SECTION,
|
filepos_max_saved_entries = mc_config_get_int (mc_global.main_config, CONFIG_APP_SECTION,
|
||||||
"filepos_max_saved_entries", 1024);
|
"filepos_max_saved_entries", 1024);
|
||||||
|
|
||||||
fn = mc_config_get_full_path (MC_FILEPOS_FILE);
|
fn = mc_config_get_full_path (MC_FILEPOS_FILE);
|
||||||
|
@ -3006,23 +3006,24 @@ dview_do_save (WDiff * dview)
|
|||||||
static void
|
static void
|
||||||
dview_save_options (WDiff * dview)
|
dview_save_options (WDiff * dview)
|
||||||
{
|
{
|
||||||
mc_config_set_bool (mc_main_config, "DiffView", "show_symbols",
|
mc_config_set_bool (mc_global.main_config, "DiffView", "show_symbols",
|
||||||
dview->display_symbols != 0 ? TRUE : FALSE);
|
dview->display_symbols != 0 ? TRUE : FALSE);
|
||||||
mc_config_set_bool (mc_main_config, "DiffView", "show_numbers",
|
mc_config_set_bool (mc_global.main_config, "DiffView", "show_numbers",
|
||||||
dview->display_numbers != 0 ? TRUE : FALSE);
|
dview->display_numbers != 0 ? TRUE : FALSE);
|
||||||
mc_config_set_int (mc_main_config, "DiffView", "tab_size", dview->tab_size);
|
mc_config_set_int (mc_global.main_config, "DiffView", "tab_size", dview->tab_size);
|
||||||
|
|
||||||
mc_config_set_int (mc_main_config, "DiffView", "diff_quality", dview->opt.quality);
|
mc_config_set_int (mc_global.main_config, "DiffView", "diff_quality", dview->opt.quality);
|
||||||
|
|
||||||
mc_config_set_bool (mc_main_config, "DiffView", "diff_ignore_tws",
|
mc_config_set_bool (mc_global.main_config, "DiffView", "diff_ignore_tws",
|
||||||
dview->opt.strip_trailing_cr);
|
dview->opt.strip_trailing_cr);
|
||||||
mc_config_set_bool (mc_main_config, "DiffView", "diff_ignore_all_space",
|
mc_config_set_bool (mc_global.main_config, "DiffView", "diff_ignore_all_space",
|
||||||
dview->opt.ignore_all_space);
|
dview->opt.ignore_all_space);
|
||||||
mc_config_set_bool (mc_main_config, "DiffView", "diff_ignore_space_change",
|
mc_config_set_bool (mc_global.main_config, "DiffView", "diff_ignore_space_change",
|
||||||
dview->opt.ignore_space_change);
|
dview->opt.ignore_space_change);
|
||||||
mc_config_set_bool (mc_main_config, "DiffView", "diff_tab_expansion",
|
mc_config_set_bool (mc_global.main_config, "DiffView", "diff_tab_expansion",
|
||||||
dview->opt.ignore_tab_expansion);
|
dview->opt.ignore_tab_expansion);
|
||||||
mc_config_set_bool (mc_main_config, "DiffView", "diff_ignore_case", dview->opt.ignore_case);
|
mc_config_set_bool (mc_global.main_config, "DiffView", "diff_ignore_case",
|
||||||
|
dview->opt.ignore_case);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
@ -3033,30 +3034,30 @@ dview_load_options (WDiff * dview)
|
|||||||
gboolean show_numbers, show_symbols;
|
gboolean show_numbers, show_symbols;
|
||||||
int tab_size;
|
int tab_size;
|
||||||
|
|
||||||
show_symbols = mc_config_get_bool (mc_main_config, "DiffView", "show_symbols", FALSE);
|
show_symbols = mc_config_get_bool (mc_global.main_config, "DiffView", "show_symbols", FALSE);
|
||||||
if (show_symbols)
|
if (show_symbols)
|
||||||
dview->display_symbols = 1;
|
dview->display_symbols = 1;
|
||||||
show_numbers = mc_config_get_bool (mc_main_config, "DiffView", "show_numbers", FALSE);
|
show_numbers = mc_config_get_bool (mc_global.main_config, "DiffView", "show_numbers", FALSE);
|
||||||
if (show_numbers)
|
if (show_numbers)
|
||||||
dview->display_numbers = calc_nwidth ((const GArray * const *) dview->a);
|
dview->display_numbers = calc_nwidth ((const GArray * const *) dview->a);
|
||||||
tab_size = mc_config_get_int (mc_main_config, "DiffView", "tab_size", 8);
|
tab_size = mc_config_get_int (mc_global.main_config, "DiffView", "tab_size", 8);
|
||||||
if (tab_size > 0 && tab_size < 9)
|
if (tab_size > 0 && tab_size < 9)
|
||||||
dview->tab_size = tab_size;
|
dview->tab_size = tab_size;
|
||||||
else
|
else
|
||||||
dview->tab_size = 8;
|
dview->tab_size = 8;
|
||||||
|
|
||||||
dview->opt.quality = mc_config_get_int (mc_main_config, "DiffView", "diff_quality", 0);
|
dview->opt.quality = mc_config_get_int (mc_global.main_config, "DiffView", "diff_quality", 0);
|
||||||
|
|
||||||
dview->opt.strip_trailing_cr =
|
dview->opt.strip_trailing_cr =
|
||||||
mc_config_get_bool (mc_main_config, "DiffView", "diff_ignore_tws", FALSE);
|
mc_config_get_bool (mc_global.main_config, "DiffView", "diff_ignore_tws", FALSE);
|
||||||
dview->opt.ignore_all_space =
|
dview->opt.ignore_all_space =
|
||||||
mc_config_get_bool (mc_main_config, "DiffView", "diff_ignore_all_space", FALSE);
|
mc_config_get_bool (mc_global.main_config, "DiffView", "diff_ignore_all_space", FALSE);
|
||||||
dview->opt.ignore_space_change =
|
dview->opt.ignore_space_change =
|
||||||
mc_config_get_bool (mc_main_config, "DiffView", "diff_ignore_space_change", FALSE);
|
mc_config_get_bool (mc_global.main_config, "DiffView", "diff_ignore_space_change", FALSE);
|
||||||
dview->opt.ignore_tab_expansion =
|
dview->opt.ignore_tab_expansion =
|
||||||
mc_config_get_bool (mc_main_config, "DiffView", "diff_tab_expansion", FALSE);
|
mc_config_get_bool (mc_global.main_config, "DiffView", "diff_tab_expansion", FALSE);
|
||||||
dview->opt.ignore_case =
|
dview->opt.ignore_case =
|
||||||
mc_config_get_bool (mc_main_config, "DiffView", "diff_ignore_case", FALSE);
|
mc_config_get_bool (mc_global.main_config, "DiffView", "diff_ignore_case", FALSE);
|
||||||
|
|
||||||
dview->new_frame = TRUE;
|
dview->new_frame = TRUE;
|
||||||
}
|
}
|
||||||
|
@ -1235,7 +1235,7 @@ edit_collect_completions (WEdit * edit, off_t word_start, gsize word_len,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
entire_file =
|
entire_file =
|
||||||
mc_config_get_bool (mc_main_config, CONFIG_APP_SECTION,
|
mc_config_get_bool (mc_global.main_config, CONFIG_APP_SECTION,
|
||||||
"editor_wordcompletion_collect_entire_file", 0);
|
"editor_wordcompletion_collect_entire_file", 0);
|
||||||
|
|
||||||
last_byte = entire_file ? edit->buffer.size : word_start;
|
last_byte = entire_file ? edit->buffer.size : word_start;
|
||||||
|
@ -233,7 +233,8 @@ execute_get_opts_from_cfg (const char *command, const char *default_str)
|
|||||||
char *str_from_config;
|
char *str_from_config;
|
||||||
|
|
||||||
str_from_config =
|
str_from_config =
|
||||||
mc_config_get_string_raw (mc_main_config, CONFIG_EXT_EDITOR_VIEWER_SECTION, command, NULL);
|
mc_config_get_string_raw (mc_global.main_config, CONFIG_EXT_EDITOR_VIEWER_SECTION, command,
|
||||||
|
NULL);
|
||||||
|
|
||||||
if (str_from_config == NULL)
|
if (str_from_config == NULL)
|
||||||
{
|
{
|
||||||
|
@ -585,7 +585,8 @@ appearance_box (void)
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (quick_dialog (&qdlg) == B_ENTER)
|
if (quick_dialog (&qdlg) == B_ENTER)
|
||||||
mc_config_set_string (mc_main_config, CONFIG_APP_SECTION, "skin", current_skin_name);
|
mc_config_set_string (mc_global.main_config, CONFIG_APP_SECTION, "skin",
|
||||||
|
current_skin_name);
|
||||||
else
|
else
|
||||||
skin_apply (NULL);
|
skin_apply (NULL);
|
||||||
}
|
}
|
||||||
@ -602,7 +603,7 @@ panel_options_box (void)
|
|||||||
{
|
{
|
||||||
int simple_swap;
|
int simple_swap;
|
||||||
|
|
||||||
simple_swap = mc_config_get_bool (mc_main_config, CONFIG_PANELS_SECTION,
|
simple_swap = mc_config_get_bool (mc_global.main_config, CONFIG_PANELS_SECTION,
|
||||||
"simple_swap", FALSE) ? 1 : 0;
|
"simple_swap", FALSE) ? 1 : 0;
|
||||||
{
|
{
|
||||||
const char *qsearch_options[] = {
|
const char *qsearch_options[] = {
|
||||||
@ -662,7 +663,7 @@ panel_options_box (void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mc_config_set_bool (mc_main_config, CONFIG_PANELS_SECTION,
|
mc_config_set_bool (mc_global.main_config, CONFIG_PANELS_SECTION,
|
||||||
"simple_swap", (gboolean) (simple_swap & C_BOOL));
|
"simple_swap", (gboolean) (simple_swap & C_BOOL));
|
||||||
|
|
||||||
if (!panels_options.fast_reload_msg_shown && panels_options.fast_reload)
|
if (!panels_options.fast_reload_msg_shown && panels_options.fast_reload)
|
||||||
@ -700,7 +701,7 @@ panel_listing_box (WPanel * panel, int num, char **userp, char **minip, int *use
|
|||||||
for (i = 0; i < LIST_TYPES; i++)
|
for (i = 0; i < LIST_TYPES; i++)
|
||||||
panel->user_status_format[i] = g_strdup (DEFAULT_USER_FORMAT);
|
panel->user_status_format[i] = g_strdup (DEFAULT_USER_FORMAT);
|
||||||
section = g_strconcat ("Temporal:", p, (char *) NULL);
|
section = g_strconcat ("Temporal:", p, (char *) NULL);
|
||||||
if (!mc_config_has_group (mc_main_config, section))
|
if (!mc_config_has_group (mc_global.main_config, section))
|
||||||
{
|
{
|
||||||
g_free (section);
|
g_free (section);
|
||||||
section = g_strdup (p);
|
section = g_strdup (p);
|
||||||
|
@ -284,27 +284,29 @@ find_load_options (void)
|
|||||||
loaded = TRUE;
|
loaded = TRUE;
|
||||||
|
|
||||||
options.file_case_sens =
|
options.file_case_sens =
|
||||||
mc_config_get_bool (mc_main_config, "FindFile", "file_case_sens", TRUE);
|
mc_config_get_bool (mc_global.main_config, "FindFile", "file_case_sens", TRUE);
|
||||||
options.file_pattern =
|
options.file_pattern =
|
||||||
mc_config_get_bool (mc_main_config, "FindFile", "file_shell_pattern", TRUE);
|
mc_config_get_bool (mc_global.main_config, "FindFile", "file_shell_pattern", TRUE);
|
||||||
options.find_recurs = mc_config_get_bool (mc_main_config, "FindFile", "file_find_recurs", TRUE);
|
options.find_recurs =
|
||||||
|
mc_config_get_bool (mc_global.main_config, "FindFile", "file_find_recurs", TRUE);
|
||||||
options.skip_hidden =
|
options.skip_hidden =
|
||||||
mc_config_get_bool (mc_main_config, "FindFile", "file_skip_hidden", FALSE);
|
mc_config_get_bool (mc_global.main_config, "FindFile", "file_skip_hidden", FALSE);
|
||||||
options.file_all_charsets =
|
options.file_all_charsets =
|
||||||
mc_config_get_bool (mc_main_config, "FindFile", "file_all_charsets", FALSE);
|
mc_config_get_bool (mc_global.main_config, "FindFile", "file_all_charsets", FALSE);
|
||||||
options.content_case_sens =
|
options.content_case_sens =
|
||||||
mc_config_get_bool (mc_main_config, "FindFile", "content_case_sens", TRUE);
|
mc_config_get_bool (mc_global.main_config, "FindFile", "content_case_sens", TRUE);
|
||||||
options.content_regexp =
|
options.content_regexp =
|
||||||
mc_config_get_bool (mc_main_config, "FindFile", "content_regexp", FALSE);
|
mc_config_get_bool (mc_global.main_config, "FindFile", "content_regexp", FALSE);
|
||||||
options.content_first_hit =
|
options.content_first_hit =
|
||||||
mc_config_get_bool (mc_main_config, "FindFile", "content_first_hit", FALSE);
|
mc_config_get_bool (mc_global.main_config, "FindFile", "content_first_hit", FALSE);
|
||||||
options.content_whole_words =
|
options.content_whole_words =
|
||||||
mc_config_get_bool (mc_main_config, "FindFile", "content_whole_words", FALSE);
|
mc_config_get_bool (mc_global.main_config, "FindFile", "content_whole_words", FALSE);
|
||||||
options.content_all_charsets =
|
options.content_all_charsets =
|
||||||
mc_config_get_bool (mc_main_config, "FindFile", "content_all_charsets", FALSE);
|
mc_config_get_bool (mc_global.main_config, "FindFile", "content_all_charsets", FALSE);
|
||||||
options.ignore_dirs_enable =
|
options.ignore_dirs_enable =
|
||||||
mc_config_get_bool (mc_main_config, "FindFile", "ignore_dirs_enable", TRUE);
|
mc_config_get_bool (mc_global.main_config, "FindFile", "ignore_dirs_enable", TRUE);
|
||||||
options.ignore_dirs = mc_config_get_string (mc_main_config, "FindFile", "ignore_dirs", "");
|
options.ignore_dirs =
|
||||||
|
mc_config_get_string (mc_global.main_config, "FindFile", "ignore_dirs", "");
|
||||||
|
|
||||||
if (options.ignore_dirs[0] == '\0')
|
if (options.ignore_dirs[0] == '\0')
|
||||||
MC_PTR_FREE (options.ignore_dirs);
|
MC_PTR_FREE (options.ignore_dirs);
|
||||||
@ -315,21 +317,27 @@ find_load_options (void)
|
|||||||
static void
|
static void
|
||||||
find_save_options (void)
|
find_save_options (void)
|
||||||
{
|
{
|
||||||
mc_config_set_bool (mc_main_config, "FindFile", "file_case_sens", options.file_case_sens);
|
mc_config_set_bool (mc_global.main_config, "FindFile", "file_case_sens",
|
||||||
mc_config_set_bool (mc_main_config, "FindFile", "file_shell_pattern", options.file_pattern);
|
options.file_case_sens);
|
||||||
mc_config_set_bool (mc_main_config, "FindFile", "file_find_recurs", options.find_recurs);
|
mc_config_set_bool (mc_global.main_config, "FindFile", "file_shell_pattern",
|
||||||
mc_config_set_bool (mc_main_config, "FindFile", "file_skip_hidden", options.skip_hidden);
|
options.file_pattern);
|
||||||
mc_config_set_bool (mc_main_config, "FindFile", "file_all_charsets", options.file_all_charsets);
|
mc_config_set_bool (mc_global.main_config, "FindFile", "file_find_recurs", options.find_recurs);
|
||||||
mc_config_set_bool (mc_main_config, "FindFile", "content_case_sens", options.content_case_sens);
|
mc_config_set_bool (mc_global.main_config, "FindFile", "file_skip_hidden", options.skip_hidden);
|
||||||
mc_config_set_bool (mc_main_config, "FindFile", "content_regexp", options.content_regexp);
|
mc_config_set_bool (mc_global.main_config, "FindFile", "file_all_charsets",
|
||||||
mc_config_set_bool (mc_main_config, "FindFile", "content_first_hit", options.content_first_hit);
|
options.file_all_charsets);
|
||||||
mc_config_set_bool (mc_main_config, "FindFile", "content_whole_words",
|
mc_config_set_bool (mc_global.main_config, "FindFile", "content_case_sens",
|
||||||
|
options.content_case_sens);
|
||||||
|
mc_config_set_bool (mc_global.main_config, "FindFile", "content_regexp",
|
||||||
|
options.content_regexp);
|
||||||
|
mc_config_set_bool (mc_global.main_config, "FindFile", "content_first_hit",
|
||||||
|
options.content_first_hit);
|
||||||
|
mc_config_set_bool (mc_global.main_config, "FindFile", "content_whole_words",
|
||||||
options.content_whole_words);
|
options.content_whole_words);
|
||||||
mc_config_set_bool (mc_main_config, "FindFile", "content_all_charsets",
|
mc_config_set_bool (mc_global.main_config, "FindFile", "content_all_charsets",
|
||||||
options.content_all_charsets);
|
options.content_all_charsets);
|
||||||
mc_config_set_bool (mc_main_config, "FindFile", "ignore_dirs_enable",
|
mc_config_set_bool (mc_global.main_config, "FindFile", "ignore_dirs_enable",
|
||||||
options.ignore_dirs_enable);
|
options.ignore_dirs_enable);
|
||||||
mc_config_set_string (mc_main_config, "FindFile", "ignore_dirs", options.ignore_dirs);
|
mc_config_set_string (mc_global.main_config, "FindFile", "ignore_dirs", options.ignore_dirs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
@ -742,7 +742,7 @@ init_hotlist (hotlist_t list_type)
|
|||||||
cols = init_i18n_stuff (list_type, COLS - 6);
|
cols = init_i18n_stuff (list_type, COLS - 6);
|
||||||
|
|
||||||
hotlist_state.expanded =
|
hotlist_state.expanded =
|
||||||
mc_config_get_int (mc_main_config, "HotlistConfig", "expanded_view_of_groups", 0);
|
mc_config_get_int (mc_global.main_config, "HotlistConfig", "expanded_view_of_groups", 0);
|
||||||
|
|
||||||
#ifdef ENABLE_VFS
|
#ifdef ENABLE_VFS
|
||||||
if (list_type == LIST_VFSLIST)
|
if (list_type == LIST_VFSLIST)
|
||||||
@ -1179,21 +1179,21 @@ load_group (struct hotlist *grp)
|
|||||||
|
|
||||||
group_section = find_group_section (grp);
|
group_section = find_group_section (grp);
|
||||||
|
|
||||||
keys = mc_config_get_keys (mc_main_config, group_section, NULL);
|
keys = mc_config_get_keys (mc_global.main_config, group_section, NULL);
|
||||||
|
|
||||||
current_group = grp;
|
current_group = grp;
|
||||||
|
|
||||||
for (profile_keys = keys; *profile_keys != NULL; profile_keys++)
|
for (profile_keys = keys; *profile_keys != NULL; profile_keys++)
|
||||||
add2hotlist (mc_config_get_string (mc_main_config, group_section, *profile_keys, ""),
|
add2hotlist (mc_config_get_string (mc_global.main_config, group_section, *profile_keys, ""),
|
||||||
g_strdup (*profile_keys), HL_TYPE_GROUP, LISTBOX_APPEND_AT_END);
|
g_strdup (*profile_keys), HL_TYPE_GROUP, LISTBOX_APPEND_AT_END);
|
||||||
|
|
||||||
g_free (group_section);
|
g_free (group_section);
|
||||||
g_strfreev (keys);
|
g_strfreev (keys);
|
||||||
|
|
||||||
keys = mc_config_get_keys (mc_main_config, grp->directory, NULL);
|
keys = mc_config_get_keys (mc_global.main_config, grp->directory, NULL);
|
||||||
|
|
||||||
for (profile_keys = keys; *profile_keys != NULL; profile_keys++)
|
for (profile_keys = keys; *profile_keys != NULL; profile_keys++)
|
||||||
add2hotlist (mc_config_get_string (mc_main_config, group_section, *profile_keys, ""),
|
add2hotlist (mc_config_get_string (mc_global.main_config, group_section, *profile_keys, ""),
|
||||||
g_strdup (*profile_keys), HL_TYPE_ENTRY, LISTBOX_APPEND_AT_END);
|
g_strdup (*profile_keys), HL_TYPE_ENTRY, LISTBOX_APPEND_AT_END);
|
||||||
|
|
||||||
g_strfreev (keys);
|
g_strfreev (keys);
|
||||||
@ -1404,20 +1404,20 @@ clean_up_hotlist_groups (const char *section)
|
|||||||
char *grp_section;
|
char *grp_section;
|
||||||
|
|
||||||
grp_section = g_strconcat (section, ".Group", (char *) NULL);
|
grp_section = g_strconcat (section, ".Group", (char *) NULL);
|
||||||
if (mc_config_has_group (mc_main_config, section))
|
if (mc_config_has_group (mc_global.main_config, section))
|
||||||
mc_config_del_group (mc_main_config, section);
|
mc_config_del_group (mc_global.main_config, section);
|
||||||
|
|
||||||
if (mc_config_has_group (mc_main_config, grp_section))
|
if (mc_config_has_group (mc_global.main_config, grp_section))
|
||||||
{
|
{
|
||||||
char **profile_keys, **keys;
|
char **profile_keys, **keys;
|
||||||
|
|
||||||
keys = mc_config_get_keys (mc_main_config, grp_section, NULL);
|
keys = mc_config_get_keys (mc_global.main_config, grp_section, NULL);
|
||||||
|
|
||||||
for (profile_keys = keys; *profile_keys != NULL; profile_keys++)
|
for (profile_keys = keys; *profile_keys != NULL; profile_keys++)
|
||||||
clean_up_hotlist_groups (*profile_keys);
|
clean_up_hotlist_groups (*profile_keys);
|
||||||
|
|
||||||
g_strfreev (keys);
|
g_strfreev (keys);
|
||||||
mc_config_del_group (mc_main_config, grp_section);
|
mc_config_del_group (mc_global.main_config, grp_section);
|
||||||
}
|
}
|
||||||
g_free (grp_section);
|
g_free (grp_section);
|
||||||
}
|
}
|
||||||
@ -1484,8 +1484,8 @@ load_hotlist (void)
|
|||||||
GError *mcerror = NULL;
|
GError *mcerror = NULL;
|
||||||
|
|
||||||
clean_up_hotlist_groups ("Hotlist");
|
clean_up_hotlist_groups ("Hotlist");
|
||||||
if (!mc_config_save_file (mc_main_config, &mcerror))
|
if (!mc_config_save_file (mc_global.main_config, &mcerror))
|
||||||
setup_save_config_show_error (mc_main_config->ini_path, &mcerror);
|
setup_save_config_show_error (mc_global.main_config->ini_path, &mcerror);
|
||||||
|
|
||||||
mc_error_message (&mcerror, NULL);
|
mc_error_message (&mcerror, NULL);
|
||||||
}
|
}
|
||||||
|
@ -1088,7 +1088,7 @@ swap_panels (void)
|
|||||||
panel2 = PANEL (panels[1].widget);
|
panel2 = PANEL (panels[1].widget);
|
||||||
|
|
||||||
if (panels[0].type == view_listing && panels[1].type == view_listing &&
|
if (panels[0].type == view_listing && panels[1].type == view_listing &&
|
||||||
!mc_config_get_bool (mc_main_config, CONFIG_PANELS_SECTION, "simple_swap", FALSE))
|
!mc_config_get_bool (mc_global.main_config, CONFIG_PANELS_SECTION, "simple_swap", FALSE))
|
||||||
{
|
{
|
||||||
WPanel panel;
|
WPanel panel;
|
||||||
|
|
||||||
|
@ -4316,7 +4316,7 @@ panel_new_with_dir (const char *panel_name, const vfs_path_t * vpath)
|
|||||||
panel->frame_size = frame_half;
|
panel->frame_size = frame_half;
|
||||||
|
|
||||||
section = g_strconcat ("Temporal:", panel->panel_name, (char *) NULL);
|
section = g_strconcat ("Temporal:", panel->panel_name, (char *) NULL);
|
||||||
if (!mc_config_has_group (mc_main_config, section))
|
if (!mc_config_has_group (mc_global.main_config, section))
|
||||||
{
|
{
|
||||||
g_free (section);
|
g_free (section);
|
||||||
section = g_strdup (panel->panel_name);
|
section = g_strdup (panel->panel_name);
|
||||||
|
@ -558,7 +558,7 @@ load_panelize (void)
|
|||||||
{
|
{
|
||||||
char **keys;
|
char **keys;
|
||||||
|
|
||||||
keys = mc_config_get_keys (mc_main_config, panelize_section, NULL);
|
keys = mc_config_get_keys (mc_global.main_config, panelize_section, NULL);
|
||||||
|
|
||||||
add2panelize (g_strdup (_("Other command")), g_strdup (""));
|
add2panelize (g_strdup (_("Other command")), g_strdup (""));
|
||||||
|
|
||||||
@ -594,8 +594,8 @@ load_panelize (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
add2panelize (g_string_free (buffer, FALSE),
|
add2panelize (g_string_free (buffer, FALSE),
|
||||||
mc_config_get_string (mc_main_config, panelize_section, *profile_keys,
|
mc_config_get_string (mc_global.main_config, panelize_section,
|
||||||
""));
|
*profile_keys, ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
str_close_conv (conv);
|
str_close_conv (conv);
|
||||||
@ -611,11 +611,11 @@ save_panelize (void)
|
|||||||
{
|
{
|
||||||
struct panelize *current = panelize;
|
struct panelize *current = panelize;
|
||||||
|
|
||||||
mc_config_del_group (mc_main_config, panelize_section);
|
mc_config_del_group (mc_global.main_config, panelize_section);
|
||||||
for (; current; current = current->next)
|
for (; current; current = current->next)
|
||||||
{
|
{
|
||||||
if (strcmp (current->label, _("Other command")))
|
if (strcmp (current->label, _("Other command")))
|
||||||
mc_config_set_string (mc_main_config,
|
mc_config_set_string (mc_global.main_config,
|
||||||
panelize_section, current->label, current->command);
|
panelize_section, current->label, current->command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -361,8 +361,8 @@ learn_save (void)
|
|||||||
char *esc_str;
|
char *esc_str;
|
||||||
|
|
||||||
esc_str = strutils_escape (learnkeys[i].sequence, -1, ";\\", TRUE);
|
esc_str = strutils_escape (learnkeys[i].sequence, -1, ";\\", TRUE);
|
||||||
mc_config_set_string_raw_value (mc_main_config, section, key_name_conv_tab[i].name,
|
mc_config_set_string_raw_value (mc_global.main_config, section,
|
||||||
esc_str);
|
key_name_conv_tab[i].name, esc_str);
|
||||||
g_free (esc_str);
|
g_free (esc_str);
|
||||||
|
|
||||||
profile_changed = TRUE;
|
profile_changed = TRUE;
|
||||||
@ -375,7 +375,7 @@ learn_save (void)
|
|||||||
* disk is much worse.
|
* disk is much worse.
|
||||||
*/
|
*/
|
||||||
if (profile_changed)
|
if (profile_changed)
|
||||||
mc_config_save_file (mc_main_config, NULL);
|
mc_config_save_file (mc_global.main_config, NULL);
|
||||||
|
|
||||||
g_free (section);
|
g_free (section);
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ check_codeset (void)
|
|||||||
if (mc_global.display_codepage == -1)
|
if (mc_global.display_codepage == -1)
|
||||||
mc_global.display_codepage = 0;
|
mc_global.display_codepage = 0;
|
||||||
|
|
||||||
mc_config_set_string (mc_main_config, CONFIG_MISC_SECTION, "display_codepage",
|
mc_config_set_string (mc_global.main_config, CONFIG_MISC_SECTION, "display_codepage",
|
||||||
cp_display);
|
cp_display);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -287,7 +287,7 @@ main (int argc, char *argv[])
|
|||||||
char *buffer;
|
char *buffer;
|
||||||
vfs_path_t *vpath;
|
vfs_path_t *vpath;
|
||||||
|
|
||||||
buffer = mc_config_get_string (mc_panels_config, "Dirs", "other_dir", ".");
|
buffer = mc_config_get_string (mc_global.panels_config, "Dirs", "other_dir", ".");
|
||||||
vpath = vfs_path_from_str (buffer);
|
vpath = vfs_path_from_str (buffer);
|
||||||
if (vfs_file_is_local (vpath))
|
if (vfs_file_is_local (vpath))
|
||||||
saved_other_dir = buffer;
|
saved_other_dir = buffer;
|
||||||
|
171
src/setup.c
171
src/setup.c
@ -587,10 +587,10 @@ load_layout (void)
|
|||||||
int first_panel_size;
|
int first_panel_size;
|
||||||
|
|
||||||
/* legacy options */
|
/* legacy options */
|
||||||
panels_layout.horizontal_split = mc_config_get_int (mc_main_config, CONFIG_APP_SECTION,
|
panels_layout.horizontal_split = mc_config_get_int (mc_global.main_config, CONFIG_APP_SECTION,
|
||||||
"horizontal_split", 0);
|
"horizontal_split", 0);
|
||||||
equal_split = mc_config_get_int (mc_main_config, "Layout", "equal_split", 1);
|
equal_split = mc_config_get_int (mc_global.main_config, "Layout", "equal_split", 1);
|
||||||
first_panel_size = mc_config_get_int (mc_main_config, "Layout", "first_panel_size", 1);
|
first_panel_size = mc_config_get_int (mc_global.main_config, "Layout", "first_panel_size", 1);
|
||||||
if (panels_layout.horizontal_split)
|
if (panels_layout.horizontal_split)
|
||||||
{
|
{
|
||||||
panels_layout.horizontal_equal = equal_split;
|
panels_layout.horizontal_equal = equal_split;
|
||||||
@ -604,13 +604,13 @@ load_layout (void)
|
|||||||
|
|
||||||
/* actual options override legacy ones */
|
/* actual options override legacy ones */
|
||||||
for (i = 0; layout[i].opt_name != NULL; i++)
|
for (i = 0; layout[i].opt_name != NULL; i++)
|
||||||
*layout[i].opt_addr = mc_config_get_int (mc_main_config, CONFIG_LAYOUT_SECTION,
|
*layout[i].opt_addr = mc_config_get_int (mc_global.main_config, CONFIG_LAYOUT_SECTION,
|
||||||
layout[i].opt_name, *layout[i].opt_addr);
|
layout[i].opt_name, *layout[i].opt_addr);
|
||||||
|
|
||||||
/* remove legacy options */
|
/* remove legacy options */
|
||||||
mc_config_del_key (mc_main_config, CONFIG_APP_SECTION, "horizontal_split");
|
mc_config_del_key (mc_global.main_config, CONFIG_APP_SECTION, "horizontal_split");
|
||||||
mc_config_del_key (mc_main_config, "Layout", "equal_split");
|
mc_config_del_key (mc_global.main_config, "Layout", "equal_split");
|
||||||
mc_config_del_key (mc_main_config, "Layout", "first_panel_size");
|
mc_config_del_key (mc_global.main_config, "Layout", "first_panel_size");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
@ -759,7 +759,7 @@ load_setup_get_keymap_profile_config (gboolean load_from_file)
|
|||||||
g_free (fname);
|
g_free (fname);
|
||||||
|
|
||||||
/* 5) main config; [Midnight Commander] -> keymap */
|
/* 5) main config; [Midnight Commander] -> keymap */
|
||||||
fname2 = mc_config_get_string (mc_main_config, CONFIG_APP_SECTION, "keymap", NULL);
|
fname2 = mc_config_get_string (mc_global.main_config, CONFIG_APP_SECTION, "keymap", NULL);
|
||||||
if (fname2 != NULL && *fname2 != '\0')
|
if (fname2 != NULL && *fname2 != '\0')
|
||||||
fname = load_setup_get_full_config_name (NULL, fname2);
|
fname = load_setup_get_full_config_name (NULL, fname2);
|
||||||
g_free (fname2);
|
g_free (fname2);
|
||||||
@ -792,7 +792,7 @@ setup__load_panel_state (const char *section)
|
|||||||
panel_view_mode_t mode = view_listing;
|
panel_view_mode_t mode = view_listing;
|
||||||
|
|
||||||
/* Load the display mode */
|
/* Load the display mode */
|
||||||
buffer = mc_config_get_string (mc_panels_config, section, "display", "listing");
|
buffer = mc_config_get_string (mc_global.panels_config, section, "display", "listing");
|
||||||
|
|
||||||
for (i = 0; panel_types[i].opt_name != NULL; i++)
|
for (i = 0; panel_types[i].opt_name != NULL; i++)
|
||||||
if (g_ascii_strcasecmp (panel_types[i].opt_name, buffer) == 0)
|
if (g_ascii_strcasecmp (panel_types[i].opt_name, buffer) == 0)
|
||||||
@ -816,7 +816,8 @@ panel_save_type (const char *section, panel_view_mode_t type)
|
|||||||
for (i = 0; panel_types[i].opt_name != NULL; i++)
|
for (i = 0; panel_types[i].opt_name != NULL; i++)
|
||||||
if (panel_types[i].opt_type == type)
|
if (panel_types[i].opt_type == type)
|
||||||
{
|
{
|
||||||
mc_config_set_string (mc_panels_config, section, "display", panel_types[i].opt_name);
|
mc_config_set_string (mc_global.panels_config, section, "display",
|
||||||
|
panel_types[i].opt_name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -829,18 +830,18 @@ panel_save_type (const char *section, panel_view_mode_t type)
|
|||||||
static void
|
static void
|
||||||
panels_load_options (void)
|
panels_load_options (void)
|
||||||
{
|
{
|
||||||
if (mc_config_has_group (mc_main_config, CONFIG_PANELS_SECTION))
|
if (mc_config_has_group (mc_global.main_config, CONFIG_PANELS_SECTION))
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
int qmode;
|
int qmode;
|
||||||
|
|
||||||
for (i = 0; panels_ini_options[i].opt_name != NULL; i++)
|
for (i = 0; panels_ini_options[i].opt_name != NULL; i++)
|
||||||
*panels_ini_options[i].opt_addr =
|
*panels_ini_options[i].opt_addr =
|
||||||
mc_config_get_bool (mc_main_config, CONFIG_PANELS_SECTION,
|
mc_config_get_bool (mc_global.main_config, CONFIG_PANELS_SECTION,
|
||||||
panels_ini_options[i].opt_name,
|
panels_ini_options[i].opt_name,
|
||||||
*panels_ini_options[i].opt_addr);
|
*panels_ini_options[i].opt_addr);
|
||||||
|
|
||||||
qmode = mc_config_get_int (mc_main_config, CONFIG_PANELS_SECTION,
|
qmode = mc_config_get_int (mc_global.main_config, CONFIG_PANELS_SECTION,
|
||||||
"quick_search_mode", (int) panels_options.qsearch_mode);
|
"quick_search_mode", (int) panels_options.qsearch_mode);
|
||||||
if (qmode < 0)
|
if (qmode < 0)
|
||||||
panels_options.qsearch_mode = QSEARCH_CASE_INSENSITIVE;
|
panels_options.qsearch_mode = QSEARCH_CASE_INSENSITIVE;
|
||||||
@ -850,7 +851,7 @@ panels_load_options (void)
|
|||||||
panels_options.qsearch_mode = (qsearch_mode_t) qmode;
|
panels_options.qsearch_mode = (qsearch_mode_t) qmode;
|
||||||
|
|
||||||
panels_options.select_flags =
|
panels_options.select_flags =
|
||||||
mc_config_get_int (mc_main_config, CONFIG_PANELS_SECTION, "select_flags",
|
mc_config_get_int (mc_global.main_config, CONFIG_PANELS_SECTION, "select_flags",
|
||||||
(int) panels_options.select_flags);
|
(int) panels_options.select_flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -866,12 +867,12 @@ panels_save_options (void)
|
|||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
for (i = 0; panels_ini_options[i].opt_name != NULL; i++)
|
for (i = 0; panels_ini_options[i].opt_name != NULL; i++)
|
||||||
mc_config_set_bool (mc_main_config, CONFIG_PANELS_SECTION,
|
mc_config_set_bool (mc_global.main_config, CONFIG_PANELS_SECTION,
|
||||||
panels_ini_options[i].opt_name, *panels_ini_options[i].opt_addr);
|
panels_ini_options[i].opt_name, *panels_ini_options[i].opt_addr);
|
||||||
|
|
||||||
mc_config_set_int (mc_main_config, CONFIG_PANELS_SECTION,
|
mc_config_set_int (mc_global.main_config, CONFIG_PANELS_SECTION,
|
||||||
"quick_search_mode", (int) panels_options.qsearch_mode);
|
"quick_search_mode", (int) panels_options.qsearch_mode);
|
||||||
mc_config_set_int (mc_main_config, CONFIG_PANELS_SECTION,
|
mc_config_set_int (mc_global.main_config, CONFIG_PANELS_SECTION,
|
||||||
"select_flags", (int) panels_options.select_flags);
|
"select_flags", (int) panels_options.select_flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -884,12 +885,12 @@ save_config (void)
|
|||||||
|
|
||||||
/* Save integer options */
|
/* Save integer options */
|
||||||
for (i = 0; int_options[i].opt_name != NULL; i++)
|
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,
|
mc_config_set_int (mc_global.main_config, CONFIG_APP_SECTION, int_options[i].opt_name,
|
||||||
*int_options[i].opt_addr);
|
*int_options[i].opt_addr);
|
||||||
|
|
||||||
/* Save string options */
|
/* Save string options */
|
||||||
for (i = 0; str_options[i].opt_name != NULL; i++)
|
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,
|
mc_config_set_string (mc_global.main_config, CONFIG_APP_SECTION, str_options[i].opt_name,
|
||||||
*str_options[i].opt_addr);
|
*str_options[i].opt_addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -902,7 +903,7 @@ save_layout (void)
|
|||||||
|
|
||||||
/* Save integer options */
|
/* Save integer options */
|
||||||
for (i = 0; layout[i].opt_name != NULL; i++)
|
for (i = 0; layout[i].opt_name != NULL; i++)
|
||||||
mc_config_set_int (mc_main_config, CONFIG_LAYOUT_SECTION, layout[i].opt_name,
|
mc_config_set_int (mc_global.main_config, CONFIG_LAYOUT_SECTION, layout[i].opt_name,
|
||||||
*layout[i].opt_addr);
|
*layout[i].opt_addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -930,20 +931,21 @@ save_panel_types (void)
|
|||||||
char *dirs;
|
char *dirs;
|
||||||
|
|
||||||
dirs = get_panel_dir_for (other_panel);
|
dirs = get_panel_dir_for (other_panel);
|
||||||
mc_config_set_string (mc_panels_config, "Dirs", "other_dir", dirs);
|
mc_config_set_string (mc_global.panels_config, "Dirs", "other_dir", dirs);
|
||||||
g_free (dirs);
|
g_free (dirs);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (current_panel != NULL)
|
if (current_panel != NULL)
|
||||||
mc_config_set_bool (mc_panels_config, "Dirs", "current_is_left", get_current_index () == 0);
|
mc_config_set_bool (mc_global.panels_config, "Dirs", "current_is_left",
|
||||||
|
get_current_index () == 0);
|
||||||
|
|
||||||
if (mc_panels_config->ini_path == NULL)
|
if (mc_global.panels_config->ini_path == NULL)
|
||||||
mc_panels_config->ini_path = g_strdup (panels_profile_name);
|
mc_global.panels_config->ini_path = g_strdup (panels_profile_name);
|
||||||
|
|
||||||
mc_config_del_group (mc_panels_config, "Temporal:New Left Panel");
|
mc_config_del_group (mc_global.panels_config, "Temporal:New Left Panel");
|
||||||
mc_config_del_group (mc_panels_config, "Temporal:New Right Panel");
|
mc_config_del_group (mc_global.panels_config, "Temporal:New Right Panel");
|
||||||
|
|
||||||
mc_config_save_file (mc_panels_config, NULL);
|
mc_config_save_file (mc_global.panels_config, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
@ -1019,17 +1021,17 @@ load_setup (void)
|
|||||||
|
|
||||||
panels_profile_name = mc_config_get_full_path (MC_PANELS_FILE);
|
panels_profile_name = mc_config_get_full_path (MC_PANELS_FILE);
|
||||||
|
|
||||||
mc_main_config = mc_config_init (profile, FALSE);
|
mc_global.main_config = mc_config_init (profile, FALSE);
|
||||||
|
|
||||||
if (!exist_file (panels_profile_name))
|
if (!exist_file (panels_profile_name))
|
||||||
setup__move_panels_config_into_separate_file (profile);
|
setup__move_panels_config_into_separate_file (profile);
|
||||||
|
|
||||||
mc_panels_config = mc_config_init (panels_profile_name, FALSE);
|
mc_global.panels_config = mc_config_init (panels_profile_name, FALSE);
|
||||||
|
|
||||||
/* Load integer boolean options */
|
/* Load integer boolean options */
|
||||||
for (i = 0; int_options[i].opt_name != NULL; i++)
|
for (i = 0; int_options[i].opt_name != NULL; i++)
|
||||||
*int_options[i].opt_addr =
|
*int_options[i].opt_addr =
|
||||||
mc_config_get_int (mc_main_config, CONFIG_APP_SECTION, int_options[i].opt_name,
|
mc_config_get_int (mc_global.main_config, CONFIG_APP_SECTION, int_options[i].opt_name,
|
||||||
*int_options[i].opt_addr);
|
*int_options[i].opt_addr);
|
||||||
#ifndef USE_INTERNAL_EDIT
|
#ifndef USE_INTERNAL_EDIT
|
||||||
/* reset forced in case of build without internal editor */
|
/* reset forced in case of build without internal editor */
|
||||||
@ -1052,8 +1054,8 @@ load_setup (void)
|
|||||||
/* Load string options */
|
/* Load string options */
|
||||||
for (i = 0; str_options[i].opt_name != NULL; i++)
|
for (i = 0; str_options[i].opt_name != NULL; i++)
|
||||||
*str_options[i].opt_addr =
|
*str_options[i].opt_addr =
|
||||||
mc_config_get_string (mc_main_config, CONFIG_APP_SECTION, str_options[i].opt_name,
|
mc_config_get_string (mc_global.main_config, CONFIG_APP_SECTION,
|
||||||
str_options[i].opt_defval);
|
str_options[i].opt_name, str_options[i].opt_defval);
|
||||||
|
|
||||||
load_layout ();
|
load_layout ();
|
||||||
panels_load_options ();
|
panels_load_options ();
|
||||||
@ -1066,29 +1068,33 @@ load_setup (void)
|
|||||||
if (startup_left_mode != view_listing && startup_right_mode != view_listing)
|
if (startup_left_mode != view_listing && startup_right_mode != view_listing)
|
||||||
startup_left_mode = view_listing;
|
startup_left_mode = view_listing;
|
||||||
|
|
||||||
boot_current_is_left = mc_config_get_bool (mc_panels_config, "Dirs", "current_is_left", TRUE);
|
boot_current_is_left =
|
||||||
|
mc_config_get_bool (mc_global.panels_config, "Dirs", "current_is_left", TRUE);
|
||||||
|
|
||||||
/* Load time formats */
|
/* Load time formats */
|
||||||
user_recent_timeformat =
|
user_recent_timeformat =
|
||||||
mc_config_get_string (mc_main_config, CONFIG_MISC_SECTION, "timeformat_recent", FMTTIME);
|
mc_config_get_string (mc_global.main_config, CONFIG_MISC_SECTION, "timeformat_recent",
|
||||||
|
FMTTIME);
|
||||||
user_old_timeformat =
|
user_old_timeformat =
|
||||||
mc_config_get_string (mc_main_config, CONFIG_MISC_SECTION, "timeformat_old", FMTYEAR);
|
mc_config_get_string (mc_global.main_config, CONFIG_MISC_SECTION, "timeformat_old",
|
||||||
|
FMTYEAR);
|
||||||
|
|
||||||
#ifdef ENABLE_VFS_FTP
|
#ifdef ENABLE_VFS_FTP
|
||||||
ftpfs_proxy_host =
|
ftpfs_proxy_host =
|
||||||
mc_config_get_string (mc_main_config, CONFIG_MISC_SECTION, "ftp_proxy_host", "gate");
|
mc_config_get_string (mc_global.main_config, CONFIG_MISC_SECTION, "ftp_proxy_host", "gate");
|
||||||
ftpfs_ignore_chattr_errors =
|
ftpfs_ignore_chattr_errors =
|
||||||
mc_config_get_bool (mc_main_config, CONFIG_APP_SECTION, "ignore_ftp_chattr_errors", TRUE);
|
mc_config_get_bool (mc_global.main_config, CONFIG_APP_SECTION, "ignore_ftp_chattr_errors",
|
||||||
|
TRUE);
|
||||||
ftpfs_init_passwd ();
|
ftpfs_init_passwd ();
|
||||||
#endif /* ENABLE_VFS_FTP */
|
#endif /* ENABLE_VFS_FTP */
|
||||||
|
|
||||||
/* The default color and the terminal dependent color */
|
/* The default color and the terminal dependent color */
|
||||||
mc_global.tty.setup_color_string =
|
mc_global.tty.setup_color_string =
|
||||||
mc_config_get_string (mc_main_config, "Colors", "base_color", "");
|
mc_config_get_string (mc_global.main_config, "Colors", "base_color", "");
|
||||||
mc_global.tty.term_color_string =
|
mc_global.tty.term_color_string =
|
||||||
mc_config_get_string (mc_main_config, "Colors", getenv ("TERM"), "");
|
mc_config_get_string (mc_global.main_config, "Colors", getenv ("TERM"), "");
|
||||||
mc_global.tty.color_terminal_string =
|
mc_global.tty.color_terminal_string =
|
||||||
mc_config_get_string (mc_main_config, "Colors", "color_terminals", "");
|
mc_config_get_string (mc_global.main_config, "Colors", "color_terminals", "");
|
||||||
|
|
||||||
/* Load the directory history */
|
/* Load the directory history */
|
||||||
/* directory_history_load (); */
|
/* directory_history_load (); */
|
||||||
@ -1097,14 +1103,18 @@ load_setup (void)
|
|||||||
#ifdef HAVE_CHARSET
|
#ifdef HAVE_CHARSET
|
||||||
if (codepages->len > 1)
|
if (codepages->len > 1)
|
||||||
{
|
{
|
||||||
buffer = mc_config_get_string (mc_main_config, CONFIG_MISC_SECTION, "display_codepage", "");
|
buffer =
|
||||||
|
mc_config_get_string (mc_global.main_config, CONFIG_MISC_SECTION, "display_codepage",
|
||||||
|
"");
|
||||||
if (buffer[0] != '\0')
|
if (buffer[0] != '\0')
|
||||||
{
|
{
|
||||||
mc_global.display_codepage = get_codepage_index (buffer);
|
mc_global.display_codepage = get_codepage_index (buffer);
|
||||||
cp_display = get_codepage_id (mc_global.display_codepage);
|
cp_display = get_codepage_id (mc_global.display_codepage);
|
||||||
}
|
}
|
||||||
g_free (buffer);
|
g_free (buffer);
|
||||||
buffer = mc_config_get_string (mc_main_config, CONFIG_MISC_SECTION, "source_codepage", "");
|
buffer =
|
||||||
|
mc_config_get_string (mc_global.main_config, CONFIG_MISC_SECTION, "source_codepage",
|
||||||
|
"");
|
||||||
if (buffer[0] != '\0')
|
if (buffer[0] != '\0')
|
||||||
{
|
{
|
||||||
default_source_codepage = get_codepage_index (buffer);
|
default_source_codepage = get_codepage_index (buffer);
|
||||||
@ -1115,7 +1125,7 @@ load_setup (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
autodetect_codeset =
|
autodetect_codeset =
|
||||||
mc_config_get_string (mc_main_config, CONFIG_MISC_SECTION, "autodetect_codeset", "");
|
mc_config_get_string (mc_global.main_config, CONFIG_MISC_SECTION, "autodetect_codeset", "");
|
||||||
if ((autodetect_codeset[0] != '\0') && (strcmp (autodetect_codeset, "off") != 0))
|
if ((autodetect_codeset[0] != '\0') && (strcmp (autodetect_codeset, "off") != 0))
|
||||||
is_autodetect_codeset_enabled = TRUE;
|
is_autodetect_codeset_enabled = TRUE;
|
||||||
|
|
||||||
@ -1127,13 +1137,13 @@ load_setup (void)
|
|||||||
|
|
||||||
#ifdef HAVE_ASPELL
|
#ifdef HAVE_ASPELL
|
||||||
spell_language =
|
spell_language =
|
||||||
mc_config_get_string (mc_main_config, CONFIG_MISC_SECTION, "spell_language", "en");
|
mc_config_get_string (mc_global.main_config, CONFIG_MISC_SECTION, "spell_language", "en");
|
||||||
#endif /* HAVE_ASPELL */
|
#endif /* HAVE_ASPELL */
|
||||||
|
|
||||||
clipboard_store_path =
|
clipboard_store_path =
|
||||||
mc_config_get_string (mc_main_config, CONFIG_MISC_SECTION, "clipboard_store", "");
|
mc_config_get_string (mc_global.main_config, CONFIG_MISC_SECTION, "clipboard_store", "");
|
||||||
clipboard_paste_path =
|
clipboard_paste_path =
|
||||||
mc_config_get_string (mc_main_config, CONFIG_MISC_SECTION, "clipboard_paste", "");
|
mc_config_get_string (mc_global.main_config, CONFIG_MISC_SECTION, "clipboard_paste", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
@ -1161,34 +1171,34 @@ save_setup (gboolean save_options, gboolean save_panel_options)
|
|||||||
/* directory_history_save (); */
|
/* directory_history_save (); */
|
||||||
|
|
||||||
#ifdef ENABLE_VFS_FTP
|
#ifdef ENABLE_VFS_FTP
|
||||||
mc_config_set_string (mc_main_config, CONFIG_MISC_SECTION, "ftpfs_password",
|
mc_config_set_string (mc_global.main_config, CONFIG_MISC_SECTION, "ftpfs_password",
|
||||||
ftpfs_anonymous_passwd);
|
ftpfs_anonymous_passwd);
|
||||||
if (ftpfs_proxy_host)
|
if (ftpfs_proxy_host)
|
||||||
mc_config_set_string (mc_main_config, CONFIG_MISC_SECTION, "ftp_proxy_host",
|
mc_config_set_string (mc_global.main_config, CONFIG_MISC_SECTION, "ftp_proxy_host",
|
||||||
ftpfs_proxy_host);
|
ftpfs_proxy_host);
|
||||||
#endif /* ENABLE_VFS_FTP */
|
#endif /* ENABLE_VFS_FTP */
|
||||||
|
|
||||||
#ifdef HAVE_CHARSET
|
#ifdef HAVE_CHARSET
|
||||||
mc_config_set_string (mc_main_config, CONFIG_MISC_SECTION, "display_codepage",
|
mc_config_set_string (mc_global.main_config, CONFIG_MISC_SECTION, "display_codepage",
|
||||||
get_codepage_id (mc_global.display_codepage));
|
get_codepage_id (mc_global.display_codepage));
|
||||||
mc_config_set_string (mc_main_config, CONFIG_MISC_SECTION, "source_codepage",
|
mc_config_set_string (mc_global.main_config, CONFIG_MISC_SECTION, "source_codepage",
|
||||||
get_codepage_id (default_source_codepage));
|
get_codepage_id (default_source_codepage));
|
||||||
mc_config_set_string (mc_main_config, CONFIG_MISC_SECTION, "autodetect_codeset",
|
mc_config_set_string (mc_global.main_config, CONFIG_MISC_SECTION, "autodetect_codeset",
|
||||||
autodetect_codeset);
|
autodetect_codeset);
|
||||||
#endif /* HAVE_CHARSET */
|
#endif /* HAVE_CHARSET */
|
||||||
|
|
||||||
#ifdef HAVE_ASPELL
|
#ifdef HAVE_ASPELL
|
||||||
mc_config_set_string (mc_main_config, CONFIG_MISC_SECTION, "spell_language",
|
mc_config_set_string (mc_global.main_config, CONFIG_MISC_SECTION, "spell_language",
|
||||||
spell_language);
|
spell_language);
|
||||||
#endif /* HAVE_ASPELL */
|
#endif /* HAVE_ASPELL */
|
||||||
|
|
||||||
mc_config_set_string (mc_main_config, CONFIG_MISC_SECTION, "clipboard_store",
|
mc_config_set_string (mc_global.main_config, CONFIG_MISC_SECTION, "clipboard_store",
|
||||||
clipboard_store_path);
|
clipboard_store_path);
|
||||||
mc_config_set_string (mc_main_config, CONFIG_MISC_SECTION, "clipboard_paste",
|
mc_config_set_string (mc_global.main_config, CONFIG_MISC_SECTION, "clipboard_paste",
|
||||||
clipboard_paste_path);
|
clipboard_paste_path);
|
||||||
|
|
||||||
tmp_profile = mc_config_get_full_path (MC_CONFIG_FILE);
|
tmp_profile = mc_config_get_full_path (MC_CONFIG_FILE);
|
||||||
ret = mc_config_save_to_file (mc_main_config, tmp_profile, NULL);
|
ret = mc_config_save_to_file (mc_global.main_config, tmp_profile, NULL);
|
||||||
g_free (tmp_profile);
|
g_free (tmp_profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1212,8 +1222,8 @@ done_setup (void)
|
|||||||
g_free (mc_global.tty.setup_color_string);
|
g_free (mc_global.tty.setup_color_string);
|
||||||
g_free (profile_name);
|
g_free (profile_name);
|
||||||
g_free (panels_profile_name);
|
g_free (panels_profile_name);
|
||||||
mc_config_deinit (mc_main_config);
|
mc_config_deinit (mc_global.main_config);
|
||||||
mc_config_deinit (mc_panels_config);
|
mc_config_deinit (mc_global.panels_config);
|
||||||
|
|
||||||
g_free (user_recent_timeformat);
|
g_free (user_recent_timeformat);
|
||||||
g_free (user_old_timeformat);
|
g_free (user_old_timeformat);
|
||||||
@ -1269,8 +1279,8 @@ load_key_defs (void)
|
|||||||
mc_config_deinit (mc_global_config);
|
mc_config_deinit (mc_global_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
load_keys_from_section ("general", mc_main_config);
|
load_keys_from_section ("general", mc_global.main_config);
|
||||||
load_keys_from_section (getenv ("TERM"), mc_main_config);
|
load_keys_from_section (getenv ("TERM"), mc_global.main_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
@ -1281,7 +1291,8 @@ load_anon_passwd (void)
|
|||||||
{
|
{
|
||||||
char *buffer;
|
char *buffer;
|
||||||
|
|
||||||
buffer = mc_config_get_string (mc_main_config, CONFIG_MISC_SECTION, "ftpfs_password", "");
|
buffer =
|
||||||
|
mc_config_get_string (mc_global.main_config, CONFIG_MISC_SECTION, "ftpfs_password", "");
|
||||||
|
|
||||||
if ((buffer != NULL) && (buffer[0] != '\0'))
|
if ((buffer != NULL) && (buffer[0] != '\0'))
|
||||||
return buffer;
|
return buffer;
|
||||||
@ -1413,14 +1424,15 @@ panel_load_setup (WPanel * panel, const char *section)
|
|||||||
size_t i;
|
size_t i;
|
||||||
char *buffer, buffer2[BUF_TINY];
|
char *buffer, buffer2[BUF_TINY];
|
||||||
|
|
||||||
panel->sort_info.reverse = mc_config_get_int (mc_panels_config, section, "reverse", 0);
|
panel->sort_info.reverse = mc_config_get_int (mc_global.panels_config, section, "reverse", 0);
|
||||||
panel->sort_info.case_sensitive =
|
panel->sort_info.case_sensitive =
|
||||||
mc_config_get_int (mc_panels_config, section, "case_sensitive",
|
mc_config_get_int (mc_global.panels_config, section, "case_sensitive",
|
||||||
OS_SORT_CASE_SENSITIVE_DEFAULT);
|
OS_SORT_CASE_SENSITIVE_DEFAULT);
|
||||||
panel->sort_info.exec_first = mc_config_get_int (mc_panels_config, section, "exec_first", 0);
|
panel->sort_info.exec_first =
|
||||||
|
mc_config_get_int (mc_global.panels_config, section, "exec_first", 0);
|
||||||
|
|
||||||
/* Load sort order */
|
/* Load sort order */
|
||||||
buffer = mc_config_get_string (mc_panels_config, section, "sort_order", "name");
|
buffer = mc_config_get_string (mc_global.panels_config, section, "sort_order", "name");
|
||||||
panel->sort_field = panel_get_field_by_id (buffer);
|
panel->sort_field = panel_get_field_by_id (buffer);
|
||||||
if (panel->sort_field == NULL)
|
if (panel->sort_field == NULL)
|
||||||
panel->sort_field = panel_get_field_by_id ("name");
|
panel->sort_field = panel_get_field_by_id ("name");
|
||||||
@ -1428,7 +1440,7 @@ panel_load_setup (WPanel * panel, const char *section)
|
|||||||
g_free (buffer);
|
g_free (buffer);
|
||||||
|
|
||||||
/* Load the listing mode */
|
/* Load the listing mode */
|
||||||
buffer = mc_config_get_string (mc_panels_config, section, "list_mode", "full");
|
buffer = mc_config_get_string (mc_global.panels_config, section, "list_mode", "full");
|
||||||
panel->list_type = list_full;
|
panel->list_type = list_full;
|
||||||
for (i = 0; list_types[i].key != NULL; i++)
|
for (i = 0; list_types[i].key != NULL; i++)
|
||||||
if (g_ascii_strcasecmp (list_types[i].key, buffer) == 0)
|
if (g_ascii_strcasecmp (list_types[i].key, buffer) == 0)
|
||||||
@ -1438,22 +1450,23 @@ panel_load_setup (WPanel * panel, const char *section)
|
|||||||
}
|
}
|
||||||
g_free (buffer);
|
g_free (buffer);
|
||||||
|
|
||||||
panel->brief_cols = mc_config_get_int (mc_panels_config, section, "brief_cols", 2);
|
panel->brief_cols = mc_config_get_int (mc_global.panels_config, section, "brief_cols", 2);
|
||||||
|
|
||||||
/* User formats */
|
/* User formats */
|
||||||
g_free (panel->user_format);
|
g_free (panel->user_format);
|
||||||
panel->user_format =
|
panel->user_format =
|
||||||
mc_config_get_string (mc_panels_config, section, "user_format", DEFAULT_USER_FORMAT);
|
mc_config_get_string (mc_global.panels_config, section, "user_format", DEFAULT_USER_FORMAT);
|
||||||
|
|
||||||
for (i = 0; i < LIST_TYPES; i++)
|
for (i = 0; i < LIST_TYPES; i++)
|
||||||
{
|
{
|
||||||
g_free (panel->user_status_format[i]);
|
g_free (panel->user_status_format[i]);
|
||||||
g_snprintf (buffer2, sizeof (buffer2), "user_status%lld", (long long) i);
|
g_snprintf (buffer2, sizeof (buffer2), "user_status%lld", (long long) i);
|
||||||
panel->user_status_format[i] =
|
panel->user_status_format[i] =
|
||||||
mc_config_get_string (mc_panels_config, section, buffer2, DEFAULT_USER_FORMAT);
|
mc_config_get_string (mc_global.panels_config, section, buffer2, DEFAULT_USER_FORMAT);
|
||||||
}
|
}
|
||||||
|
|
||||||
panel->user_mini_status = mc_config_get_int (mc_panels_config, section, "user_mini_status", 0);
|
panel->user_mini_status =
|
||||||
|
mc_config_get_int (mc_global.panels_config, section, "user_mini_status", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
@ -1464,31 +1477,33 @@ panel_save_setup (WPanel * panel, const char *section)
|
|||||||
char buffer[BUF_TINY];
|
char buffer[BUF_TINY];
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
mc_config_set_int (mc_panels_config, section, "reverse", panel->sort_info.reverse);
|
mc_config_set_int (mc_global.panels_config, section, "reverse", panel->sort_info.reverse);
|
||||||
mc_config_set_int (mc_panels_config, section, "case_sensitive",
|
mc_config_set_int (mc_global.panels_config, section, "case_sensitive",
|
||||||
panel->sort_info.case_sensitive);
|
panel->sort_info.case_sensitive);
|
||||||
mc_config_set_int (mc_panels_config, section, "exec_first", panel->sort_info.exec_first);
|
mc_config_set_int (mc_global.panels_config, section, "exec_first", panel->sort_info.exec_first);
|
||||||
|
|
||||||
mc_config_set_string (mc_panels_config, section, "sort_order", panel->sort_field->id);
|
mc_config_set_string (mc_global.panels_config, section, "sort_order", panel->sort_field->id);
|
||||||
|
|
||||||
for (i = 0; list_types[i].key != NULL; i++)
|
for (i = 0; list_types[i].key != NULL; i++)
|
||||||
if (list_types[i].list_type == (int) panel->list_type)
|
if (list_types[i].list_type == (int) panel->list_type)
|
||||||
{
|
{
|
||||||
mc_config_set_string (mc_panels_config, section, "list_mode", list_types[i].key);
|
mc_config_set_string (mc_global.panels_config, section, "list_mode", list_types[i].key);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
mc_config_set_int (mc_panels_config, section, "brief_cols", panel->brief_cols);
|
mc_config_set_int (mc_global.panels_config, section, "brief_cols", panel->brief_cols);
|
||||||
|
|
||||||
mc_config_set_string (mc_panels_config, section, "user_format", panel->user_format);
|
mc_config_set_string (mc_global.panels_config, section, "user_format", panel->user_format);
|
||||||
|
|
||||||
for (i = 0; i < LIST_TYPES; i++)
|
for (i = 0; i < LIST_TYPES; i++)
|
||||||
{
|
{
|
||||||
g_snprintf (buffer, sizeof (buffer), "user_status%lld", (long long) i);
|
g_snprintf (buffer, sizeof (buffer), "user_status%lld", (long long) i);
|
||||||
mc_config_set_string (mc_panels_config, section, buffer, panel->user_status_format[i]);
|
mc_config_set_string (mc_global.panels_config, section, buffer,
|
||||||
|
panel->user_status_format[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
mc_config_set_int (mc_panels_config, section, "user_mini_status", panel->user_mini_status);
|
mc_config_set_int (mc_global.panels_config, section, "user_mini_status",
|
||||||
|
panel->user_mini_status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -35,8 +35,6 @@
|
|||||||
|
|
||||||
#include "src/vfs/local/local.c"
|
#include "src/vfs/local/local.c"
|
||||||
|
|
||||||
const char *mc_config_get_home_dir (void);
|
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
/* @Mock */
|
/* @Mock */
|
||||||
|
@ -32,8 +32,6 @@
|
|||||||
|
|
||||||
#include "src/vfs/local/local.c"
|
#include "src/vfs/local/local.c"
|
||||||
|
|
||||||
const char *mc_config_get_home_dir (void);
|
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
/* @Mock */
|
/* @Mock */
|
||||||
|
Loading…
Reference in New Issue
Block a user