static void edit_about (void) { quick_widget_t quick_widgets[] = { /* *INDENT-OFF* */ QUICK_LABEL ("MCEdit " VERSION, NULL), QUICK_SEPARATOR (TRUE), QUICK_LABEL (N_("A user friendly text editor\n" "written for the Midnight Commander."), NULL), QUICK_SEPARATOR (FALSE), QUICK_LABEL (N_("Copyright (C) 1996-2019 the Free Software Foundation"), NULL), QUICK_START_BUTTONS (TRUE, TRUE), QUICK_BUTTON (N_("&OK"), B_ENTER, NULL, NULL), QUICK_END /* *INDENT-ON* */ }; quick_dialog_t qdlg = { -1, -1, 40, N_("About"), "[Internal File Editor]", quick_widgets, NULL, NULL }; quick_widgets[0].pos_flags = WPOS_KEEP_TOP | WPOS_CENTER_HORZ; quick_widgets[2].pos_flags = WPOS_KEEP_TOP | WPOS_CENTER_HORZ; quick_widgets[4].pos_flags = WPOS_KEEP_TOP | WPOS_CENTER_HORZ; (void) quick_dialog (&qdlg); }
struct smb_authinfo * vfs_smb_get_authinfo (const char *host, const char *share, const char *domain, const char *user) { char *label; struct smb_authinfo *return_value = NULL; if (domain == NULL) domain = ""; if (user == NULL) user = ""; label = g_strdup_printf (_("Password for \\\\%s\\%s"), host, share); { char *ret_domain, *ret_user, *ret_password; quick_widget_t quick_widgets[] = { /* *INDENT-OFF* */ QUICK_LABEL (label, NULL), QUICK_SEPARATOR (TRUE), QUICK_START_COLUMNS, QUICK_LABEL (N_("Domain:"), NULL), QUICK_SEPARATOR (FALSE), QUICK_LABEL (N_("Username:"******"Password:"******"auth_domain", &ret_domain, NULL, FALSE, FALSE, INPUT_COMPLETE_HOSTNAMES), QUICK_SEPARATOR (FALSE), QUICK_INPUT (user, "auth_name", &ret_user, NULL, FALSE, FALSE, INPUT_COMPLETE_USERNAMES), QUICK_SEPARATOR (FALSE), QUICK_INPUT ("", "auth_password", &ret_password, NULL, TRUE, FALSE, INPUT_COMPLETE_NONE), QUICK_STOP_COLUMNS, QUICK_BUTTONS_OK_CANCEL, QUICK_END /* *INDENT-ON* */ }; quick_dialog_t qdlg = { -1, -1, 40, N_("SMB authentication"), "[Smb Authinfo]", quick_widgets, NULL, NULL }; if (quick_dialog (&qdlg) != B_CANCEL) { return_value = vfs_smb_authinfo_new (host, share, ret_domain, ret_user, ret_password); g_free (ret_domain); g_free (ret_user); g_free (ret_password); } } g_free (label); return return_value; }
void symlink_dialog (const vfs_path_t * existing_vpath, const vfs_path_t * new_vpath, char **ret_existing, char **ret_new) { quick_widget_t quick_widgets[] = { /* *INDENT-OFF* */ QUICK_LABELED_INPUT (N_("Existing filename (filename symlink will point to):"), input_label_above, vfs_path_as_str (existing_vpath), "input-2", ret_existing, NULL, FALSE, FALSE, INPUT_COMPLETE_FILENAMES), QUICK_SEPARATOR (FALSE), QUICK_LABELED_INPUT (N_("Symbolic link filename:"), input_label_above, vfs_path_as_str (new_vpath), "input-1", ret_new, NULL, FALSE, FALSE, INPUT_COMPLETE_FILENAMES), QUICK_BUTTONS_OK_CANCEL, QUICK_END /* *INDENT-ON* */ }; quick_dialog_t qdlg = { -1, -1, 64, N_("Symbolic link"), "[File Menu]", quick_widgets, NULL, NULL }; if (quick_dialog (&qdlg) == B_CANCEL) { *ret_new = NULL; *ret_existing = NULL; } }
void display_bits_box (void) { const char *cpname; new_display_codepage = mc_global.display_codepage; cpname = (new_display_codepage < 0) ? _("Other 8 bit") : ((codepage_desc *) g_ptr_array_index (codepages, new_display_codepage))->name; { int new_meta; quick_widget_t quick_widgets[] = { /* *INDENT-OFF* */ QUICK_START_COLUMNS, QUICK_LABEL (N_("Input / display codepage:"), NULL), QUICK_NEXT_COLUMN, QUICK_BUTTON (cpname, B_USER, sel_charset_button, NULL), QUICK_STOP_COLUMNS, QUICK_SEPARATOR (TRUE), QUICK_CHECKBOX (N_("F&ull 8 bits input"), &new_meta, NULL), QUICK_BUTTONS_OK_CANCEL, QUICK_END /* *INDENT-ON* */ }; quick_dialog_t qdlg = { -1, -1, 46, N_("Display bits"), "[Display bits]", quick_widgets, NULL, NULL }; new_meta = !use_8th_bit_as_meta; application_keypad_mode (); if (quick_dialog (&qdlg) == B_ENTER) { char *errmsg; mc_global.display_codepage = new_display_codepage; errmsg = init_translation_table (mc_global.source_codepage, mc_global.display_codepage); if (errmsg != NULL) { message (D_ERROR, MSG_ERROR, "%s", errmsg); g_free (errmsg); } #ifdef HAVE_SLANG tty_display_8bit (mc_global.display_codepage != 0 && mc_global.display_codepage != 1); #else tty_display_8bit (mc_global.display_codepage != 0); #endif use_8th_bit_as_meta = !new_meta; repaint_screen (); } } }
void editcmd_dialog_replace_show (WEdit * edit, const char *search_default, const char *replace_default, /*@out@ */ char **search_text, /*@out@ */ char **replace_text) { size_t num_of_types; gchar **list_of_types; if ((search_default == NULL) || (*search_default == '\0')) search_default = INPUT_LAST_TEXT; list_of_types = mc_search_get_types_strings_array (&num_of_types); { quick_widget_t quick_widgets[] = { /* *INDENT-OFF* */ QUICK_LABELED_INPUT (N_("Enter search string:"), input_label_above, search_default, MC_HISTORY_SHARED_SEARCH, search_text, NULL, FALSE, FALSE, INPUT_COMPLETE_NONE), QUICK_LABELED_INPUT (N_("Enter replacement string:"), input_label_above, replace_default, "replace", replace_text, NULL, FALSE, FALSE, INPUT_COMPLETE_NONE), QUICK_SEPARATOR (TRUE), QUICK_START_COLUMNS, QUICK_RADIO (num_of_types, (const char **) list_of_types, (int *) &edit_search_options.type, NULL), QUICK_NEXT_COLUMN, QUICK_CHECKBOX (N_("Cas&e sensitive"), &edit_search_options.case_sens, NULL), QUICK_CHECKBOX (N_("&Backwards"), &edit_search_options.backwards, NULL), QUICK_CHECKBOX (N_("In se&lection"), &edit_search_options.only_in_selection, NULL), QUICK_CHECKBOX (N_("&Whole words"), &edit_search_options.whole_words, NULL), #ifdef HAVE_CHARSET QUICK_CHECKBOX (N_("&All charsets"), &edit_search_options.all_codepages, NULL), #endif QUICK_STOP_COLUMNS, QUICK_BUTTONS_OK_CANCEL, QUICK_END /* *INDENT-ON* */ }; quick_dialog_t qdlg = { -1, -1, 58, N_("Replace"), "[Input Line Keys]", quick_widgets, NULL, NULL }; if (quick_dialog (&qdlg) != B_CANCEL) edit->replace_mode = 0; else { *replace_text = NULL; *search_text = NULL; } } g_strfreev (list_of_types); }
void display_bits_box (void) { int new_meta; int current_mode; const char *display_bits_str[] = { N_("&UTF-8 output"), N_("&Full 8 bits output"), N_("&ISO 8859-1"), N_("7 &bits") }; quick_widget_t quick_widgets[] = { /* *INDENT-OFF* */ QUICK_RADIO (4, display_bits_str, ¤t_mode, NULL), QUICK_SEPARATOR (TRUE), QUICK_CHECKBOX (N_("F&ull 8 bits input"), &new_meta, NULL), QUICK_BUTTONS_OK_CANCEL, QUICK_END /* *INDENT-ON* */ }; quick_dialog_t qdlg = { -1, -1, 46, _("Display bits"), "[Display bits]", quick_widgets, NULL, NULL }; if (mc_global.full_eight_bits) current_mode = 0; else if (mc_global.eight_bit_clean) current_mode = 1; else current_mode = 2; new_meta = !use_8th_bit_as_meta; if (quick_dialog (&qdlg) != B_CANCEL) { mc_global.eight_bit_clean = current_mode < 3; mc_global.full_eight_bits = current_mode < 2; #ifndef HAVE_SLANG meta (stdscr, mc_global.eight_bit_clean); #else SLsmg_Display_Eight_Bit = mc_global.full_eight_bits ? 128 : 160; #endif use_8th_bit_as_meta = !new_meta; } }
gboolean mcview_dialog_search (WView * view) { char *exp = NULL; int qd_result; size_t num_of_types = 0; gchar **list_of_types; list_of_types = mc_search_get_types_strings_array (&num_of_types); { quick_widget_t quick_widgets[] = { /* *INDENT-OFF* */ QUICK_LABELED_INPUT (N_("Enter search string:"), input_label_above, INPUT_LAST_TEXT, MC_HISTORY_SHARED_SEARCH, &exp, NULL, FALSE, FALSE, INPUT_COMPLETE_NONE), QUICK_SEPARATOR (TRUE), QUICK_START_COLUMNS, QUICK_RADIO (num_of_types, (const char **) list_of_types, (int *) &mcview_search_options.type, NULL), QUICK_NEXT_COLUMN, QUICK_CHECKBOX (N_("Cas&e sensitive"), &mcview_search_options.case_sens, NULL), QUICK_CHECKBOX (N_("&Backwards"), &mcview_search_options.backwards, NULL), QUICK_CHECKBOX (N_("&Whole words"), &mcview_search_options.whole_words, NULL), #ifdef HAVE_CHARSET QUICK_CHECKBOX (N_("&All charsets"), &mcview_search_options.all_codepages, NULL), #endif QUICK_STOP_COLUMNS, QUICK_BUTTONS_OK_CANCEL, QUICK_END /* *INDENT-ON* */ }; quick_dialog_t qdlg = { -1, -1, 58, N_("Search"), "[Input Line Keys]", quick_widgets, NULL, NULL }; qd_result = quick_dialog (&qdlg); } g_strfreev (list_of_types); if ((qd_result == B_CANCEL) || (exp == NULL) || (exp[0] == '\0')) { g_free (exp); return FALSE; } #ifdef HAVE_CHARSET { GString *tmp; tmp = str_convert_to_input (exp); g_free (exp); exp = g_string_free (tmp, FALSE); } #endif g_free (view->last_search_string); view->last_search_string = exp; mcview_nroff_seq_free (&view->search_nroff_seq); mc_search_free (view->search); #ifdef HAVE_CHARSET view->search = mc_search_new (view->last_search_string, cp_source); #else view->search = mc_search_new (view->last_search_string, NULL); #endif view->search_nroff_seq = mcview_nroff_seq_new (view); if (view->search != NULL) { view->search->search_type = mcview_search_options.type; #ifdef HAVE_CHARSET view->search->is_all_charsets = mcview_search_options.all_codepages; #endif view->search->is_case_sensitive = mcview_search_options.case_sens; view->search->whole_words = mcview_search_options.whole_words; view->search->search_fn = mcview_search_cmd_callback; view->search->update_fn = mcview_search_update_cmd_callback; } return (view->search != NULL); }
gboolean editcmd_dialog_search_show (WEdit * edit) { char *search_text; size_t num_of_types; gchar **list_of_types; int dialog_result; list_of_types = mc_search_get_types_strings_array (&num_of_types); { quick_widget_t quick_widgets[] = { /* *INDENT-OFF* */ QUICK_LABELED_INPUT (N_("Enter search string:"), input_label_above, INPUT_LAST_TEXT, MC_HISTORY_SHARED_SEARCH, &search_text, NULL, FALSE, FALSE, INPUT_COMPLETE_NONE), QUICK_SEPARATOR (TRUE), QUICK_START_COLUMNS, QUICK_RADIO (num_of_types, (const char **) list_of_types, (int *) &edit_search_options.type, NULL), QUICK_NEXT_COLUMN, QUICK_CHECKBOX (N_("Cas&e sensitive"), &edit_search_options.case_sens, NULL), QUICK_CHECKBOX (N_("&Backwards"), &edit_search_options.backwards, NULL), QUICK_CHECKBOX (N_("In se&lection"), &edit_search_options.only_in_selection, NULL), QUICK_CHECKBOX (N_("&Whole words"), &edit_search_options.whole_words, NULL), #ifdef HAVE_CHARSET QUICK_CHECKBOX (N_("&All charsets"), &edit_search_options.all_codepages, NULL), #endif QUICK_STOP_COLUMNS, QUICK_START_BUTTONS (TRUE, TRUE), QUICK_BUTTON (N_("&OK"), B_ENTER, NULL, NULL), QUICK_BUTTON (N_("&Find all"), B_USER, NULL, NULL), QUICK_BUTTON (N_("&Cancel"), B_CANCEL, NULL, NULL), QUICK_END /* *INDENT-ON* */ }; quick_dialog_t qdlg = { -1, -1, 58, N_("Search"), "[Input Line Keys]", quick_widgets, NULL, NULL }; dialog_result = quick_dialog (&qdlg); } g_strfreev (list_of_types); if ((dialog_result == B_CANCEL) || (search_text == NULL) || (search_text[0] == '\0')) { g_free (search_text); return FALSE; } if (dialog_result == B_USER) search_create_bookmark = TRUE; #ifdef HAVE_CHARSET { GString *tmp; tmp = str_convert_to_input (search_text); if (tmp != NULL) { g_free (search_text); search_text = g_string_free (tmp, FALSE); } } #endif g_free (edit->last_search_string); edit->last_search_string = search_text; mc_search_free (edit->search); #ifdef HAVE_CHARSET edit->search = mc_search_new (edit->last_search_string, cp_source); #else edit->search = mc_search_new (edit->last_search_string, NULL); #endif if (edit->search != NULL) { edit->search->search_type = edit_search_options.type; #ifdef HAVE_CHARSET edit->search->is_all_charsets = edit_search_options.all_codepages; #endif edit->search->is_case_sensitive = edit_search_options.case_sens; edit->search->whole_words = edit_search_options.whole_words; edit->search->search_fn = edit_search_cmd_callback; edit->search->update_fn = edit_search_update_callback; } return (edit->search != NULL); }
char * file_mask_dialog (file_op_context_t * ctx, FileOperation operation, gboolean only_one, const char *format, const void *text, const char *def_text, gboolean * do_bg) { size_t fmd_xlen; vfs_path_t *vpath; int source_easy_patterns = easy_patterns; char fmd_buf[BUF_MEDIUM]; char *dest_dir, *tmp; char *def_text_secure; if (ctx == NULL) return NULL; /* unselect checkbox if target filesystem don't support attributes */ ctx->op_preserve = filegui__check_attrs_on_fs (def_text); ctx->stable_symlinks = FALSE; *do_bg = FALSE; /* filter out a possible password from def_text */ vpath = vfs_path_from_str_flags (def_text, only_one ? VPF_NO_CANON : VPF_NONE); tmp = vfs_path_to_str_flags (vpath, 0, VPF_STRIP_PASSWORD); vfs_path_free (vpath); if (source_easy_patterns) def_text_secure = strutils_glob_escape (tmp); else def_text_secure = strutils_regex_escape (tmp); g_free (tmp); if (only_one) { int format_len, text_len; int max_len; format_len = str_term_width1 (format); text_len = str_term_width1 (text); max_len = COLS - 2 - 6; if (format_len + text_len <= max_len) { fmd_xlen = format_len + text_len + 6; fmd_xlen = max (fmd_xlen, 68); } else { text = str_trunc ((const char *) text, max_len - format_len); fmd_xlen = max_len + 6; } g_snprintf (fmd_buf, sizeof (fmd_buf), format, (const char *) text); } else { fmd_xlen = COLS * 2 / 3; fmd_xlen = max (fmd_xlen, 68); g_snprintf (fmd_buf, sizeof (fmd_buf), format, *(const int *) text); } { char *source_mask, *orig_mask; int val; struct stat buf; quick_widget_t quick_widgets[] = { /* *INDENT-OFF* */ QUICK_LABELED_INPUT (fmd_buf, input_label_above, easy_patterns ? "*" : "^(.*)$", "input-def", &source_mask, NULL, FALSE, FALSE, INPUT_COMPLETE_FILENAMES), QUICK_START_COLUMNS, QUICK_SEPARATOR (FALSE), QUICK_NEXT_COLUMN, QUICK_CHECKBOX (N_("&Using shell patterns"), &source_easy_patterns, NULL), QUICK_STOP_COLUMNS, QUICK_LABELED_INPUT (N_("to:"), input_label_above, def_text_secure, "input2", &dest_dir, NULL, FALSE, FALSE, INPUT_COMPLETE_FILENAMES), QUICK_SEPARATOR (TRUE), QUICK_START_COLUMNS, QUICK_CHECKBOX (N_("Follow &links"), &ctx->follow_links, NULL), QUICK_CHECKBOX (N_("Preserve &attributes"), &ctx->op_preserve, NULL), QUICK_NEXT_COLUMN, QUICK_CHECKBOX (N_("Di&ve into subdir if exists"), &ctx->dive_into_subdirs, NULL), QUICK_CHECKBOX (N_("&Stable symlinks"), &ctx->stable_symlinks, NULL), QUICK_STOP_COLUMNS, QUICK_START_BUTTONS (TRUE, TRUE), QUICK_BUTTON (N_("&OK"), B_ENTER, NULL, NULL), #ifdef ENABLE_BACKGROUND QUICK_BUTTON (N_("&Background"), B_USER, NULL, NULL), #endif /* ENABLE_BACKGROUND */ QUICK_BUTTON (N_("&Cancel"), B_CANCEL, NULL, NULL), QUICK_END /* *INDENT-ON* */ }; quick_dialog_t qdlg = { -1, -1, fmd_xlen, op_names[operation], "[Mask Copy/Rename]", quick_widgets, NULL, NULL }; ask_file_mask: val = quick_dialog_skip (&qdlg, 4); if (val == B_CANCEL) { g_free (def_text_secure); return NULL; } if (ctx->follow_links) ctx->stat_func = mc_stat; else ctx->stat_func = mc_lstat; if (ctx->op_preserve) { ctx->preserve = TRUE; ctx->umask_kill = 0777777; ctx->preserve_uidgid = (geteuid () == 0); } else { int i2; ctx->preserve = ctx->preserve_uidgid = FALSE; i2 = umask (0); umask (i2); ctx->umask_kill = i2 ^ 0777777; } if ((dest_dir == NULL) || (*dest_dir == '\0')) { g_free (def_text_secure); g_free (source_mask); return dest_dir; } ctx->search_handle = mc_search_new (source_mask, -1, NULL); if (ctx->search_handle == NULL) { message (D_ERROR, MSG_ERROR, _("Invalid source pattern '%s'"), source_mask); g_free (dest_dir); g_free (source_mask); goto ask_file_mask; } g_free (def_text_secure); g_free (source_mask); ctx->search_handle->is_case_sensitive = TRUE; if (source_easy_patterns) ctx->search_handle->search_type = MC_SEARCH_T_GLOB; else ctx->search_handle->search_type = MC_SEARCH_T_REGEX; vpath = vfs_path_from_str (dest_dir); ctx->dest_mask = strrchr (dest_dir, PATH_SEP); if (ctx->dest_mask == NULL) ctx->dest_mask = dest_dir; else ctx->dest_mask++; orig_mask = ctx->dest_mask; if (*ctx->dest_mask == '\0' || (!ctx->dive_into_subdirs && !is_wildcarded (ctx->dest_mask) && (!only_one || (mc_stat (vpath, &buf) == 0 && S_ISDIR (buf.st_mode)))) || (ctx->dive_into_subdirs && ((!only_one && !is_wildcarded (ctx->dest_mask)) || (only_one && mc_stat (vpath, &buf) == 0 && S_ISDIR (buf.st_mode))))) ctx->dest_mask = g_strdup ("\\0"); else { ctx->dest_mask = g_strdup (ctx->dest_mask); *orig_mask = '\0'; } if (*dest_dir == '\0') { g_free (dest_dir); dest_dir = g_strdup ("./"); } vfs_path_free (vpath); if (val == B_USER) *do_bg = TRUE; } return dest_dir; }
/* return list type */ int panel_listing_box (WPanel * panel, int num, char **userp, char **minip, int *use_msformat, int *brief_cols) { int result = -1; char *section = NULL; if (panel == NULL) { const char *p; size_t i; p = get_nth_panel_name (num); panel = g_new (WPanel, 1); panel->list_type = list_full; panel->user_format = g_strdup (DEFAULT_USER_FORMAT); panel->user_mini_status = 0; for (i = 0; i < LIST_TYPES; i++) panel->user_status_format[i] = g_strdup (DEFAULT_USER_FORMAT); section = g_strconcat ("Temporal:", p, (char *) NULL); if (!mc_config_has_group (mc_main_config, section)) { g_free (section); section = g_strdup (p); } panel_load_setup (panel, section); g_free (section); } { int mini_user_status; char panel_brief_cols_in[BUF_TINY]; char *panel_brief_cols_out = NULL; char *panel_user_format = NULL; char *mini_user_format = NULL; const char *cp; /* Controls whether the array strings have been translated */ const char *list_types[LIST_TYPES] = { N_("&Full file list"), N_("&Brief file list:"), N_("&Long file list"), N_("&User defined:") }; quick_widget_t quick_widgets[] = { /* *INDENT-OFF* */ QUICK_START_COLUMNS, QUICK_RADIO (LIST_TYPES, list_types, &result, &panel_listing_types_id), QUICK_NEXT_COLUMN, QUICK_SEPARATOR (FALSE), QUICK_LABELED_INPUT (_ ("columns"), input_label_right, panel_brief_cols_in, "panel-brief-cols-input", &panel_brief_cols_out, &panel_brief_cols_id, FALSE, FALSE, INPUT_COMPLETE_NONE), QUICK_STOP_COLUMNS, QUICK_INPUT (panel->user_format, "user-fmt-input", &panel_user_format, &panel_user_format_id, FALSE, FALSE, INPUT_COMPLETE_NONE), QUICK_SEPARATOR (TRUE), QUICK_CHECKBOX (N_("User &mini status"), &mini_user_status, &mini_user_status_id), QUICK_INPUT (panel->user_status_format[panel->list_type], "mini_input", &mini_user_format, &mini_user_format_id, FALSE, FALSE, INPUT_COMPLETE_NONE), QUICK_BUTTONS_OK_CANCEL, QUICK_END /* *INDENT-ON* */ }; quick_dialog_t qdlg = { -1, -1, 48, N_("Listing mode"), "[Listing Mode...]", quick_widgets, panel_listing_callback, NULL }; /* get hotkey of user-defined format string */ cp = strchr (_(list_types[panel_listing_user_idx]), '&'); if (cp != NULL && *++cp != '\0') listing_user_hotkey = g_ascii_tolower (*cp); mini_user_status = panel->user_mini_status; result = panel->list_type; status_format = panel->user_status_format; g_snprintf (panel_brief_cols_in, sizeof (panel_brief_cols_in), "%d", panel->brief_cols); if ((int) panel->list_type != panel_listing_brief_idx) quick_widgets[4].options = W_DISABLED; if ((int) panel->list_type != panel_listing_user_idx) quick_widgets[6].options = W_DISABLED; if (!mini_user_status) quick_widgets[9].options = W_DISABLED; if (quick_dialog (&qdlg) == B_CANCEL) result = -1; else { int cols; char *error = NULL; *userp = panel_user_format; *minip = mini_user_format; *use_msformat = mini_user_status; cols = strtol (panel_brief_cols_out, &error, 10); if (*error == '\0') *brief_cols = cols; else *brief_cols = panel->brief_cols; g_free (panel_brief_cols_out); } } if (section != NULL) { int i; g_free (panel->user_format); for (i = 0; i < LIST_TYPES; i++) g_free (panel->user_status_format[i]); g_free (panel); } return result; }
void panel_options_box (void) { int simple_swap; simple_swap = mc_config_get_bool (mc_main_config, CONFIG_PANELS_SECTION, "simple_swap", FALSE) ? 1 : 0; { const char *qsearch_options[] = { N_("Case &insensitive"), N_("Cas&e sensitive"), N_("Use panel sort mo&de") }; quick_widget_t quick_widgets[] = { /* *INDENT-OFF* */ QUICK_START_COLUMNS, QUICK_START_GROUPBOX (N_("Main options")), QUICK_CHECKBOX (N_("Show mi&ni-status"), &panels_options.show_mini_info, NULL), QUICK_CHECKBOX (N_("Use SI si&ze units"), &panels_options.kilobyte_si, NULL), QUICK_CHECKBOX (N_("Mi&x all files"), &panels_options.mix_all_files, NULL), QUICK_CHECKBOX (N_("Show &backup files"), &panels_options.show_backups, NULL), QUICK_CHECKBOX (N_("Show &hidden files"), &panels_options.show_dot_files, NULL), QUICK_CHECKBOX (N_("&Fast dir reload"), &panels_options.fast_reload, NULL), QUICK_CHECKBOX (N_("Ma&rk moves down"), &panels_options.mark_moves_down, NULL), QUICK_CHECKBOX (N_("Re&verse files only"), &panels_options.reverse_files_only, NULL), QUICK_CHECKBOX (N_("Simple s&wap"), &simple_swap, NULL), QUICK_CHECKBOX (N_("A&uto save panels setup"), &panels_options.auto_save_setup, NULL), QUICK_SEPARATOR (FALSE), QUICK_SEPARATOR (FALSE), QUICK_STOP_GROUPBOX, QUICK_NEXT_COLUMN, QUICK_START_GROUPBOX (N_("Navigation")), QUICK_CHECKBOX (N_("L&ynx-like motion"), &panels_options.navigate_with_arrows, NULL), QUICK_CHECKBOX (N_("Pa&ge scrolling"), &panels_options.scroll_pages, NULL), QUICK_CHECKBOX (N_("&Mouse page scrolling"), &panels_options.mouse_move_pages, NULL), QUICK_STOP_GROUPBOX, QUICK_START_GROUPBOX (N_("File highlight")), QUICK_CHECKBOX (N_("File &types"), &panels_options.filetype_mode, NULL), QUICK_CHECKBOX (N_("&Permissions"), &panels_options.permission_mode, NULL), QUICK_STOP_GROUPBOX, QUICK_START_GROUPBOX (N_("Quick search")), QUICK_RADIO (QSEARCH_NUM, qsearch_options, (int *) &panels_options.qsearch_mode, NULL), QUICK_STOP_GROUPBOX, QUICK_STOP_COLUMNS, QUICK_BUTTONS_OK_CANCEL, QUICK_END /* *INDENT-ON* */ }; quick_dialog_t qdlg = { -1, -1, 60, N_("Panel options"), "[Panel options]", quick_widgets, NULL, NULL }; if (quick_dialog (&qdlg) != B_ENTER) return; } mc_config_set_bool (mc_main_config, CONFIG_PANELS_SECTION, "simple_swap", (gboolean) (simple_swap & C_BOOL)); if (!panels_options.fast_reload_msg_shown && panels_options.fast_reload) { message (D_NORMAL, _("Information"), _("Using the fast reload option may not reflect the exact\n" "directory contents. In this case you'll need to do a\n" "manual reload of the directory. See the man page for\n" "the details.")); panels_options.fast_reload_msg_shown = TRUE; } update_panels (UP_RELOAD, UP_KEEPSEL); }
void configure_box (void) { const char *pause_options[] = { N_("&Never"), N_("On dum&b terminals"), N_("Alwa&ys") }; int pause_options_num; pause_options_num = G_N_ELEMENTS (pause_options); { char time_out[BUF_TINY] = ""; char *time_out_new; quick_widget_t quick_widgets[] = { /* *INDENT-OFF* */ QUICK_START_COLUMNS, QUICK_START_GROUPBOX (N_("File operations")), QUICK_CHECKBOX (N_("&Verbose operation"), &verbose, NULL), QUICK_CHECKBOX (N_("Compute tota&ls"), &file_op_compute_totals, NULL), QUICK_CHECKBOX (N_("Classic pro&gressbar"), &classic_progressbar, NULL), QUICK_CHECKBOX (N_("Mkdi&r autoname"), &auto_fill_mkdir_name, NULL), QUICK_CHECKBOX (N_("&Preallocate space"), &mc_global.vfs.preallocate_space, NULL), QUICK_STOP_GROUPBOX, QUICK_START_GROUPBOX (N_("Esc key mode")), QUICK_CHECKBOX (N_("S&ingle press"), &old_esc_mode, &configure_old_esc_mode_id), QUICK_LABELED_INPUT (N_("Timeout:"), input_label_left, (const char *) time_out, MC_HISTORY_ESC_TIMEOUT, &time_out_new, &configure_time_out_id, FALSE, FALSE, INPUT_COMPLETE_NONE), QUICK_STOP_GROUPBOX, QUICK_START_GROUPBOX (N_("Pause after run")), QUICK_RADIO (pause_options_num, pause_options, &pause_after_run, NULL), QUICK_STOP_GROUPBOX, QUICK_NEXT_COLUMN, QUICK_START_GROUPBOX (N_("Other options")), QUICK_CHECKBOX (N_("Use internal edi&t"), &use_internal_edit, NULL), QUICK_CHECKBOX (N_("Use internal vie&w"), &use_internal_view, NULL), QUICK_CHECKBOX (N_("A&sk new file name"), &editor_ask_filename_before_edit, NULL), QUICK_CHECKBOX (N_("Auto m&enus"), &auto_menu, NULL), QUICK_CHECKBOX (N_("&Drop down menus"), &drop_menus, NULL), QUICK_CHECKBOX (N_("S&hell patterns"), &easy_patterns, NULL), QUICK_CHECKBOX (N_("Co&mplete: show all"), &mc_global.widget.show_all_if_ambiguous, NULL), QUICK_CHECKBOX (N_("Rotating d&ash"), &nice_rotating_dash, NULL), QUICK_CHECKBOX (N_("Cd follows lin&ks"), &mc_global.vfs.cd_symlinks, NULL), QUICK_CHECKBOX (N_("Sa&fe delete"), &safe_delete, NULL), QUICK_CHECKBOX (N_("A&uto save setup"), &auto_save_setup, NULL), QUICK_SEPARATOR (FALSE), QUICK_SEPARATOR (FALSE), QUICK_SEPARATOR (FALSE), QUICK_STOP_GROUPBOX, QUICK_STOP_COLUMNS, QUICK_BUTTONS_OK_CANCEL, QUICK_END /* *INDENT-ON* */ }; quick_dialog_t qdlg = { -1, -1, 60, N_("Configure options"), "[Configuration]", quick_widgets, configure_callback, NULL }; g_snprintf (time_out, sizeof (time_out), "%d", old_esc_mode_timeout); #ifndef USE_INTERNAL_EDIT quick_widgets[17].options = W_DISABLED; #endif if (!old_esc_mode) quick_widgets[10].options = quick_widgets[11].options = W_DISABLED; #ifndef HAVE_POSIX_FALLOCATE mc_global.vfs.preallocate_space = FALSE; quick_widgets[7].options = W_DISABLED; #endif if (quick_dialog (&qdlg) == B_ENTER) old_esc_mode_timeout = atoi (time_out_new); g_free (time_out_new); } }
void configure_vfs (void) { char buffer2[BUF_TINY]; #ifdef ENABLE_VFS_FTP char buffer3[BUF_TINY]; g_snprintf (buffer3, sizeof (buffer3), "%i", ftpfs_directory_timeout); #endif g_snprintf (buffer2, sizeof (buffer2), "%i", vfs_timeout); { char *ret_timeout; #ifdef ENABLE_VFS_FTP char *ret_passwd; char *ret_ftp_proxy; char *ret_directory_timeout; #endif /* ENABLE_VFS_FTP */ quick_widget_t quick_widgets[] = { /* *INDENT-OFF* */ QUICK_LABELED_INPUT (N_("Timeout for freeing VFSs (sec):"), input_label_left, buffer2, "input-timo-vfs", &ret_timeout, NULL, FALSE, FALSE, INPUT_COMPLETE_NONE), #ifdef ENABLE_VFS_FTP QUICK_SEPARATOR (TRUE), QUICK_LABELED_INPUT (N_("FTP anonymous password:"******"input-passwd", &ret_passwd, NULL, FALSE, FALSE, INPUT_COMPLETE_NONE), QUICK_LABELED_INPUT (N_("FTP directory cache timeout (sec):"), input_label_left, buffer3, "input-timeout", &ret_directory_timeout, NULL, FALSE, FALSE, INPUT_COMPLETE_NONE), QUICK_CHECKBOX (N_("&Always use ftp proxy:"), &ftpfs_always_use_proxy, &ftpfs_always_use_proxy_id), QUICK_INPUT (ftpfs_proxy_host, "input-ftp-proxy", &ret_ftp_proxy, &ftpfs_proxy_host_id, FALSE, FALSE, INPUT_COMPLETE_HOSTNAMES), QUICK_CHECKBOX (N_("&Use ~/.netrc"), &ftpfs_use_netrc, NULL), QUICK_CHECKBOX (N_("Use &passive mode"), &ftpfs_use_passive_connections, NULL), QUICK_CHECKBOX (N_("Use passive mode over pro&xy"), &ftpfs_use_passive_connections_over_proxy, NULL), #endif /* ENABLE_VFS_FTP */ QUICK_BUTTONS_OK_CANCEL, QUICK_END /* *INDENT-ON* */ }; quick_dialog_t qdlg = { -1, -1, 56, N_("Virtual File System Setting"), "[Virtual FS]", quick_widgets, #ifdef ENABLE_VFS_FTP confvfs_callback, #else NULL, #endif NULL, }; #ifdef ENABLE_VFS_FTP if (!ftpfs_always_use_proxy) quick_widgets[5].options = W_DISABLED; #endif if (quick_dialog (&qdlg) != B_CANCEL) { /* cppcheck-suppress uninitvar */ vfs_timeout = atoi (ret_timeout); g_free (ret_timeout); if (vfs_timeout < 0 || vfs_timeout > 10000) vfs_timeout = 10; #ifdef ENABLE_VFS_FTP g_free (ftpfs_anonymous_passwd); /* cppcheck-suppress uninitvar */ ftpfs_anonymous_passwd = ret_passwd; g_free (ftpfs_proxy_host); /* cppcheck-suppress uninitvar */ ftpfs_proxy_host = ret_ftp_proxy; /* cppcheck-suppress uninitvar */ ftpfs_directory_timeout = atoi (ret_directory_timeout); g_free (ret_directory_timeout); #endif } } }
void edit_options_dialog (WDialog * h) { char wrap_length[16], tab_spacing[16]; char *p, *q; int wrap_mode = 0; int old_syntax_hl; #ifdef ENABLE_NLS static gboolean i18n_flag = FALSE; if (!i18n_flag) { i18n_translate_array (wrap_str); i18n_flag = TRUE; } #endif /* ENABLE_NLS */ g_snprintf (wrap_length, sizeof (wrap_length), "%d", option_word_wrap_line_length); g_snprintf (tab_spacing, sizeof (tab_spacing), "%d", option_tab_spacing); if (option_auto_para_formatting) wrap_mode = 1; else if (option_typewriter_wrap) wrap_mode = 2; else wrap_mode = 0; { quick_widget_t quick_widgets[] = { /* *INDENT-OFF* */ QUICK_START_COLUMNS, QUICK_START_GROUPBOX (N_("Wrap mode")), QUICK_RADIO (3, wrap_str, &wrap_mode, NULL), QUICK_STOP_GROUPBOX, QUICK_SEPARATOR (FALSE), QUICK_SEPARATOR (FALSE), QUICK_START_GROUPBOX (N_("Tabulation")), QUICK_CHECKBOX (N_("&Fake half tabs"), &option_fake_half_tabs, NULL), QUICK_CHECKBOX (N_("&Backspace through tabs"), &option_backspace_through_tabs, NULL), QUICK_CHECKBOX (N_("Fill tabs with &spaces"), &option_fill_tabs_with_spaces, NULL), QUICK_LABELED_INPUT (N_("Tab spacing:"), input_label_left, tab_spacing, "edit-tab-spacing", &q, NULL, FALSE, FALSE, INPUT_COMPLETE_NONE), QUICK_STOP_GROUPBOX, QUICK_NEXT_COLUMN, QUICK_START_GROUPBOX (N_("Other options")), QUICK_CHECKBOX (N_("&Return does autoindent"), &option_return_does_auto_indent, NULL), QUICK_CHECKBOX (N_("Confir&m before saving"), &edit_confirm_save, NULL), QUICK_CHECKBOX (N_("Save file &position"), &option_save_position, NULL), QUICK_CHECKBOX (N_("&Visible trailing spaces"), &visible_tws, NULL), QUICK_CHECKBOX (N_("Visible &tabs"), &visible_tabs, NULL), QUICK_CHECKBOX (N_("Synta&x highlighting"), &option_syntax_highlighting, NULL), QUICK_CHECKBOX (N_("C&ursor after inserted block"), &option_cursor_after_inserted_block, NULL), QUICK_CHECKBOX (N_("Pers&istent selection"), &option_persistent_selections, NULL), QUICK_CHECKBOX (N_("Cursor be&yond end of line"), &option_cursor_beyond_eol, NULL), QUICK_CHECKBOX (N_("&Group undo"), &option_group_undo, NULL), QUICK_LABELED_INPUT (N_("Word wrap line length:"), input_label_left, wrap_length, "edit-word-wrap", &p, NULL, FALSE, FALSE, INPUT_COMPLETE_NONE), QUICK_STOP_GROUPBOX, QUICK_STOP_COLUMNS, QUICK_BUTTONS_OK_CANCEL, QUICK_END /* *INDENT-ON* */ }; quick_dialog_t qdlg = { -1, -1, 74, N_("Editor options"), "[Editor options]", quick_widgets, NULL, NULL }; if (quick_dialog (&qdlg) == B_CANCEL) return; } old_syntax_hl = option_syntax_highlighting; if (!option_cursor_beyond_eol) g_list_foreach (h->widgets, edit_reset_over_col, NULL); if (p != NULL) { option_word_wrap_line_length = atoi (p); if (option_word_wrap_line_length <= 0) option_word_wrap_line_length = DEFAULT_WRAP_LINE_LENGTH; g_free (p); } if (q != NULL) { option_tab_spacing = atoi (q); if (option_tab_spacing <= 0) option_tab_spacing = DEFAULT_TAB_SPACING; g_free (q); } if (wrap_mode == 1) { option_auto_para_formatting = 1; option_typewriter_wrap = 0; } else if (wrap_mode == 2) { option_auto_para_formatting = 0; option_typewriter_wrap = 1; } else { option_auto_para_formatting = 0; option_typewriter_wrap = 0; } /* Load or unload syntax rules if the option has changed */ if (option_syntax_highlighting != old_syntax_hl) g_list_foreach (h->widgets, edit_reload_syntax, NULL); }