4 Copyright (C) 1994, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
5 2006, 2007, 2009, 2010, 2011
6 The Free Software Foundation, Inc.
8 This file is part of the Midnight Commander.
10 The Midnight Commander is free software: you can redistribute it
11 and/or modify it under the terms of the GNU General Public License as
12 published by the Free Software Foundation, either version 3 of the License,
13 or (at your option) any later version.
15 The Midnight Commander is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program. If not, see <http://www.gnu.org/licenses/>.
25 * \brief Source: setup loading/saving
33 #include <sys/types.h>
36 #include "lib/global.h"
38 #include "lib/tty/tty.h"
39 #include "lib/tty/key.h"
40 #include "lib/mcconfig.h"
41 #include "lib/fileloc.h"
42 #include "lib/timefmt.h"
44 #include "lib/widget.h"
46 #include "lib/vfs/vfs.h"
49 #include "src/vfs/ftpfs/ftpfs.h"
51 #ifdef ENABLE_VFS_FISH
52 #include "src/vfs/fish/fish.h"
56 #include "lib/charsets.h"
59 #include "filemanager/dir.h"
60 #include "filemanager/midnight.h"
61 #include "filemanager/tree.h" /* xtree_mode */
62 #include "filemanager/hotlist.h" /* load/save/done hotlist */
63 #include "filemanager/panelize.h" /* load/save/done panelize */
64 #include "filemanager/layout.h"
65 #include "filemanager/cmd.h"
68 #include "execute.h" /* pause_after_run */
69 #include "clipboard.h"
70 #include "keybind-defaults.h" /* keybind_lookup_action */
73 #include "selcodepage.h"
76 #ifdef USE_INTERNAL_EDIT
77 #include "src/editor/edit.h"
80 #include "src/viewer/mcviewer.h" /* For the externs */
84 /*** global variables ****************************************************************************/
86 char *profile_name
; /* ${XDG_CONFIG_HOME}/mc/ini */
87 char *global_profile_name
; /* mc.lib */
89 /* Only used at program boot */
90 gboolean boot_current_is_left
= TRUE
;
92 /* If on, default for "No" in delete operations */
95 /* Controls screen clearing before an exec */
96 int clear_before_exec
= 1;
98 /* Asks for confirmation before deleting a file */
99 int confirm_delete
= 1;
100 /* Asks for confirmation before deleting a hotlist entry */
101 int confirm_directory_hotlist_delete
= 1;
102 /* Asks for confirmation before overwriting a file */
103 int confirm_overwrite
= 1;
104 /* Asks for confirmation before executing a program by pressing enter */
105 int confirm_execute
= 0;
106 /* Asks for confirmation before leaving the program */
107 int confirm_exit
= 1;
109 /* If true, at startup the user-menu is invoked */
111 /* This flag indicates if the pull down menus by default drop down */
114 /* Asks for confirmation when using F3 to view a directory and there
116 int confirm_view_dir
= 0;
118 panel_view_mode_t startup_left_mode
;
119 panel_view_mode_t startup_right_mode
;
121 int setup_copymove_persistent_attr
= 1;
124 int option_tab_spacing
= DEFAULT_TAB_SPACING
;
126 /* Ugly hack to allow panel_save_setup to work as a place holder for */
127 /* default panel values */
130 panels_options_t panels_options
= {
131 .show_mini_info
= TRUE
,
132 .kilobyte_si
= FALSE
,
133 .mix_all_files
= FALSE
,
134 .show_backups
= TRUE
,
135 .show_dot_files
= TRUE
,
136 .fast_reload
= FALSE
,
137 .fast_reload_msg_shown
= FALSE
,
138 .mark_moves_down
= TRUE
,
139 .reverse_files_only
= TRUE
,
140 .auto_save_setup
= FALSE
,
141 .navigate_with_arrows
= FALSE
,
142 .scroll_pages
= TRUE
,
143 .mouse_move_pages
= TRUE
,
144 .filetype_mode
= TRUE
,
145 .permission_mode
= FALSE
,
146 .qsearch_mode
= QSEARCH_PANEL_CASE
,
147 .torben_fj_mode
= FALSE
150 int easy_patterns
= 1;
152 /* It true saves the setup when quitting */
153 int auto_save_setup
= 1;
155 /* If true, then the +, - and \ keys have their special meaning only if the
156 * command line is emtpy, otherwise they behave like regular letters
158 int only_leading_plus_minus
= 1;
160 /* Automatically fills name with current selected item name on mkdir */
161 int auto_fill_mkdir_name
= 1;
163 /* If set and you don't have subshell support,then C-o will give you a shell */
164 int output_starts_shell
= 0;
166 /* If set, we execute the file command to check the file type */
167 int use_file_to_check_type
= 1;
172 * Whether the Midnight Commander tries to provide more
173 * information about copy/move sizes and bytes transfered
174 * at the expense of some speed
176 int file_op_compute_totals
= 1;
178 /* If true use the internal viewer */
179 int use_internal_view
= 1;
180 /* If set, use the builtin editor */
181 int use_internal_edit
= 1;
184 /* Numbers of (file I/O) and (input/display) codepages. -1 if not selected */
185 int default_source_codepage
= -1;
186 char *autodetect_codeset
= NULL
;
187 gboolean is_autodetect_codeset_enabled
= FALSE
;
188 #endif /* !HAVE_CHARSET */
190 /* If set, then print to the given file the last directory we were at */
191 char *last_wd_string
= NULL
;
193 /* Set when main loop should be terminated */
196 /* The user's shell */
200 const char *mc_prompt
= NULL
;
202 /* Set to TRUE to suppress printing the last directory */
203 int print_last_revert
= FALSE
;
205 /* index to record_macro_buf[], -1 if not recording a macro */
206 int macro_index
= -1;
209 struct macro_action_t record_macro_buf
[MAX_MACRO_LENGTH
];
213 /*** file scope macro definitions ****************************************************************/
215 /* In order to use everywhere the same setup for the locale we use defines */
216 #define FMTYEAR _("%b %e %Y")
217 #define FMTTIME _("%b %e %H:%M")
219 /*** file scope type declarations ****************************************************************/
221 /*** file scope variables ************************************************************************/
223 static char *panels_profile_name
= NULL
; /* ${XDG_CACHE_HOME}/mc/panels.ini */
231 { "full", list_full
},
232 { "brief", list_brief
},
233 { "long", list_long
},
234 { "user", list_user
},
240 const char *opt_name
;
241 panel_view_mode_t opt_type
;
243 { "listing", view_listing
},
244 { "quickview", view_quick
},
245 { "info", view_info
},
246 { "tree", view_tree
},
247 { NULL
, view_listing
}
252 const char *opt_name
;
255 { "message_visible", &mc_global
.message_visible
},
256 { "keybar_visible", &mc_global
.keybar_visible
},
257 { "xterm_title", &xterm_title
},
258 { "output_lines", &output_lines
},
259 { "command_prompt", &command_prompt
},
260 { "menubar_visible", &menubar_visible
},
261 { "free_space", &free_space
},
262 { "horizontal_split", &panels_layout
.horizontal_split
},
263 { "vertical_equal", &panels_layout
.vertical_equal
},
264 { "left_panel_size", &panels_layout
.left_panel_size
},
265 { "horizontal_equal", &panels_layout
.horizontal_equal
},
266 { "top_panel_size", &panels_layout
.top_panel_size
},
272 const char *opt_name
;
275 { "verbose", &verbose
},
276 { "pause_after_run", &pause_after_run
},
277 { "shell_patterns", &easy_patterns
},
278 { "auto_save_setup", &auto_save_setup
},
279 { "preallocate_space", &mc_global
.vfs
.preallocate_space
},
280 { "auto_menu", &auto_menu
},
281 { "use_internal_view", &use_internal_view
},
282 { "use_internal_edit", &use_internal_edit
},
283 { "clear_before_exec", &clear_before_exec
},
284 { "confirm_delete", &confirm_delete
},
285 { "confirm_overwrite", &confirm_overwrite
},
286 { "confirm_execute", &confirm_execute
},
287 { "confirm_history_cleanup", &mc_global
.widget
.confirm_history_cleanup
},
288 { "confirm_exit", &confirm_exit
},
289 { "confirm_directory_hotlist_delete", &confirm_directory_hotlist_delete
},
290 { "safe_delete", &safe_delete
},
291 { "mouse_repeat_rate", &mou_auto_repeat
},
292 { "double_click_speed", &double_click_speed
},
294 { "eight_bit_clean", &mc_global
.eight_bit_clean
},
295 { "full_eight_bits", &mc_global
.full_eight_bits
},
296 #endif /* !HAVE_CHARSET */
297 { "use_8th_bit_as_meta", &use_8th_bit_as_meta
},
298 { "confirm_view_dir", &confirm_view_dir
},
299 { "mouse_move_pages_viewer", &mcview_mouse_move_pages
},
300 { "mouse_close_dialog", &mouse_close_dialog
},
301 { "fast_refresh", &fast_refresh
},
302 { "drop_menus", &drop_menus
},
303 { "wrap_mode", &mcview_global_wrap_mode
},
304 { "old_esc_mode", &old_esc_mode
},
305 { "old_esc_mode_timeout", &old_esc_mode_timeout
},
306 { "cd_symlinks", &mc_global
.vfs
.cd_symlinks
},
307 { "show_all_if_ambiguous", &mc_global
.widget
.show_all_if_ambiguous
},
308 { "max_dirt_limit", &mcview_max_dirt_limit
},
309 { "use_file_to_guess_type", &use_file_to_check_type
},
310 { "alternate_plus_minus", &mc_global
.tty
.alternate_plus_minus
},
311 { "only_leading_plus_minus", &only_leading_plus_minus
},
312 { "show_output_starts_shell", &output_starts_shell
},
313 { "xtree_mode", &xtree_mode
},
314 { "num_history_items_recorded", &num_history_items_recorded
},
315 { "file_op_compute_totals", &file_op_compute_totals
},
316 { "classic_progressbar", &classic_progressbar
},
318 { "vfs_timeout", &vfs_timeout
},
319 #ifdef ENABLE_VFS_FTP
320 { "ftpfs_directory_timeout", &ftpfs_directory_timeout
},
321 { "use_netrc", &ftpfs_use_netrc
},
322 { "ftpfs_retry_seconds", &ftpfs_retry_seconds
},
323 { "ftpfs_always_use_proxy", &ftpfs_always_use_proxy
},
324 { "ftpfs_use_passive_connections", &ftpfs_use_passive_connections
},
325 { "ftpfs_use_passive_connections_over_proxy", &ftpfs_use_passive_connections_over_proxy
},
326 { "ftpfs_use_unix_list_options", &ftpfs_use_unix_list_options
},
327 { "ftpfs_first_cd_then_ls", &ftpfs_first_cd_then_ls
},
328 #endif /* ENABLE_VFS_FTP */
329 #ifdef ENABLE_VFS_FISH
330 { "fish_directory_timeout", &fish_directory_timeout
},
331 #endif /* ENABLE_VFS_FISH */
332 #endif /* ENABLE_VFS */
333 /* option_tab_spacing is used in internal viewer */
334 { "editor_tab_spacing", &option_tab_spacing
},
335 #ifdef USE_INTERNAL_EDIT
336 { "editor_word_wrap_line_length", &option_word_wrap_line_length
},
337 { "editor_fill_tabs_with_spaces", &option_fill_tabs_with_spaces
},
338 { "editor_return_does_auto_indent", &option_return_does_auto_indent
},
339 { "editor_backspace_through_tabs", &option_backspace_through_tabs
},
340 { "editor_fake_half_tabs", &option_fake_half_tabs
},
341 { "editor_option_save_mode", &option_save_mode
},
342 { "editor_option_save_position", &option_save_position
},
343 { "editor_option_auto_para_formatting", &option_auto_para_formatting
},
344 { "editor_option_typewriter_wrap", &option_typewriter_wrap
},
345 { "editor_edit_confirm_save", &edit_confirm_save
},
346 { "editor_syntax_highlighting", &option_syntax_highlighting
},
347 { "editor_persistent_selections", &option_persistent_selections
},
348 { "editor_cursor_beyond_eol", &option_cursor_beyond_eol
},
349 { "editor_visible_tabs", &visible_tabs
},
350 { "editor_visible_spaces", &visible_tws
},
351 { "editor_line_state", &option_line_state
},
352 { "editor_simple_statusbar", &simple_statusbar
},
353 { "editor_check_new_line", &option_check_nl_at_eof
},
354 { "editor_show_right_margin", &show_right_margin
},
355 { "editor_group_undo", &option_group_undo
},
356 #endif /* USE_INTERNAL_EDIT */
357 { "nice_rotating_dash", &nice_rotating_dash
},
358 { "mcview_remember_file_position", &mcview_remember_file_position
},
359 { "auto_fill_mkdir_name", &auto_fill_mkdir_name
},
360 { "copymove_persistent_attr", &setup_copymove_persistent_attr
},
361 { "select_flags", &select_flags
},
367 const char *opt_name
;
369 const char *opt_defval
;
371 #ifdef USE_INTERNAL_EDIT
372 { "editor_backup_extension", &option_backup_ext
, "~" },
374 { "mcview_eof", &mcview_show_eof
, "" },
380 const char *opt_name
;
382 } panels_ini_options
[] = {
383 { "show_mini_info", &panels_options
.show_mini_info
},
384 { "kilobyte_si", &panels_options
.kilobyte_si
},
385 { "mix_all_files", &panels_options
.mix_all_files
},
386 { "show_backups", &panels_options
.show_backups
},
387 { "show_dot_files", &panels_options
.show_dot_files
},
388 { "fast_reload", &panels_options
.fast_reload
},
389 { "fast_reload_msg_shown", &panels_options
.fast_reload_msg_shown
},
390 { "mark_moves_down", &panels_options
.mark_moves_down
},
391 { "reverse_files_only", &panels_options
.reverse_files_only
},
392 { "auto_save_setup_panels", &panels_options
.auto_save_setup
},
393 { "navigate_with_arrows", &panels_options
.navigate_with_arrows
},
394 { "panel_scroll_pages", &panels_options
.scroll_pages
},
395 { "mouse_move_pages", &panels_options
.mouse_move_pages
},
396 { "filetype_mode", &panels_options
.filetype_mode
},
397 { "permission_mode", &panels_options
.permission_mode
},
398 { "torben_fj_mode", &panels_options
.torben_fj_mode
},
403 /*** file scope functions ************************************************************************/
404 /* --------------------------------------------------------------------------------------------- */
407 * Get name of config file.
409 * @param subdir If not NULL, config is also searched in specified subdir.
410 * @param config_file_name If relative, file if searched in standard paths.
412 * @return newly allocated string with config name or NULL if file is not found.
416 load_setup_get_full_config_name (const char *subdir
, const char *config_file_name
)
419 TODO: IMHO, in future, this function shall be placed in mcconfig module.
421 char *lc_basename
, *ret
;
424 if (config_file_name
== NULL
)
427 /* check for .keymap suffix */
428 if (g_str_has_suffix (config_file_name
, ".keymap"))
429 file_name
= g_strdup (config_file_name
);
431 file_name
= g_strconcat (config_file_name
, ".keymap", (char *) NULL
);
433 canonicalize_pathname (file_name
);
435 if (g_path_is_absolute (file_name
))
438 lc_basename
= g_path_get_basename (file_name
);
441 if (lc_basename
== NULL
)
445 ret
= g_build_filename (mc_config_get_path (), subdir
, lc_basename
, NULL
);
447 ret
= g_build_filename (mc_config_get_path (), lc_basename
, NULL
);
449 if (exist_file (ret
))
451 g_free (lc_basename
);
452 canonicalize_pathname (ret
);
458 ret
= g_build_filename (mc_global
.sysconfig_dir
, subdir
, lc_basename
, NULL
);
460 ret
= g_build_filename (mc_global
.sysconfig_dir
, lc_basename
, NULL
);
462 if (exist_file (ret
))
464 g_free (lc_basename
);
465 canonicalize_pathname (ret
);
471 ret
= g_build_filename (mc_global
.share_data_dir
, subdir
, lc_basename
, NULL
);
473 ret
= g_build_filename (mc_global
.share_data_dir
, lc_basename
, NULL
);
475 g_free (lc_basename
);
477 if (exist_file (ret
))
479 canonicalize_pathname (ret
);
487 /* --------------------------------------------------------------------------------------------- */
490 setup__is_cfg_group_must_panel_config (const char *grp
)
492 return (!strcasecmp ("Dirs", grp
) ||
493 !strcasecmp ("Temporal:New Right Panel", grp
) ||
494 !strcasecmp ("Temporal:New Left Panel", grp
) ||
495 !strcasecmp ("New Left Panel", grp
) || !strcasecmp ("New Right Panel", grp
))
499 /* --------------------------------------------------------------------------------------------- */
502 setup__move_panels_config_into_separate_file (const char *profile
)
504 mc_config_t
*tmp_cfg
;
505 char **groups
, **curr_grp
;
506 const char *need_grp
;
508 if (!exist_file (profile
))
511 tmp_cfg
= mc_config_init (profile
, FALSE
);
515 curr_grp
= groups
= mc_config_get_groups (tmp_cfg
, NULL
);
518 mc_config_deinit (tmp_cfg
);
524 if (setup__is_cfg_group_must_panel_config (*curr_grp
) == NULL
)
525 mc_config_del_group (tmp_cfg
, *curr_grp
);
529 mc_config_save_to_file (tmp_cfg
, panels_profile_name
, NULL
);
530 mc_config_deinit (tmp_cfg
);
532 tmp_cfg
= mc_config_init (profile
, FALSE
);
543 need_grp
= setup__is_cfg_group_must_panel_config (*curr_grp
);
544 if (need_grp
!= NULL
)
546 mc_config_del_group (tmp_cfg
, need_grp
);
552 mc_config_save_file (tmp_cfg
, NULL
);
553 mc_config_deinit (tmp_cfg
);
556 /* --------------------------------------------------------------------------------------------- */
558 Create new mc_config object from specified ini-file or
559 append data to existing mc_config object from ini-file
563 load_setup_init_config_from_file (mc_config_t
** config
, const char *fname
, gboolean read_only
)
566 TODO: IMHO, in future, this function shall be placed in mcconfig module.
568 if (exist_file (fname
))
571 mc_config_read_file (*config
, fname
, read_only
, TRUE
);
573 *config
= mc_config_init (fname
, read_only
);
577 /* --------------------------------------------------------------------------------------------- */
584 int first_panel_size
;
587 panels_layout
.horizontal_split
= mc_config_get_int (mc_main_config
, CONFIG_APP_SECTION
,
588 "horizontal_split", 0);
589 equal_split
= mc_config_get_int (mc_main_config
, "Layout", "equal_split", 1);
590 first_panel_size
= mc_config_get_int (mc_main_config
, "Layout", "first_panel_size", 1);
591 if (panels_layout
.horizontal_split
)
593 panels_layout
.horizontal_equal
= equal_split
;
594 panels_layout
.left_panel_size
= first_panel_size
;
598 panels_layout
.vertical_equal
= equal_split
;
599 panels_layout
.top_panel_size
= first_panel_size
;
602 /* actual options override legacy ones */
603 for (i
= 0; layout
[i
].opt_name
!= NULL
; i
++)
604 *layout
[i
].opt_addr
= mc_config_get_int (mc_main_config
, CONFIG_LAYOUT_SECTION
,
605 layout
[i
].opt_name
, *layout
[i
].opt_addr
);
607 /* remove legacy options */
608 mc_config_del_key (mc_main_config
, CONFIG_APP_SECTION
, "horizontal_split");
609 mc_config_del_key (mc_main_config
, "Layout", "equal_split");
610 mc_config_del_key (mc_main_config
, "Layout", "first_panel_size");
613 /* --------------------------------------------------------------------------------------------- */
616 load_keys_from_section (const char *terminal
, mc_config_t
* cfg
)
619 gchar
**profile_keys
, **keys
;
620 gchar
**values
, **curr_values
;
621 char *valcopy
, *value
;
623 gsize len
, values_len
;
625 if (terminal
== NULL
)
628 section_name
= g_strconcat ("terminal:", terminal
, (char *) NULL
);
629 profile_keys
= keys
= mc_config_get_keys (cfg
, section_name
, &len
);
631 while (*profile_keys
!= NULL
)
633 /* copy=other causes all keys from [terminal:other] to be loaded. */
634 if (g_ascii_strcasecmp (*profile_keys
, "copy") == 0)
636 valcopy
= mc_config_get_string (cfg
, section_name
, *profile_keys
, "");
637 load_keys_from_section (valcopy
, cfg
);
643 curr_values
= values
=
644 mc_config_get_string_list (cfg
, section_name
, *profile_keys
, &values_len
);
646 key_code
= lookup_key (*profile_keys
, NULL
);
650 if (curr_values
!= NULL
)
652 while (*curr_values
!= NULL
)
654 valcopy
= convert_controls (*curr_values
);
655 define_sequence (key_code
, valcopy
, MCKEY_NOACTION
);
662 value
= mc_config_get_string (cfg
, section_name
, *profile_keys
, "");
663 valcopy
= convert_controls (value
);
664 define_sequence (key_code
, valcopy
, MCKEY_NOACTION
);
674 g_free (section_name
);
677 /* --------------------------------------------------------------------------------------------- */
680 load_keymap_from_section (const char *section_name
, GArray
* keymap
, mc_config_t
* cfg
)
682 gchar
**profile_keys
, **keys
;
685 if (section_name
== NULL
)
688 profile_keys
= keys
= mc_config_get_keys (cfg
, section_name
, &len
);
690 while (*profile_keys
!= NULL
)
692 gchar
**values
, **curr_values
;
694 curr_values
= values
= mc_config_get_string_list (cfg
, section_name
, *profile_keys
, &len
);
696 if (curr_values
!= NULL
)
700 action
= keybind_lookup_action (*profile_keys
);
702 while (*curr_values
!= NULL
)
704 keybind_cmd_bind (keymap
, *curr_values
, action
);
717 /* --------------------------------------------------------------------------------------------- */
720 load_setup_get_keymap_profile_config (gboolean load_from_file
)
723 TODO: IMHO, in future, this function shall be placed in mcconfig module.
725 mc_config_t
*keymap_config
;
726 char *share_keymap
, *sysconfig_keymap
;
727 char *fname
, *fname2
;
729 /* 0) Create default keymap */
730 keymap_config
= create_default_keymap ();
732 return keymap_config
;
734 /* load and merge global keymaps */
736 /* 1) /usr/share/mc (mc_global.share_data_dir) */
737 share_keymap
= g_build_filename (mc_global
.share_data_dir
, GLOBAL_KEYMAP_FILE
, NULL
);
738 load_setup_init_config_from_file (&keymap_config
, share_keymap
, TRUE
);
740 /* 2) /etc/mc (mc_global.sysconfig_dir) */
741 sysconfig_keymap
= g_build_filename (mc_global
.sysconfig_dir
, GLOBAL_KEYMAP_FILE
, NULL
);
742 load_setup_init_config_from_file (&keymap_config
, sysconfig_keymap
, TRUE
);
744 /* then load and merge one of user-defined keymap */
746 /* 3) --keymap=<keymap> */
747 fname
= load_setup_get_full_config_name (NULL
, mc_args__keymap_file
);
748 if (fname
!= NULL
&& strcmp (fname
, sysconfig_keymap
) != 0 && strcmp (fname
, share_keymap
) != 0)
750 load_setup_init_config_from_file (&keymap_config
, fname
, TRUE
);
755 /* 4) getenv("MC_KEYMAP") */
756 fname
= load_setup_get_full_config_name (NULL
, g_getenv ("MC_KEYMAP"));
757 if (fname
!= NULL
&& strcmp (fname
, sysconfig_keymap
) != 0 && strcmp (fname
, share_keymap
) != 0)
759 load_setup_init_config_from_file (&keymap_config
, fname
, TRUE
);
764 /* 5) main config; [Midnight Commander] -> keymap */
765 fname2
= mc_config_get_string (mc_main_config
, CONFIG_APP_SECTION
, "keymap", NULL
);
766 if (fname2
!= NULL
&& *fname2
!= '\0')
767 fname
= load_setup_get_full_config_name (NULL
, fname2
);
769 if (fname
!= NULL
&& strcmp (fname
, sysconfig_keymap
) != 0 && strcmp (fname
, share_keymap
) != 0)
771 load_setup_init_config_from_file (&keymap_config
, fname
, TRUE
);
776 /* 6) ${XDG_CONFIG_HOME}/mc/mc.keymap */
777 fname
= mc_config_get_full_path (GLOBAL_KEYMAP_FILE
);
778 load_setup_init_config_from_file (&keymap_config
, fname
, TRUE
);
782 g_free (sysconfig_keymap
);
783 g_free (share_keymap
);
785 return keymap_config
;
788 /* --------------------------------------------------------------------------------------------- */
790 static panel_view_mode_t
791 setup__load_panel_state (const char *section
)
795 panel_view_mode_t mode
= view_listing
;
797 /* Load the display mode */
798 buffer
= mc_config_get_string (mc_panels_config
, section
, "display", "listing");
800 for (i
= 0; panel_types
[i
].opt_name
!= NULL
; i
++)
801 if (g_ascii_strcasecmp (panel_types
[i
].opt_name
, buffer
) == 0)
803 mode
= panel_types
[i
].opt_type
;
812 /* --------------------------------------------------------------------------------------------- */
815 panel_save_type (const char *section
, panel_view_mode_t type
)
819 for (i
= 0; panel_types
[i
].opt_name
!= NULL
; i
++)
820 if (panel_types
[i
].opt_type
== type
)
822 mc_config_set_string (mc_panels_config
, section
, "display", panel_types
[i
].opt_name
);
827 /* --------------------------------------------------------------------------------------------- */
829 /* save panels.ini */
831 save_panel_types (void)
833 panel_view_mode_t type
;
835 if (mc_global
.mc_run_mode
!= MC_RUN_FULL
)
838 type
= get_display_type (0);
839 panel_save_type ("New Left Panel", type
);
840 if (type
== view_listing
)
841 panel_save_setup (left_panel
, left_panel
->panel_name
);
842 type
= get_display_type (1);
843 panel_save_type ("New Right Panel", type
);
844 if (type
== view_listing
)
845 panel_save_setup (right_panel
, right_panel
->panel_name
);
850 dirs
= get_panel_dir_for (other_panel
);
851 mc_config_set_string (mc_panels_config
, "Dirs", "other_dir", dirs
);
855 if (current_panel
!= NULL
)
856 mc_config_set_bool (mc_panels_config
, "Dirs", "current_is_left", get_current_index () == 0);
858 if (mc_panels_config
->ini_path
== NULL
)
859 mc_panels_config
->ini_path
= g_strdup (panels_profile_name
);
861 mc_config_del_group (mc_panels_config
, "Temporal:New Left Panel");
862 mc_config_del_group (mc_panels_config
, "Temporal:New Right Panel");
864 mc_config_save_file (mc_panels_config
, NULL
);
867 /* --------------------------------------------------------------------------------------------- */
868 /*** public functions ****************************************************************************/
869 /* --------------------------------------------------------------------------------------------- */
877 if (profile_name
!= NULL
)
880 profile
= mc_config_get_full_path (MC_CONFIG_FILE
);
881 if (!exist_file (profile
))
883 inifile
= mc_build_filename (mc_global
.sysconfig_dir
, "mc.ini", NULL
);
884 if (exist_file (inifile
))
892 inifile
= mc_build_filename (mc_global
.share_data_dir
, "mc.ini", NULL
);
893 if (exist_file (inifile
))
903 profile_name
= profile
;
908 /* --------------------------------------------------------------------------------------------- */
919 load_codepages_list ();
920 #endif /* HAVE_CHARSET */
922 profile
= setup_init ();
924 /* mc.lib is common for all users, but has priority lower than
925 ${XDG_CONFIG_HOME}/mc/ini. FIXME: it's only used for keys and treestore now */
926 global_profile_name
=
927 g_build_filename (mc_global
.sysconfig_dir
, MC_GLOBAL_CONFIG_FILE
, (char *) NULL
);
928 if (!exist_file (global_profile_name
))
930 g_free (global_profile_name
);
931 global_profile_name
=
932 g_build_filename (mc_global
.share_data_dir
, MC_GLOBAL_CONFIG_FILE
, (char *) NULL
);
935 panels_profile_name
= mc_config_get_full_path (MC_PANELS_FILE
);
937 mc_main_config
= mc_config_init (profile
, FALSE
);
939 if (!exist_file (panels_profile_name
))
940 setup__move_panels_config_into_separate_file (profile
);
942 mc_panels_config
= mc_config_init (panels_profile_name
, FALSE
);
944 /* Load integer boolean options */
945 for (i
= 0; int_options
[i
].opt_name
!= NULL
; i
++)
946 *int_options
[i
].opt_addr
=
947 mc_config_get_int (mc_main_config
, CONFIG_APP_SECTION
, int_options
[i
].opt_name
,
948 *int_options
[i
].opt_addr
);
950 if (option_tab_spacing
<= 0)
951 option_tab_spacing
= DEFAULT_TAB_SPACING
;
953 #ifdef USE_INTERNAL_EDIT
954 if (option_word_wrap_line_length
<= 0)
955 option_word_wrap_line_length
= DEFAULT_WRAP_LINE_LENGTH
;
956 #endif /* USE_INTERNAL_EDIT */
958 /* overwrite old_esc_mode_timeout */
959 kt
= getenv ("KEYBOARD_KEY_TIMEOUT_US");
960 if ((kt
!= NULL
) && (kt
[0] != '\0'))
961 old_esc_mode_timeout
= atoi (kt
);
963 /* Load string options */
964 for (i
= 0; str_options
[i
].opt_name
!= NULL
; i
++)
965 *str_options
[i
].opt_addr
=
966 mc_config_get_string (mc_main_config
, CONFIG_APP_SECTION
, str_options
[i
].opt_name
,
967 str_options
[i
].opt_defval
);
970 panels_load_options ();
973 startup_left_mode
= setup__load_panel_state ("New Left Panel");
974 startup_right_mode
= setup__load_panel_state ("New Right Panel");
976 /* At least one of the panels is a listing panel */
977 if (startup_left_mode
!= view_listing
&& startup_right_mode
!= view_listing
)
978 startup_left_mode
= view_listing
;
980 if (mc_run_param1
== NULL
)
983 buffer
= mc_config_get_string (mc_panels_config
, "Dirs", "other_dir", ".");
984 vpath
= vfs_path_from_str (buffer
);
985 if (vfs_file_is_local (vpath
))
986 mc_run_param1
= buffer
;
989 vfs_path_free (vpath
);
992 boot_current_is_left
= mc_config_get_bool (mc_panels_config
, "Dirs", "current_is_left", TRUE
);
994 /* Load time formats */
995 user_recent_timeformat
=
996 mc_config_get_string (mc_main_config
, CONFIG_MISC_SECTION
, "timeformat_recent", FMTTIME
);
997 user_old_timeformat
=
998 mc_config_get_string (mc_main_config
, CONFIG_MISC_SECTION
, "timeformat_old", FMTYEAR
);
1000 #ifdef ENABLE_VFS_FTP
1002 mc_config_get_string (mc_main_config
, CONFIG_MISC_SECTION
, "ftp_proxy_host", "gate");
1003 ftpfs_ignore_chattr_errors
=
1004 mc_config_get_bool (mc_main_config
, CONFIG_APP_SECTION
, "ignore_ftp_chattr_errors", TRUE
);
1005 ftpfs_init_passwd ();
1006 #endif /* ENABLE_VFS_FTP */
1008 /* The default color and the terminal dependent color */
1009 mc_global
.tty
.setup_color_string
=
1010 mc_config_get_string (mc_main_config
, "Colors", "base_color", "");
1011 mc_global
.tty
.term_color_string
=
1012 mc_config_get_string (mc_main_config
, "Colors", getenv ("TERM"), "");
1013 mc_global
.tty
.color_terminal_string
=
1014 mc_config_get_string (mc_main_config
, "Colors", "color_terminals", "");
1016 /* Load the directory history */
1017 /* directory_history_load (); */
1018 /* Remove the temporal entries */
1021 if (codepages
->len
> 1)
1023 buffer
= mc_config_get_string (mc_main_config
, CONFIG_MISC_SECTION
, "display_codepage", "");
1024 if (buffer
[0] != '\0')
1026 mc_global
.display_codepage
= get_codepage_index (buffer
);
1027 cp_display
= get_codepage_id (mc_global
.display_codepage
);
1030 buffer
= mc_config_get_string (mc_main_config
, CONFIG_MISC_SECTION
, "source_codepage", "");
1031 if (buffer
[0] != '\0')
1033 default_source_codepage
= get_codepage_index (buffer
);
1034 mc_global
.source_codepage
= default_source_codepage
; /* May be source_codepage doesn't need this */
1035 cp_source
= get_codepage_id (mc_global
.source_codepage
);
1040 autodetect_codeset
=
1041 mc_config_get_string (mc_main_config
, CONFIG_MISC_SECTION
, "autodetect_codeset", "");
1042 if ((autodetect_codeset
[0] != '\0') && (strcmp (autodetect_codeset
, "off") != 0))
1043 is_autodetect_codeset_enabled
= TRUE
;
1045 g_free (init_translation_table (mc_global
.source_codepage
, mc_global
.display_codepage
));
1046 buffer
= (char *) get_codepage_id (mc_global
.display_codepage
);
1048 mc_global
.utf8_display
= str_isutf8 (buffer
);
1049 #endif /* HAVE_CHARSET */
1051 clipboard_store_path
=
1052 mc_config_get_string (mc_main_config
, CONFIG_MISC_SECTION
, "clipboard_store", "");
1053 clipboard_paste_path
=
1054 mc_config_get_string (mc_main_config
, CONFIG_MISC_SECTION
, "clipboard_paste", "");
1057 /* --------------------------------------------------------------------------------------------- */
1060 save_setup (gboolean save_options
, gboolean save_panel_options
)
1062 gboolean ret
= TRUE
;
1068 if (save_panel_options
)
1069 save_panel_types ();
1077 panels_save_options ();
1079 /* directory_history_save (); */
1081 #ifdef ENABLE_VFS_FTP
1082 mc_config_set_string (mc_main_config
, CONFIG_MISC_SECTION
, "ftpfs_password",
1083 ftpfs_anonymous_passwd
);
1084 if (ftpfs_proxy_host
)
1085 mc_config_set_string (mc_main_config
, CONFIG_MISC_SECTION
, "ftp_proxy_host",
1087 #endif /* ENABLE_VFS_FTP */
1090 mc_config_set_string (mc_main_config
, CONFIG_MISC_SECTION
, "display_codepage",
1091 get_codepage_id (mc_global
.display_codepage
));
1092 mc_config_set_string (mc_main_config
, CONFIG_MISC_SECTION
, "source_codepage",
1093 get_codepage_id (default_source_codepage
));
1094 mc_config_set_string (mc_main_config
, CONFIG_MISC_SECTION
, "autodetect_codeset",
1095 autodetect_codeset
);
1096 #endif /* HAVE_CHARSET */
1097 mc_config_set_string (mc_main_config
, CONFIG_MISC_SECTION
, "clipboard_store",
1098 clipboard_store_path
);
1099 mc_config_set_string (mc_main_config
, CONFIG_MISC_SECTION
, "clipboard_paste",
1100 clipboard_paste_path
);
1102 tmp_profile
= mc_config_get_full_path (MC_CONFIG_FILE
);
1103 ret
= mc_config_save_to_file (mc_main_config
, tmp_profile
, NULL
);
1104 g_free (tmp_profile
);
1112 /* --------------------------------------------------------------------------------------------- */
1119 g_free (clipboard_store_path
);
1120 g_free (clipboard_paste_path
);
1121 g_free (profile_name
);
1122 g_free (global_profile_name
);
1123 g_free (mc_global
.tty
.color_terminal_string
);
1124 g_free (mc_global
.tty
.term_color_string
);
1125 g_free (mc_global
.tty
.setup_color_string
);
1126 g_free (panels_profile_name
);
1127 mc_config_deinit (mc_main_config
);
1128 mc_config_deinit (mc_panels_config
);
1130 g_free (user_recent_timeformat
);
1131 g_free (user_old_timeformat
);
1133 for (i
= 0; str_options
[i
].opt_name
!= NULL
; i
++)
1134 g_free (*str_options
[i
].opt_addr
);
1138 /* directory_history_free (); */
1141 g_free (autodetect_codeset
);
1142 free_codepages_list ();
1146 /* --------------------------------------------------------------------------------------------- */
1153 /* Save integer options */
1154 for (i
= 0; int_options
[i
].opt_name
!= NULL
; i
++)
1155 mc_config_set_int (mc_main_config
, CONFIG_APP_SECTION
, int_options
[i
].opt_name
,
1156 *int_options
[i
].opt_addr
);
1158 /* Save string options */
1159 for (i
= 0; str_options
[i
].opt_name
!= NULL
; i
++)
1160 mc_config_set_string (mc_main_config
, CONFIG_APP_SECTION
, str_options
[i
].opt_name
,
1161 *str_options
[i
].opt_addr
);
1164 /* --------------------------------------------------------------------------------------------- */
1167 setup_save_config_show_error (const char *filename
, GError
** error
)
1169 if (error
!= NULL
&& *error
!= NULL
)
1171 message (D_ERROR
, MSG_ERROR
, _("Cannot save file %s:\n%s"), filename
, (*error
)->message
);
1172 g_error_free (*error
);
1177 /* --------------------------------------------------------------------------------------------- */
1184 /* Save integer options */
1185 for (i
= 0; layout
[i
].opt_name
!= NULL
; i
++)
1186 mc_config_set_int (mc_main_config
, CONFIG_LAYOUT_SECTION
, layout
[i
].opt_name
,
1187 *layout
[i
].opt_addr
);
1190 /* --------------------------------------------------------------------------------------------- */
1193 load_key_defs (void)
1196 * Load keys from mc.lib before ${XDG_CONFIG_HOME}/mc/ini, so that the user
1197 * definitions override global settings.
1199 mc_config_t
*mc_global_config
;
1201 mc_global_config
= mc_config_init (global_profile_name
, FALSE
);
1202 if (mc_global_config
!= NULL
)
1204 load_keys_from_section ("general", mc_global_config
);
1205 load_keys_from_section (getenv ("TERM"), mc_global_config
);
1206 mc_config_deinit (mc_global_config
);
1209 load_keys_from_section ("general", mc_main_config
);
1210 load_keys_from_section (getenv ("TERM"), mc_main_config
);
1213 /* --------------------------------------------------------------------------------------------- */
1215 #ifdef ENABLE_VFS_FTP
1217 load_anon_passwd (void)
1221 buffer
= mc_config_get_string (mc_main_config
, CONFIG_MISC_SECTION
, "ftpfs_password", "");
1223 if ((buffer
!= NULL
) && (buffer
[0] != '\0'))
1229 #endif /* ENABLE_VFS_FTP */
1231 /* --------------------------------------------------------------------------------------------- */
1234 load_keymap_defs (gboolean load_from_file
)
1237 * Load keymap from GLOBAL_KEYMAP_FILE before ${XDG_CONFIG_HOME}/mc/mc.keymap, so that the user
1238 * definitions override global settings.
1240 mc_config_t
*mc_global_keymap
;
1242 mc_global_keymap
= load_setup_get_keymap_profile_config (load_from_file
);
1244 if (mc_global_keymap
!= NULL
)
1246 main_keymap
= g_array_new (TRUE
, FALSE
, sizeof (global_keymap_t
));
1247 load_keymap_from_section (KEYMAP_SECTION_MAIN
, main_keymap
, mc_global_keymap
);
1248 main_x_keymap
= g_array_new (TRUE
, FALSE
, sizeof (global_keymap_t
));
1249 load_keymap_from_section (KEYMAP_SECTION_MAIN_EXT
, main_x_keymap
, mc_global_keymap
);
1251 panel_keymap
= g_array_new (TRUE
, FALSE
, sizeof (global_keymap_t
));
1252 load_keymap_from_section (KEYMAP_SECTION_PANEL
, panel_keymap
, mc_global_keymap
);
1254 dialog_keymap
= g_array_new (TRUE
, FALSE
, sizeof (global_keymap_t
));
1255 load_keymap_from_section (KEYMAP_SECTION_DIALOG
, dialog_keymap
, mc_global_keymap
);
1257 input_keymap
= g_array_new (TRUE
, FALSE
, sizeof (global_keymap_t
));
1258 load_keymap_from_section (KEYMAP_SECTION_INPUT
, input_keymap
, mc_global_keymap
);
1260 listbox_keymap
= g_array_new (TRUE
, FALSE
, sizeof (global_keymap_t
));
1261 load_keymap_from_section (KEYMAP_SECTION_LISTBOX
, listbox_keymap
, mc_global_keymap
);
1263 tree_keymap
= g_array_new (TRUE
, FALSE
, sizeof (global_keymap_t
));
1264 load_keymap_from_section (KEYMAP_SECTION_TREE
, tree_keymap
, mc_global_keymap
);
1266 help_keymap
= g_array_new (TRUE
, FALSE
, sizeof (global_keymap_t
));
1267 load_keymap_from_section (KEYMAP_SECTION_HELP
, help_keymap
, mc_global_keymap
);
1269 #ifdef USE_INTERNAL_EDIT
1270 editor_keymap
= g_array_new (TRUE
, FALSE
, sizeof (global_keymap_t
));
1271 load_keymap_from_section (KEYMAP_SECTION_EDITOR
, editor_keymap
, mc_global_keymap
);
1272 editor_x_keymap
= g_array_new (TRUE
, FALSE
, sizeof (global_keymap_t
));
1273 load_keymap_from_section (KEYMAP_SECTION_EDITOR_EXT
, editor_x_keymap
, mc_global_keymap
);
1276 viewer_keymap
= g_array_new (TRUE
, FALSE
, sizeof (global_keymap_t
));
1277 load_keymap_from_section (KEYMAP_SECTION_VIEWER
, viewer_keymap
, mc_global_keymap
);
1278 viewer_hex_keymap
= g_array_new (TRUE
, FALSE
, sizeof (global_keymap_t
));
1279 load_keymap_from_section (KEYMAP_SECTION_VIEWER_HEX
, viewer_hex_keymap
, mc_global_keymap
);
1281 #ifdef USE_DIFF_VIEW
1282 diff_keymap
= g_array_new (TRUE
, FALSE
, sizeof (global_keymap_t
));
1283 load_keymap_from_section (KEYMAP_SECTION_DIFFVIEWER
, diff_keymap
, mc_global_keymap
);
1286 mc_config_deinit (mc_global_keymap
);
1289 main_map
= (global_keymap_t
*) main_keymap
->data
;
1290 main_x_map
= (global_keymap_t
*) main_x_keymap
->data
;
1291 panel_map
= (global_keymap_t
*) panel_keymap
->data
;
1292 dialog_map
= (global_keymap_t
*) dialog_keymap
->data
;
1293 input_map
= (global_keymap_t
*) input_keymap
->data
;
1294 listbox_map
= (global_keymap_t
*) listbox_keymap
->data
;
1295 tree_map
= (global_keymap_t
*) tree_keymap
->data
;
1296 help_map
= (global_keymap_t
*) help_keymap
->data
;
1297 #ifdef USE_INTERNAL_EDIT
1298 editor_map
= (global_keymap_t
*) editor_keymap
->data
;
1299 editor_x_map
= (global_keymap_t
*) editor_x_keymap
->data
;
1301 viewer_map
= (global_keymap_t
*) viewer_keymap
->data
;
1302 viewer_hex_map
= (global_keymap_t
*) viewer_hex_keymap
->data
;
1303 #ifdef USE_DIFF_VIEW
1304 diff_map
= (global_keymap_t
*) diff_keymap
->data
;
1308 /* --------------------------------------------------------------------------------------------- */
1311 free_keymap_defs (void)
1313 if (main_keymap
!= NULL
)
1314 g_array_free (main_keymap
, TRUE
);
1315 if (main_x_keymap
!= NULL
)
1316 g_array_free (main_x_keymap
, TRUE
);
1317 if (panel_keymap
!= NULL
)
1318 g_array_free (panel_keymap
, TRUE
);
1319 if (dialog_keymap
!= NULL
)
1320 g_array_free (dialog_keymap
, TRUE
);
1321 if (input_keymap
!= NULL
)
1322 g_array_free (input_keymap
, TRUE
);
1323 if (listbox_keymap
!= NULL
)
1324 g_array_free (listbox_keymap
, TRUE
);
1325 if (tree_keymap
!= NULL
)
1326 g_array_free (tree_keymap
, TRUE
);
1327 if (help_keymap
!= NULL
)
1328 g_array_free (help_keymap
, TRUE
);
1329 #ifdef USE_INTERNAL_EDIT
1330 if (editor_keymap
!= NULL
)
1331 g_array_free (editor_keymap
, TRUE
);
1332 if (editor_x_keymap
!= NULL
)
1333 g_array_free (editor_x_keymap
, TRUE
);
1335 if (viewer_keymap
!= NULL
)
1336 g_array_free (viewer_keymap
, TRUE
);
1337 if (viewer_hex_keymap
!= NULL
)
1338 g_array_free (viewer_hex_keymap
, TRUE
);
1339 #ifdef USE_DIFF_VIEW
1340 if (diff_keymap
!= NULL
)
1341 g_array_free (diff_keymap
, TRUE
);
1345 /* --------------------------------------------------------------------------------------------- */
1348 panel_load_setup (WPanel
* panel
, const char *section
)
1351 char *buffer
, buffer2
[BUF_TINY
];
1353 panel
->sort_info
.reverse
= mc_config_get_int (mc_panels_config
, section
, "reverse", 0);
1354 panel
->sort_info
.case_sensitive
=
1355 mc_config_get_int (mc_panels_config
, section
, "case_sensitive",
1356 OS_SORT_CASE_SENSITIVE_DEFAULT
);
1357 panel
->sort_info
.exec_first
= mc_config_get_int (mc_panels_config
, section
, "exec_first", 0);
1359 /* Load sort order */
1360 buffer
= mc_config_get_string (mc_panels_config
, section
, "sort_order", "name");
1361 panel
->sort_info
.sort_field
= panel_get_field_by_id (buffer
);
1362 if (panel
->sort_info
.sort_field
== NULL
)
1363 panel
->sort_info
.sort_field
= panel_get_field_by_id ("name");
1367 /* Load the listing mode */
1368 buffer
= mc_config_get_string (mc_panels_config
, section
, "list_mode", "full");
1369 panel
->list_type
= list_full
;
1370 for (i
= 0; list_types
[i
].key
!= NULL
; i
++)
1371 if (g_ascii_strcasecmp (list_types
[i
].key
, buffer
) == 0)
1373 panel
->list_type
= list_types
[i
].list_type
;
1379 g_free (panel
->user_format
);
1380 panel
->user_format
=
1381 mc_config_get_string (mc_panels_config
, section
, "user_format", DEFAULT_USER_FORMAT
);
1383 for (i
= 0; i
< LIST_TYPES
; i
++)
1385 g_free (panel
->user_status_format
[i
]);
1386 g_snprintf (buffer2
, BUF_TINY
, "user_status%lld", (long long) i
);
1387 panel
->user_status_format
[i
] =
1388 mc_config_get_string (mc_panels_config
, section
, buffer2
, DEFAULT_USER_FORMAT
);
1391 panel
->user_mini_status
= mc_config_get_int (mc_panels_config
, section
, "user_mini_status", 0);
1394 /* --------------------------------------------------------------------------------------------- */
1397 panel_save_setup (struct WPanel
*panel
, const char *section
)
1399 char buffer
[BUF_TINY
];
1402 mc_config_set_int (mc_panels_config
, section
, "reverse", panel
->sort_info
.reverse
);
1403 mc_config_set_int (mc_panels_config
, section
, "case_sensitive",
1404 panel
->sort_info
.case_sensitive
);
1405 mc_config_set_int (mc_panels_config
, section
, "exec_first", panel
->sort_info
.exec_first
);
1407 mc_config_set_string (mc_panels_config
, section
, "sort_order", panel
->sort_info
.sort_field
->id
);
1409 for (i
= 0; list_types
[i
].key
!= NULL
; i
++)
1410 if (list_types
[i
].list_type
== panel
->list_type
)
1412 mc_config_set_string (mc_panels_config
, section
, "list_mode", list_types
[i
].key
);
1416 mc_config_set_string (mc_panels_config
, section
, "user_format", panel
->user_format
);
1418 for (i
= 0; i
< LIST_TYPES
; i
++)
1420 g_snprintf (buffer
, BUF_TINY
, "user_status%lld", (long long) i
);
1421 mc_config_set_string (mc_panels_config
, section
, buffer
, panel
->user_status_format
[i
]);
1424 mc_config_set_int (mc_panels_config
, section
, "user_mini_status", panel
->user_mini_status
);
1427 /* --------------------------------------------------------------------------------------------- */
1430 Load panels options from [Panels] section.
1433 panels_load_options (void)
1435 if (mc_config_has_group (mc_main_config
, CONFIG_PANELS_SECTION
))
1440 for (i
= 0; panels_ini_options
[i
].opt_name
!= NULL
; i
++)
1441 *panels_ini_options
[i
].opt_addr
=
1442 mc_config_get_bool (mc_main_config
, CONFIG_PANELS_SECTION
,
1443 panels_ini_options
[i
].opt_name
,
1444 *panels_ini_options
[i
].opt_addr
);
1446 qmode
= mc_config_get_int (mc_main_config
, CONFIG_PANELS_SECTION
,
1447 "quick_search_mode", (int) panels_options
.qsearch_mode
);
1449 panels_options
.qsearch_mode
= QSEARCH_CASE_INSENSITIVE
;
1450 else if (qmode
>= QSEARCH_NUM
)
1451 panels_options
.qsearch_mode
= QSEARCH_PANEL_CASE
;
1453 panels_options
.qsearch_mode
= (qsearch_mode_t
) qmode
;
1457 /* --------------------------------------------------------------------------------------------- */
1460 Save panels options in [Panels] section.
1463 panels_save_options (void)
1467 for (i
= 0; panels_ini_options
[i
].opt_name
!= NULL
; i
++)
1468 mc_config_set_bool (mc_main_config
, CONFIG_PANELS_SECTION
,
1469 panels_ini_options
[i
].opt_name
, *panels_ini_options
[i
].opt_addr
);
1471 mc_config_set_int (mc_main_config
, CONFIG_PANELS_SECTION
,
1472 "quick_search_mode", (int) panels_options
.qsearch_mode
);
1475 /* --------------------------------------------------------------------------------------------- */