1
1

setup: split integer and boolean options.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Этот коммит содержится в:
Andrew Borodin 2016-11-25 10:39:08 +03:00
родитель c4550374b2
Коммит 8b14798cc4
19 изменённых файлов: 110 добавлений и 84 удалений

Просмотреть файл

@ -60,8 +60,8 @@ mc_global_t mc_global = {
.source_codepage = -1,
.display_codepage = -1,
#else
.eight_bit_clean = 1,
.full_eight_bits = 0,
.eight_bit_clean = TRUE,
.full_eight_bits = FALSE,
#endif /* !HAVE_CHARSET */
.utf8_display = FALSE,

Просмотреть файл

@ -177,12 +177,12 @@ typedef struct
int display_codepage;
#else
/* If true, allow characters in the range 160-255 */
int eight_bit_clean;
gboolean eight_bit_clean;
/*
* If true, also allow characters in the range 128-159.
* This is reported to break on many terminals (xterm, qansi-m).
*/
int full_eight_bits;
gboolean full_eight_bits;
#endif /* !HAVE_CHARSET */
/*
* If utf-8 terminal utf8_display = TRUE

Просмотреть файл

@ -62,10 +62,10 @@ hook_t *idle_hook = NULL;
/* If set then dialogs just clean the screen when refreshing, else */
/* they do a complete refresh, refreshing all the parts of the program */
int fast_refresh = 0;
gboolean fast_refresh = FALSE;
/* left click outside of dialog closes it */
int mouse_close_dialog = 0;
gboolean mouse_close_dialog = FALSE;
const global_keymap_t *dialog_map = NULL;

Просмотреть файл

@ -96,8 +96,8 @@ extern GList *top_dlg;
/* A hook list for idle events */
extern hook_t *idle_hook;
extern int fast_refresh;
extern int mouse_close_dialog;
extern gboolean fast_refresh;
extern gboolean mouse_close_dialog;
extern const global_keymap_t *dialog_map;

Просмотреть файл

@ -76,8 +76,8 @@
/*** global variables ****************************************************************************/
int option_word_wrap_line_length = DEFAULT_WRAP_LINE_LENGTH;
int option_typewriter_wrap = 0;
int option_auto_para_formatting = 0;
gboolean option_typewriter_wrap = FALSE;
gboolean option_auto_para_formatting = FALSE;
gboolean option_fill_tabs_with_spaces = FALSE;
gboolean option_return_does_auto_indent = TRUE;
gboolean option_backspace_through_tabs = FALSE;
@ -87,15 +87,15 @@ gboolean option_save_position = TRUE;
int option_max_undo = 32768;
gboolean option_persistent_selections = TRUE;
gboolean option_cursor_beyond_eol = FALSE;
int option_line_state = 0;
gboolean option_line_state = FALSE;
int option_line_state_width = 0;
gboolean option_cursor_after_inserted_block = FALSE;
int option_state_full_filename = 0;
gboolean option_state_full_filename = FALSE;
gboolean enable_show_tabs_tws = TRUE;
gboolean option_check_nl_at_eof = FALSE;
gboolean option_group_undo = FALSE;
int show_right_margin = 0;
gboolean show_right_margin = FALSE;
char *option_backup_ext = NULL;
char *option_filesize_threshold = NULL;

Просмотреть файл

@ -31,18 +31,18 @@ typedef struct WEdit WEdit;
/*** global variables defined in .c file *********************************************************/
extern int option_word_wrap_line_length;
extern int option_typewriter_wrap;
extern int option_auto_para_formatting;
extern gboolean option_typewriter_wrap;
extern gboolean option_auto_para_formatting;
extern gboolean option_fill_tabs_with_spaces;
extern gboolean option_return_does_auto_indent;
extern gboolean option_backspace_through_tabs;
extern gboolean option_fake_half_tabs;
extern gboolean option_persistent_selections;
extern int option_drop_selection_on_copy;
extern gboolean option_drop_selection_on_copy;
extern gboolean option_cursor_beyond_eol;
extern gboolean option_cursor_after_inserted_block;
extern int option_state_full_filename;
extern int option_line_state;
extern gboolean option_state_full_filename;
extern gboolean option_line_state;
extern int option_save_mode;
extern gboolean option_save_position;
extern gboolean option_syntax_highlighting;
@ -56,9 +56,9 @@ extern gboolean edit_confirm_save;
extern gboolean visible_tabs;
extern gboolean visible_tws;
extern int simple_statusbar;
extern gboolean simple_statusbar;
extern gboolean option_check_nl_at_eof;
extern int show_right_margin;
extern gboolean show_right_margin;
/*** declarations of public functions ************************************************************/

Просмотреть файл

@ -87,7 +87,7 @@ int search_create_bookmark = FALSE;
gboolean edit_confirm_save = TRUE;
/* whether we need to drop selection on copy to buffer */
int option_drop_selection_on_copy = 1;
gboolean option_drop_selection_on_copy = TRUE;
/*** file scope macro definitions ****************************************************************/

Просмотреть файл

@ -61,7 +61,7 @@
/*** global variables ****************************************************************************/
/* Toggles statusbar draw style */
int simple_statusbar = 0;
gboolean simple_statusbar = FALSE;
gboolean visible_tws = TRUE;
gboolean visible_tabs = TRUE;

Просмотреть файл

@ -217,18 +217,18 @@ edit_options_dialog (WDialog * h)
if (wrap_mode == 1)
{
option_auto_para_formatting = 1;
option_typewriter_wrap = 0;
option_auto_para_formatting = TRUE;
option_typewriter_wrap = FALSE;
}
else if (wrap_mode == 2)
{
option_auto_para_formatting = 0;
option_typewriter_wrap = 1;
option_auto_para_formatting = FALSE;
option_typewriter_wrap = TRUE;
}
else
{
option_auto_para_formatting = 0;
option_typewriter_wrap = 0;
option_auto_para_formatting = FALSE;
option_typewriter_wrap = FALSE;
}
/* Load or unload syntax rules if the option has changed */

Просмотреть файл

@ -289,7 +289,7 @@ filegui__check_attrs_on_fs (const char *fs_path)
{
STRUCT_STATVFS stfs;
if (!setup_copymove_persistent_attr)
if (!copymove_persistent_attr)
return FALSE;
#if USE_STATVFS && defined(STAT_STATVFS)

Просмотреть файл

@ -862,7 +862,7 @@ setup_mc (void)
#ifdef HAVE_CHARSET
tty_display_8bit (TRUE);
#else
tty_display_8bit (mc_global.full_eight_bits != 0);
tty_display_8bit (mc_global.full_eight_bits);
#endif /* HAVE_CHARSET */
#else /* HAVE_SLANG */
@ -870,7 +870,7 @@ setup_mc (void)
#ifdef HAVE_CHARSET
tty_display_8bit (TRUE);
#else
tty_display_8bit (mc_global.eight_bit_clean != 0);
tty_display_8bit (mc_global.eight_bit_clean);
#endif /* HAVE_CHARSET */
#endif /* HAVE_SLANG */

Просмотреть файл

@ -78,7 +78,7 @@ WTree *the_tree = NULL;
* automatically reload it's directory with the contents of the currently
* selected directory.
*/
int xtree_mode = 0;
gboolean xtree_mode = FALSE;
/*** file scope macro definitions ****************************************************************/

Просмотреть файл

@ -18,7 +18,7 @@ typedef struct WTree WTree;
/*** global variables defined in .c file *********************************************************/
extern WTree *the_tree;
extern int xtree_mode;
extern gboolean xtree_mode;
/*** declarations of public functions ************************************************************/

Просмотреть файл

@ -89,7 +89,7 @@ gboolean boot_current_is_left = TRUE;
gboolean safe_delete = FALSE;
/* Controls screen clearing before an exec */
int clear_before_exec = 1;
gboolean clear_before_exec = TRUE;
/* Asks for confirmation before deleting a file */
gboolean confirm_delete = TRUE;
@ -109,7 +109,7 @@ gboolean drop_menus = FALSE;
/* Asks for confirmation when using F3 to view a directory and there
are tagged files */
int confirm_view_dir = 0;
gboolean confirm_view_dir = FALSE;
/* Ask file name before start the editor */
gboolean editor_ask_filename_before_edit = FALSE;
@ -117,7 +117,7 @@ gboolean editor_ask_filename_before_edit = FALSE;
panel_view_mode_t startup_left_mode;
panel_view_mode_t startup_right_mode;
int setup_copymove_persistent_attr = 1;
gboolean copymove_persistent_attr = TRUE;
/* Tab size */
int option_tab_spacing = DEFAULT_TAB_SPACING;
@ -156,16 +156,16 @@ gboolean auto_save_setup = TRUE;
/* If true, then the +, - and \ keys have their special meaning only if the
* command line is emtpy, otherwise they behave like regular letters
*/
int only_leading_plus_minus = 1;
gboolean only_leading_plus_minus = TRUE;
/* Automatically fills name with current selected item name on mkdir */
gboolean auto_fill_mkdir_name = TRUE;
/* If set and you don't have subshell support,then C-o will give you a shell */
int output_starts_shell = 0;
gboolean output_starts_shell = FALSE;
/* If set, we execute the file command to check the file type */
int use_file_to_check_type = 1;
gboolean use_file_to_check_type = TRUE;
gboolean verbose = TRUE;
@ -275,10 +275,9 @@ static const struct
static const struct
{
const char *opt_name;
int *opt_addr;
} int_options [] = {
gboolean *opt_addr;
} bool_options [] = {
{ "verbose", &verbose },
{ "pause_after_run", &pause_after_run },
{ "shell_patterns", &easy_patterns },
{ "auto_save_setup", &auto_save_setup },
{ "preallocate_space", &mc_global.vfs.preallocate_space },
@ -292,58 +291,43 @@ static const struct
{ "confirm_history_cleanup", &mc_global.widget.confirm_history_cleanup },
{ "confirm_exit", &confirm_exit },
{ "confirm_directory_hotlist_delete", &confirm_directory_hotlist_delete },
{ "confirm_view_dir", &confirm_view_dir },
{ "safe_delete", &safe_delete },
{ "mouse_repeat_rate", &mou_auto_repeat },
{ "double_click_speed", &double_click_speed },
#ifndef HAVE_CHARSET
{ "eight_bit_clean", &mc_global.eight_bit_clean },
{ "full_eight_bits", &mc_global.full_eight_bits },
#endif /* !HAVE_CHARSET */
{ "use_8th_bit_as_meta", &use_8th_bit_as_meta },
{ "confirm_view_dir", &confirm_view_dir },
{ "mouse_move_pages_viewer", &mcview_mouse_move_pages },
{ "mouse_close_dialog", &mouse_close_dialog},
{ "fast_refresh", &fast_refresh },
{ "drop_menus", &drop_menus },
{ "wrap_mode", &mcview_global_wrap_mode},
{ "wrap_mode", &mcview_global_wrap_mode },
{ "old_esc_mode", &old_esc_mode },
{ "old_esc_mode_timeout", &old_esc_mode_timeout },
{ "cd_symlinks", &mc_global.vfs.cd_symlinks },
{ "show_all_if_ambiguous", &mc_global.widget.show_all_if_ambiguous },
{ "max_dirt_limit", &mcview_max_dirt_limit },
{ "use_file_to_guess_type", &use_file_to_check_type },
{ "alternate_plus_minus", &mc_global.tty.alternate_plus_minus },
{ "only_leading_plus_minus", &only_leading_plus_minus },
{ "show_output_starts_shell", &output_starts_shell },
{ "xtree_mode", &xtree_mode },
{ "num_history_items_recorded", &num_history_items_recorded },
{ "file_op_compute_totals", &file_op_compute_totals },
{ "classic_progressbar", &classic_progressbar},
{ "classic_progressbar", &classic_progressbar },
#ifdef ENABLE_VFS
{ "vfs_timeout", &vfs_timeout },
#ifdef ENABLE_VFS_FTP
{ "ftpfs_directory_timeout", &ftpfs_directory_timeout },
{ "use_netrc", &ftpfs_use_netrc },
{ "ftpfs_retry_seconds", &ftpfs_retry_seconds },
{ "ftpfs_always_use_proxy", &ftpfs_always_use_proxy },
{ "ftpfs_use_passive_connections", &ftpfs_use_passive_connections },
{ "ftpfs_use_passive_connections_over_proxy", &ftpfs_use_passive_connections_over_proxy },
{ "ftpfs_use_unix_list_options", &ftpfs_use_unix_list_options },
{ "ftpfs_first_cd_then_ls", &ftpfs_first_cd_then_ls },
#endif /* ENABLE_VFS_FTP */
#ifdef ENABLE_VFS_FISH
{ "fish_directory_timeout", &fish_directory_timeout },
#endif /* ENABLE_VFS_FISH */
#endif /* ENABLE_VFS */
/* option_tab_spacing is used in internal viewer */
{ "editor_tab_spacing", &option_tab_spacing },
#ifdef USE_INTERNAL_EDIT
{ "editor_word_wrap_line_length", &option_word_wrap_line_length },
{ "editor_fill_tabs_with_spaces", &option_fill_tabs_with_spaces },
{ "editor_return_does_auto_indent", &option_return_does_auto_indent },
{ "editor_backspace_through_tabs", &option_backspace_through_tabs },
{ "editor_fake_half_tabs", &option_fake_half_tabs },
{ "editor_option_save_mode", &option_save_mode },
{ "editor_option_save_position", &option_save_position },
{ "editor_option_auto_para_formatting", &option_auto_para_formatting },
{ "editor_option_typewriter_wrap", &option_typewriter_wrap },
@ -366,7 +350,37 @@ static const struct
{ "nice_rotating_dash", &nice_rotating_dash },
{ "mcview_remember_file_position", &mcview_remember_file_position },
{ "auto_fill_mkdir_name", &auto_fill_mkdir_name },
{ "copymove_persistent_attr", &setup_copymove_persistent_attr },
{ "copymove_persistent_attr", &copymove_persistent_attr },
{ NULL, NULL }
};
static const struct
{
const char *opt_name;
int *opt_addr;
} int_options [] = {
{ "pause_after_run", &pause_after_run },
{ "mouse_repeat_rate", &mou_auto_repeat },
{ "double_click_speed", &double_click_speed },
{ "old_esc_mode_timeout", &old_esc_mode_timeout },
{ "max_dirt_limit", &mcview_max_dirt_limit },
{ "num_history_items_recorded", &num_history_items_recorded },
#ifdef ENABLE_VFS
{ "vfs_timeout", &vfs_timeout },
#ifdef ENABLE_VFS_FTP
{ "ftpfs_directory_timeout", &ftpfs_directory_timeout },
{ "ftpfs_retry_seconds", &ftpfs_retry_seconds },
#endif /* ENABLE_VFS_FTP */
#ifdef ENABLE_VFS_FISH
{ "fish_directory_timeout", &fish_directory_timeout },
#endif /* ENABLE_VFS_FISH */
#endif /* ENABLE_VFS */
/* option_tab_spacing is used in internal viewer */
{ "editor_tab_spacing", &option_tab_spacing },
#ifdef USE_INTERNAL_EDIT
{ "editor_word_wrap_line_length", &option_word_wrap_line_length },
{ "editor_option_save_mode", &option_save_mode },
#endif /* USE_INTERNAL_EDIT */
{ NULL, NULL }
};
@ -885,6 +899,11 @@ save_config (void)
{
size_t i;
/* Save boolean options */
for (i = 0; bool_options[i].opt_name != NULL; i++)
mc_config_set_bool (mc_global.main_config, CONFIG_APP_SECTION, bool_options[i].opt_name,
*bool_options[i].opt_addr);
/* Save integer options */
for (i = 0; int_options[i].opt_name != NULL; i++)
mc_config_set_int (mc_global.main_config, CONFIG_APP_SECTION, int_options[i].opt_name,
@ -1030,11 +1049,18 @@ load_setup (void)
mc_global.panels_config = mc_config_init (panels_profile_name, FALSE);
/* Load integer boolean options */
/* Load boolean options */
for (i = 0; bool_options[i].opt_name != NULL; i++)
*bool_options[i].opt_addr =
mc_config_get_bool (mc_global.main_config, CONFIG_APP_SECTION, bool_options[i].opt_name,
*bool_options[i].opt_addr);
/* Load integer options */
for (i = 0; int_options[i].opt_name != NULL; i++)
*int_options[i].opt_addr =
mc_config_get_int (mc_global.main_config, CONFIG_APP_SECTION, int_options[i].opt_name,
*int_options[i].opt_addr);
#ifndef USE_INTERNAL_EDIT
/* reset forced in case of build without internal editor */
use_internal_edit = FALSE;

Просмотреть файл

@ -80,22 +80,22 @@ extern gboolean confirm_directory_hotlist_delete;
extern gboolean confirm_execute;
extern gboolean confirm_exit;
extern gboolean confirm_overwrite;
extern int confirm_view_dir;
extern gboolean confirm_view_dir;
extern gboolean safe_delete;
extern int clear_before_exec;
extern gboolean clear_before_exec;
extern gboolean auto_menu;
extern gboolean drop_menus;
extern gboolean verbose;
extern int setup_copymove_persistent_attr;
extern gboolean copymove_persistent_attr;
extern gboolean classic_progressbar;
extern gboolean easy_patterns;
extern int option_tab_spacing;
extern gboolean auto_save_setup;
extern int only_leading_plus_minus;
extern gboolean only_leading_plus_minus;
extern int cd_symlinks;
extern gboolean auto_fill_mkdir_name;
extern int output_starts_shell;
extern int use_file_to_check_type;
extern gboolean output_starts_shell;
extern gboolean use_file_to_check_type;
extern gboolean file_op_compute_totals;
extern gboolean editor_ask_filename_before_edit;

Просмотреть файл

@ -126,10 +126,10 @@ gboolean ftpfs_use_passive_connections_over_proxy = FALSE;
* fall back to CWD <path>; LIST
* 0: always use CWD <path>; LIST
*/
int ftpfs_use_unix_list_options = 1;
gboolean ftpfs_use_unix_list_options = TRUE;
/* First "CWD <path>", then "LIST -la ." */
int ftpfs_first_cd_then_ls = 1;
gboolean ftpfs_first_cd_then_ls = TRUE;
/* Use the ~/.netrc */
gboolean ftpfs_use_netrc = TRUE;
@ -144,7 +144,7 @@ char *ftpfs_proxy_host = NULL;
/* whether we have to use proxy by default? */
gboolean ftpfs_always_use_proxy = FALSE;
int ftpfs_ignore_chattr_errors = 1;
gboolean ftpfs_ignore_chattr_errors = TRUE;
/*** file scope macro definitions ****************************************************************/
@ -1694,7 +1694,7 @@ ftpfs_dir_load (struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path
struct vfs_s_entry *ent;
struct vfs_s_super *super = dir->super;
int sock, num_entries = 0;
int cd_first;
gboolean cd_first;
cd_first = ftpfs_first_cd_then_ls || (SUP->strict == RFC_STRICT)
|| (strchr (remote_path, ' ') != NULL);
@ -1790,7 +1790,7 @@ ftpfs_dir_load (struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path
if ((ftpfs_get_reply (me, SUP->sock, NULL, 0) != COMPLETE))
goto fallback;
if (num_entries == 0 && cd_first == 0)
if (num_entries == 0 && !cd_first)
{
/* The LIST command may produce an empty output. In such scenario
it is not clear whether this is caused by 'remote_path' being
@ -1802,7 +1802,7 @@ ftpfs_dir_load (struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path
to determine the type of 'remote_path'. The only reliable way to
achieve this is trough issuing a CWD command. */
cd_first = 1;
cd_first = TRUE;
goto again;
}
@ -1822,7 +1822,7 @@ ftpfs_dir_load (struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path
SUP->strict = RFC_STRICT;
/* I hate goto, but recursive call needs another 8K on stack */
/* return ftpfs_dir_load (me, dir, remote_path); */
cd_first = 1;
cd_first = TRUE;
goto again;
}
vfs_print_message ("%s", _("ftpfs: failed; nowhere to fallback to"));

Просмотреть файл

@ -25,13 +25,13 @@ extern char *ftpfs_anonymous_passwd;
extern char *ftpfs_proxy_host;
extern int ftpfs_directory_timeout;
extern gboolean ftpfs_always_use_proxy;
extern int ftpfs_ignore_chattr_errors;
extern gboolean ftpfs_ignore_chattr_errors;
extern int ftpfs_retry_seconds;
extern gboolean ftpfs_use_passive_connections;
extern gboolean ftpfs_use_passive_connections_over_proxy;
extern int ftpfs_use_unix_list_options;
extern int ftpfs_first_cd_then_ls;
extern gboolean ftpfs_use_unix_list_options;
extern gboolean ftpfs_first_cd_then_ls;
/*** declarations of public functions ************************************************************/

Просмотреть файл

@ -52,20 +52,20 @@
int mcview_default_hex_mode = 0;
int mcview_default_nroff_flag = 0;
int mcview_global_wrap_mode = 1;
gboolean mcview_global_wrap_mode = TRUE;
int mcview_default_magic_flag = 1;
int mcview_altered_hex_mode = 0;
int mcview_altered_magic_flag = 0;
int mcview_altered_nroff_flag = 0;
int mcview_remember_file_position = FALSE;
gboolean mcview_remember_file_position = FALSE;
/* Maxlimit for skipping updates */
int mcview_max_dirt_limit = 10;
/* Scrolling is done in pages or line increments */
int mcview_mouse_move_pages = 1;
gboolean mcview_mouse_move_pages = TRUE;
/* end of file will be showen from mcview_show_eof */
char *mcview_show_eof = NULL;

Просмотреть файл

@ -20,17 +20,17 @@ typedef struct WView WView;
extern int mcview_default_hex_mode;
extern int mcview_default_nroff_flag;
extern int mcview_global_wrap_mode;
extern gboolean mcview_global_wrap_mode;
extern int mcview_default_magic_flag;
extern int mcview_altered_hex_mode;
extern int mcview_altered_magic_flag;
extern int mcview_altered_nroff_flag;
extern int mcview_remember_file_position;
extern gboolean mcview_remember_file_position;
extern int mcview_max_dirt_limit;
extern int mcview_mouse_move_pages;
extern gboolean mcview_mouse_move_pages;
extern char *mcview_show_eof;
/*** declarations of public functions ************************************************************/