root/src/filemanager/boxes.c

/* [previous][next][first][last][top][bottom][index][help]  */

DEFINITIONS

This source file includes following definitions.
  1. configure_callback
  2. skin_apply
  3. skin_name_to_label
  4. skin_dlg_callback
  5. sel_skin_button
  6. appearance_box_callback
  7. panel_listing_callback
  8. sel_charset_button
  9. tree_callback
  10. confvfs_callback
  11. jobs_fill_listbox
  12. task_cb
  13. configure_box
  14. appearance_box
  15. panel_options_box
  16. panel_listing_box
  17. sort_box
  18. confirm_box
  19. display_bits_box
  20. display_bits_box
  21. tree_box
  22. configure_vfs_box
  23. cd_box
  24. symlink_box
  25. jobs_box
  26. vfs_smb_get_authinfo

   1 /*
   2    Some misc dialog boxes for the program.
   3 
   4    Copyright (C) 1994-2020
   5    Free Software Foundation, Inc.
   6 
   7    Written by:
   8    Miguel de Icaza, 1994, 1995
   9    Jakub Jelinek, 1995
  10    Andrew Borodin <aborodin@vmail.ru>, 2009-2015
  11 
  12    This file is part of the Midnight Commander.
  13 
  14    The Midnight Commander is free software: you can redistribute it
  15    and/or modify it under the terms of the GNU General Public License as
  16    published by the Free Software Foundation, either version 3 of the License,
  17    or (at your option) any later version.
  18 
  19    The Midnight Commander is distributed in the hope that it will be useful,
  20    but WITHOUT ANY WARRANTY; without even the implied warranty of
  21    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  22    GNU General Public License for more details.
  23 
  24    You should have received a copy of the GNU General Public License
  25    along with this program.  If not, see <http://www.gnu.org/licenses/>.
  26  */
  27 
  28 /** \file boxes.c
  29  *  \brief Source: Some misc dialog boxes for the program
  30  */
  31 
  32 #include <config.h>
  33 
  34 #include <ctype.h>
  35 #include <signal.h>
  36 #include <stdio.h>
  37 #include <stdlib.h>
  38 #include <string.h>
  39 #include <sys/types.h>
  40 #include <sys/stat.h>
  41 
  42 #include "lib/global.h"
  43 
  44 #include "lib/tty/tty.h"
  45 #include "lib/tty/color.h"      /* tty_use_colors() */
  46 #include "lib/tty/key.h"        /* XCTRL and ALT macros  */
  47 #include "lib/skin.h"           /* INPUT_COLOR */
  48 #include "lib/mcconfig.h"       /* Load/save user formats */
  49 #include "lib/strutil.h"
  50 
  51 #include "lib/vfs/vfs.h"
  52 #ifdef ENABLE_VFS_FTP
  53 #include "src/vfs/ftpfs/ftpfs.h"
  54 #endif /* ENABLE_VFS_FTP */
  55 #ifdef ENABLE_VFS_SMB
  56 #include "src/vfs/smbfs/smbfs.h"
  57 #endif /* ENABLE_VFS_SMB */
  58 
  59 #include "lib/util.h"           /* Q_() */
  60 #include "lib/widget.h"
  61 
  62 #include "src/setup.h"
  63 #include "src/history.h"        /* MC_HISTORY_ESC_TIMEOUT */
  64 #include "src/execute.h"        /* pause_after_run */
  65 #ifdef ENABLE_BACKGROUND
  66 #include "src/background.h"     /* task_list */
  67 #endif
  68 
  69 #ifdef HAVE_CHARSET
  70 #include "lib/charsets.h"
  71 #include "src/selcodepage.h"
  72 #endif
  73 
  74 #include "command.h"            /* For cmdline */
  75 #include "dir.h"
  76 #include "panel.h"              /* LIST_FORMATS */
  77 #include "tree.h"
  78 #include "layout.h"             /* for get_nth_panel_name proto */
  79 #include "midnight.h"           /* current_panel */
  80 
  81 #include "boxes.h"
  82 
  83 /*** global variables ****************************************************************************/
  84 
  85 /*** file scope macro definitions ****************************************************************/
  86 
  87 #ifdef ENABLE_BACKGROUND
  88 #define B_STOP   (B_USER+1)
  89 #define B_RESUME (B_USER+2)
  90 #define B_KILL   (B_USER+3)
  91 #endif /* ENABLE_BACKGROUND */
  92 
  93 /*** file scope type declarations ****************************************************************/
  94 
  95 /*** file scope variables ************************************************************************/
  96 
  97 static unsigned long configure_old_esc_mode_id, configure_time_out_id;
  98 
  99 /* Index in list_formats[] for "brief" */
 100 static const int panel_list_brief_idx = 1;
 101 /* Index in list_formats[] for "user defined" */
 102 static const int panel_list_user_idx = 3;
 103 
 104 static char **status_format;
 105 static unsigned long panel_list_formats_id, panel_user_format_id, panel_brief_cols_id;
 106 static unsigned long mini_user_status_id, mini_user_format_id;
 107 
 108 #ifdef HAVE_CHARSET
 109 static int new_display_codepage;
 110 #endif /* HAVE_CHARSET */
 111 
 112 #if defined(ENABLE_VFS) && defined(ENABLE_VFS_FTP)
 113 static unsigned long ftpfs_always_use_proxy_id, ftpfs_proxy_host_id;
 114 #endif /* ENABLE_VFS && ENABLE_VFS_FTP */
 115 
 116 static GPtrArray *skin_names;
 117 static gchar *current_skin_name;
 118 
 119 #ifdef ENABLE_BACKGROUND
 120 static WListbox *bg_list = NULL;
 121 #endif /* ENABLE_BACKGROUND */
 122 
 123 static unsigned long shadows_id;
 124 
 125 /* --------------------------------------------------------------------------------------------- */
 126 /*** file scope functions ************************************************************************/
 127 /* --------------------------------------------------------------------------------------------- */
 128 
 129 static cb_ret_t
 130 configure_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
     /* [previous][next][first][last][top][bottom][index][help]  */
 131 {
 132     switch (msg)
 133     {
 134     case MSG_NOTIFY:
 135         /* message from "Single press" checkbutton */
 136         if (sender != NULL && sender->id == configure_old_esc_mode_id)
 137         {
 138             const gboolean not_single = !CHECK (sender)->state;
 139             Widget *ww;
 140 
 141             /* input line */
 142             ww = widget_find_by_id (w, configure_time_out_id);
 143             widget_disable (ww, not_single);
 144 
 145             return MSG_HANDLED;
 146         }
 147         return MSG_NOT_HANDLED;
 148 
 149     default:
 150         return dlg_default_callback (w, sender, msg, parm, data);
 151     }
 152 }
 153 
 154 /* --------------------------------------------------------------------------------------------- */
 155 
 156 static void
 157 skin_apply (const gchar * skin_override)
     /* [previous][next][first][last][top][bottom][index][help]  */
 158 {
 159     GError *mcerror = NULL;
 160 
 161     mc_skin_deinit ();
 162     mc_skin_init (skin_override, &mcerror);
 163     mc_fhl_free (&mc_filehighlight);
 164     mc_filehighlight = mc_fhl_new (TRUE);
 165     dlg_set_default_colors ();
 166     input_set_default_colors ();
 167     if (mc_global.mc_run_mode == MC_RUN_FULL)
 168         command_set_default_colors ();
 169     panel_deinit ();
 170     panel_init ();
 171     repaint_screen ();
 172 
 173     mc_error_message (&mcerror, NULL);
 174 }
 175 
 176 /* --------------------------------------------------------------------------------------------- */
 177 
 178 static const gchar *
 179 skin_name_to_label (const gchar * name)
     /* [previous][next][first][last][top][bottom][index][help]  */
 180 {
 181     if (strcmp (name, "default") == 0)
 182         return _("< Default >");
 183     return name;
 184 }
 185 
 186 /* --------------------------------------------------------------------------------------------- */
 187 
 188 static cb_ret_t
 189 skin_dlg_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
     /* [previous][next][first][last][top][bottom][index][help]  */
 190 {
 191     switch (msg)
 192     {
 193     case MSG_RESIZE:
 194         {
 195             WDialog *d = DIALOG (w);
 196             Widget *wd = WIDGET (d->data);
 197             int y, x;
 198             WRect r;
 199 
 200             y = wd->y + (wd->lines - w->lines) / 2;
 201             x = wd->x + wd->cols / 2;
 202             rect_init (&r, y, x, w->lines, w->cols);
 203 
 204             return dlg_default_callback (w, NULL, MSG_RESIZE, 0, &r);
 205         }
 206 
 207     default:
 208         return dlg_default_callback (w, sender, msg, parm, data);
 209     }
 210 }
 211 
 212 /* --------------------------------------------------------------------------------------------- */
 213 
 214 static int
 215 sel_skin_button (WButton * button, int action)
     /* [previous][next][first][last][top][bottom][index][help]  */
 216 {
 217     int result;
 218     WListbox *skin_list;
 219     WDialog *skin_dlg;
 220     const gchar *skin_name;
 221     unsigned int i;
 222     unsigned int pos = 1;
 223 
 224     (void) action;
 225 
 226     skin_dlg =
 227         dlg_create (TRUE, 0, 0, 13, 24, WPOS_KEEP_DEFAULT, TRUE, dialog_colors, skin_dlg_callback,
 228                     NULL, "[Appearance]", _("Skins"));
 229     /* use Appearance dialog for positioning */
 230     skin_dlg->data = WIDGET (button)->owner;
 231 
 232     /* set dialog location before all */
 233     send_message (skin_dlg, NULL, MSG_RESIZE, 0, NULL);
 234 
 235     skin_list = listbox_new (1, 1, 11, 22, FALSE, NULL);
 236     skin_name = "default";
 237     listbox_add_item (skin_list, LISTBOX_APPEND_AT_END, 0, skin_name_to_label (skin_name),
 238                       (void *) skin_name, FALSE);
 239 
 240     if (strcmp (skin_name, current_skin_name) == 0)
 241         listbox_select_entry (skin_list, 0);
 242 
 243     for (i = 0; i < skin_names->len; i++)
 244     {
 245         skin_name = g_ptr_array_index (skin_names, i);
 246         if (strcmp (skin_name, "default") != 0)
 247         {
 248             listbox_add_item (skin_list, LISTBOX_APPEND_AT_END, 0, skin_name_to_label (skin_name),
 249                               (void *) skin_name, FALSE);
 250             if (strcmp (skin_name, current_skin_name) == 0)
 251                 listbox_select_entry (skin_list, pos);
 252             pos++;
 253         }
 254     }
 255 
 256     /* make list stick to all sides of dialog, effectively make it be resized with dialog */
 257     group_add_widget_autopos (GROUP (skin_dlg), skin_list, WPOS_KEEP_ALL, NULL);
 258 
 259     result = dlg_run (skin_dlg);
 260     if (result == B_ENTER)
 261     {
 262         gchar *skin_label;
 263 
 264         listbox_get_current (skin_list, &skin_label, (void **) &skin_name);
 265         g_free (current_skin_name);
 266         current_skin_name = g_strdup (skin_name);
 267         skin_apply (skin_name);
 268 
 269         button_set_text (button, str_fit_to_term (skin_label, 20, J_LEFT_FIT));
 270     }
 271     dlg_destroy (skin_dlg);
 272 
 273     return 0;
 274 }
 275 
 276 /* --------------------------------------------------------------------------------------------- */
 277 
 278 static cb_ret_t
 279 appearance_box_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
     /* [previous][next][first][last][top][bottom][index][help]  */
 280 {
 281     switch (msg)
 282     {
 283     case MSG_INIT:
 284         if (!tty_use_colors ())
 285         {
 286             Widget *shadow;
 287 
 288             shadow = widget_find_by_id (w, shadows_id);
 289             CHECK (shadow)->state = FALSE;
 290             widget_disable (shadow, TRUE);
 291         }
 292         return MSG_HANDLED;
 293 
 294     case MSG_NOTIFY:
 295         if (sender != NULL && sender->id == shadows_id)
 296         {
 297             mc_global.tty.shadows = CHECK (sender)->state;
 298             repaint_screen ();
 299             return MSG_HANDLED;
 300         }
 301         return MSG_NOT_HANDLED;
 302 
 303     default:
 304         return dlg_default_callback (w, sender, msg, parm, data);
 305     }
 306 }
 307 
 308 /* --------------------------------------------------------------------------------------------- */
 309 
 310 static cb_ret_t
 311 panel_listing_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
     /* [previous][next][first][last][top][bottom][index][help]  */
 312 {
 313     switch (msg)
 314     {
 315     case MSG_NOTIFY:
 316         if (sender != NULL && sender->id == panel_list_formats_id)
 317         {
 318             WCheck *ch;
 319             WInput *in1, *in2, *in3;
 320 
 321             in1 = INPUT (widget_find_by_id (w, panel_user_format_id));
 322             in2 = INPUT (widget_find_by_id (w, panel_brief_cols_id));
 323             ch = CHECK (widget_find_by_id (w, mini_user_status_id));
 324             in3 = INPUT (widget_find_by_id (w, mini_user_format_id));
 325 
 326             if (!ch->state)
 327                 input_assign_text (in3, status_format[RADIO (sender)->sel]);
 328             input_update (in1, FALSE);
 329             input_update (in2, FALSE);
 330             input_update (in3, FALSE);
 331             widget_disable (WIDGET (in1), RADIO (sender)->sel != panel_list_user_idx);
 332             widget_disable (WIDGET (in2), RADIO (sender)->sel != panel_list_brief_idx);
 333             return MSG_HANDLED;
 334         }
 335 
 336         if (sender != NULL && sender->id == mini_user_status_id)
 337         {
 338             WInput *in;
 339 
 340             in = INPUT (widget_find_by_id (w, mini_user_format_id));
 341 
 342             if (CHECK (sender)->state)
 343             {
 344                 widget_disable (WIDGET (in), FALSE);
 345                 input_assign_text (in, status_format[3]);
 346             }
 347             else
 348             {
 349                 WRadio *r;
 350 
 351                 r = RADIO (widget_find_by_id (w, panel_list_formats_id));
 352                 widget_disable (WIDGET (in), TRUE);
 353                 input_assign_text (in, status_format[r->sel]);
 354             }
 355             /* input_update (in, FALSE); */
 356             return MSG_HANDLED;
 357         }
 358 
 359         return MSG_NOT_HANDLED;
 360 
 361     default:
 362         return dlg_default_callback (w, sender, msg, parm, data);
 363     }
 364 }
 365 
 366 /* --------------------------------------------------------------------------------------------- */
 367 
 368 #ifdef HAVE_CHARSET
 369 static int
 370 sel_charset_button (WButton * button, int action)
     /* [previous][next][first][last][top][bottom][index][help]  */
 371 {
 372     int new_dcp;
 373 
 374     (void) action;
 375 
 376     new_dcp = select_charset (-1, -1, new_display_codepage, TRUE);
 377 
 378     if (new_dcp != SELECT_CHARSET_CANCEL)
 379     {
 380         const char *cpname;
 381 
 382         new_display_codepage = new_dcp;
 383         cpname = (new_display_codepage == SELECT_CHARSET_OTHER_8BIT) ?
 384             _("Other 8 bit") :
 385             ((codepage_desc *) g_ptr_array_index (codepages, new_display_codepage))->name;
 386         if (cpname != NULL)
 387             mc_global.utf8_display = str_isutf8 (cpname);
 388         else
 389             cpname = _("7-bit ASCII");  /* FIXME */
 390 
 391         button_set_text (button, cpname);
 392         widget_draw (WIDGET (WIDGET (button)->owner));
 393     }
 394 
 395     return 0;
 396 }
 397 #endif /* HAVE_CHARSET */
 398 
 399 /* --------------------------------------------------------------------------------------------- */
 400 
 401 static cb_ret_t
 402 tree_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
     /* [previous][next][first][last][top][bottom][index][help]  */
 403 {
 404     WDialog *h = DIALOG (w);
 405 
 406     switch (msg)
 407     {
 408     case MSG_RESIZE:
 409         {
 410             WRect r;
 411             Widget *bar;
 412 
 413             rect_init (&r, w->y, w->x, LINES - 9, COLS - 20);
 414             dlg_default_callback (w, NULL, MSG_RESIZE, 0, &r);
 415 
 416             bar = WIDGET (find_buttonbar (h));
 417             bar->x = 0;
 418             bar->y = LINES - 1;
 419             return MSG_HANDLED;
 420         }
 421 
 422     case MSG_ACTION:
 423         return send_message (find_tree (h), NULL, MSG_ACTION, parm, NULL);
 424 
 425     default:
 426         return dlg_default_callback (w, sender, msg, parm, data);
 427     }
 428 }
 429 
 430 /* --------------------------------------------------------------------------------------------- */
 431 
 432 #if defined(ENABLE_VFS) && defined (ENABLE_VFS_FTP)
 433 static cb_ret_t
 434 confvfs_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
     /* [previous][next][first][last][top][bottom][index][help]  */
 435 {
 436     switch (msg)
 437     {
 438     case MSG_NOTIFY:
 439         /* message from "Always use ftp proxy" checkbutton */
 440         if (sender != NULL && sender->id == ftpfs_always_use_proxy_id)
 441         {
 442             const gboolean not_use = !CHECK (sender)->state;
 443             Widget *wi;
 444 
 445             /* input */
 446             wi = widget_find_by_id (w, ftpfs_proxy_host_id);
 447             widget_disable (wi, not_use);
 448             return MSG_HANDLED;
 449         }
 450         return MSG_NOT_HANDLED;
 451 
 452     default:
 453         return dlg_default_callback (w, sender, msg, parm, data);
 454     }
 455 }
 456 #endif /* ENABLE_VFS && ENABLE_VFS_FTP */
 457 
 458 /* --------------------------------------------------------------------------------------------- */
 459 
 460 #ifdef ENABLE_BACKGROUND
 461 static void
 462 jobs_fill_listbox (WListbox * list)
     /* [previous][next][first][last][top][bottom][index][help]  */
 463 {
 464     static const char *state_str[2] = { "", "" };
 465     TaskList *tl;
 466 
 467     if (state_str[0][0] == '\0')
 468     {
 469         state_str[0] = _("Running");
 470         state_str[1] = _("Stopped");
 471     }
 472 
 473     for (tl = task_list; tl != NULL; tl = tl->next)
 474     {
 475         char *s;
 476 
 477         s = g_strconcat (state_str[tl->state], " ", tl->info, (char *) NULL);
 478         listbox_add_item (list, LISTBOX_APPEND_AT_END, 0, s, (void *) tl, FALSE);
 479         g_free (s);
 480     }
 481 }
 482 
 483 /* --------------------------------------------------------------------------------------------- */
 484 
 485 static int
 486 task_cb (WButton * button, int action)
     /* [previous][next][first][last][top][bottom][index][help]  */
 487 {
 488     TaskList *tl;
 489     int sig = 0;
 490 
 491     (void) button;
 492 
 493     if (bg_list->list == NULL)
 494         return 0;
 495 
 496     /* Get this instance information */
 497     listbox_get_current (bg_list, NULL, (void **) &tl);
 498 
 499 #ifdef SIGTSTP
 500     if (action == B_STOP)
 501     {
 502         sig = SIGSTOP;
 503         tl->state = Task_Stopped;
 504     }
 505     else if (action == B_RESUME)
 506     {
 507         sig = SIGCONT;
 508         tl->state = Task_Running;
 509     }
 510     else
 511 #endif
 512     if (action == B_KILL)
 513         sig = SIGKILL;
 514 
 515     if (sig == SIGKILL)
 516         unregister_task_running (tl->pid, tl->fd);
 517 
 518     kill (tl->pid, sig);
 519     listbox_remove_list (bg_list);
 520     jobs_fill_listbox (bg_list);
 521 
 522     /* This can be optimized to just redraw this widget :-) */
 523     widget_draw (WIDGET (WIDGET (button)->owner));
 524 
 525     return 0;
 526 }
 527 #endif /* ENABLE_BACKGROUND */
 528 
 529 /* --------------------------------------------------------------------------------------------- */
 530 /*** public functions ****************************************************************************/
 531 /* --------------------------------------------------------------------------------------------- */
 532 
 533 void
 534 configure_box (void)
     /* [previous][next][first][last][top][bottom][index][help]  */
 535 {
 536     const char *pause_options[] = {
 537         N_("&Never"),
 538         N_("On dum&b terminals"),
 539         N_("Alwa&ys")
 540     };
 541 
 542     int pause_options_num;
 543 
 544     pause_options_num = G_N_ELEMENTS (pause_options);
 545 
 546     {
 547         char time_out[BUF_TINY] = "";
 548         char *time_out_new;
 549 
 550         quick_widget_t quick_widgets[] = {
 551             /* *INDENT-OFF* */
 552             QUICK_START_COLUMNS,
 553                 QUICK_START_GROUPBOX (N_("File operations")),
 554                     QUICK_CHECKBOX (N_("&Verbose operation"), &verbose, NULL),
 555                     QUICK_CHECKBOX (N_("Compute tota&ls"), &file_op_compute_totals, NULL),
 556                     QUICK_CHECKBOX (N_("Classic pro&gressbar"), &classic_progressbar, NULL),
 557                     QUICK_CHECKBOX (N_("Mkdi&r autoname"), &auto_fill_mkdir_name, NULL),
 558                     QUICK_CHECKBOX (N_("&Preallocate space"), &mc_global.vfs.preallocate_space,
 559                                     NULL),
 560                 QUICK_STOP_GROUPBOX,
 561                 QUICK_START_GROUPBOX (N_("Esc key mode")),
 562                     QUICK_CHECKBOX (N_("S&ingle press"), &old_esc_mode, &configure_old_esc_mode_id),
 563                     QUICK_LABELED_INPUT (N_("Timeout:"), input_label_left,
 564                                          (const char *) time_out, MC_HISTORY_ESC_TIMEOUT,
 565                                          &time_out_new, &configure_time_out_id, FALSE, FALSE,
 566                                          INPUT_COMPLETE_NONE),
 567                 QUICK_STOP_GROUPBOX,
 568                 QUICK_START_GROUPBOX (N_("Pause after run")),
 569                     QUICK_RADIO (pause_options_num, pause_options, &pause_after_run, NULL),
 570                 QUICK_STOP_GROUPBOX,
 571             QUICK_NEXT_COLUMN,
 572                 QUICK_START_GROUPBOX (N_("Other options")),
 573                     QUICK_CHECKBOX (N_("Use internal edi&t"), &use_internal_edit, NULL),
 574                     QUICK_CHECKBOX (N_("Use internal vie&w"), &use_internal_view, NULL),
 575                     QUICK_CHECKBOX (N_("A&sk new file name"),
 576                                     &editor_ask_filename_before_edit, NULL),
 577                     QUICK_CHECKBOX (N_("Auto m&enus"), &auto_menu, NULL),
 578                     QUICK_CHECKBOX (N_("&Drop down menus"), &drop_menus, NULL),
 579                     QUICK_CHECKBOX (N_("S&hell patterns"), &easy_patterns, NULL),
 580                     QUICK_CHECKBOX (N_("Co&mplete: show all"),
 581                                     &mc_global.widget.show_all_if_ambiguous, NULL),
 582                     QUICK_CHECKBOX (N_("Rotating d&ash"), &nice_rotating_dash, NULL),
 583                     QUICK_CHECKBOX (N_("Cd follows lin&ks"), &mc_global.vfs.cd_symlinks, NULL),
 584                     QUICK_CHECKBOX (N_("Sa&fe delete"), &safe_delete, NULL),
 585                     QUICK_CHECKBOX (N_("Safe overwrite"), &safe_overwrite, NULL),       /* w/o hotkey */
 586                     QUICK_CHECKBOX (N_("A&uto save setup"), &auto_save_setup, NULL),
 587                     QUICK_SEPARATOR (FALSE),
 588                     QUICK_SEPARATOR (FALSE),
 589                 QUICK_STOP_GROUPBOX,
 590             QUICK_STOP_COLUMNS,
 591             QUICK_BUTTONS_OK_CANCEL,
 592             QUICK_END
 593             /* *INDENT-ON* */
 594         };
 595 
 596         quick_dialog_t qdlg = {
 597             -1, -1, 60,
 598             N_("Configure options"), "[Configuration]",
 599             quick_widgets, configure_callback, NULL
 600         };
 601 
 602         g_snprintf (time_out, sizeof (time_out), "%d", old_esc_mode_timeout);
 603 
 604 #ifndef USE_INTERNAL_EDIT
 605         quick_widgets[17].state = WST_DISABLED;
 606 #endif
 607 
 608         if (!old_esc_mode)
 609             quick_widgets[10].state = quick_widgets[11].state = WST_DISABLED;
 610 
 611 #ifndef HAVE_POSIX_FALLOCATE
 612         mc_global.vfs.preallocate_space = FALSE;
 613         quick_widgets[7].state = WST_DISABLED;
 614 #endif
 615 
 616         if (quick_dialog (&qdlg) == B_ENTER)
 617             old_esc_mode_timeout = atoi (time_out_new);
 618 
 619         g_free (time_out_new);
 620     }
 621 }
 622 
 623 /* --------------------------------------------------------------------------------------------- */
 624 
 625 void
 626 appearance_box (void)
     /* [previous][next][first][last][top][bottom][index][help]  */
 627 {
 628     gboolean shadows = mc_global.tty.shadows;
 629 
 630     current_skin_name = g_strdup (mc_skin__default.name);
 631     skin_names = mc_skin_list ();
 632 
 633     {
 634         quick_widget_t quick_widgets[] = {
 635             /* *INDENT-OFF* */
 636             QUICK_START_COLUMNS,
 637                 QUICK_LABEL (N_("Skin:"), NULL),
 638             QUICK_NEXT_COLUMN,
 639                 QUICK_BUTTON (str_fit_to_term (skin_name_to_label (current_skin_name), 20, J_LEFT_FIT),
 640                               B_USER, sel_skin_button, NULL),
 641             QUICK_STOP_COLUMNS,
 642             QUICK_SEPARATOR (TRUE),
 643             QUICK_CHECKBOX (N_("&Shadows"), &mc_global.tty.shadows, &shadows_id),
 644             QUICK_BUTTONS_OK_CANCEL,
 645             QUICK_END
 646             /* *INDENT-ON* */
 647         };
 648 
 649         quick_dialog_t qdlg = {
 650             -1, -1, 54,
 651             N_("Appearance"), "[Appearance]",
 652             quick_widgets, appearance_box_callback, NULL
 653         };
 654 
 655         if (quick_dialog (&qdlg) == B_ENTER)
 656             mc_config_set_string (mc_global.main_config, CONFIG_APP_SECTION, "skin",
 657                                   current_skin_name);
 658         else
 659         {
 660             skin_apply (NULL);
 661             mc_global.tty.shadows = shadows;
 662         }
 663     }
 664 
 665     g_free (current_skin_name);
 666     g_ptr_array_foreach (skin_names, (GFunc) g_free, NULL);
 667     g_ptr_array_free (skin_names, TRUE);
 668 }
 669 
 670 /* --------------------------------------------------------------------------------------------- */
 671 
 672 void
 673 panel_options_box (void)
     /* [previous][next][first][last][top][bottom][index][help]  */
 674 {
 675     gboolean simple_swap;
 676 
 677     simple_swap = mc_config_get_bool (mc_global.main_config, CONFIG_PANELS_SECTION,
 678                                       "simple_swap", FALSE);
 679     {
 680         const char *qsearch_options[] = {
 681             N_("Case &insensitive"),
 682             N_("Cas&e sensitive"),
 683             N_("Use panel sort mo&de")
 684         };
 685 
 686         quick_widget_t quick_widgets[] = {
 687             /* *INDENT-OFF* */
 688             QUICK_START_COLUMNS,
 689                 QUICK_START_GROUPBOX (N_("Main options")),
 690                     QUICK_CHECKBOX (N_("Show mi&ni-status"), &panels_options.show_mini_info, NULL),
 691                     QUICK_CHECKBOX (N_("Use SI si&ze units"), &panels_options.kilobyte_si, NULL),
 692                     QUICK_CHECKBOX (N_("Mi&x all files"), &panels_options.mix_all_files, NULL),
 693                     QUICK_CHECKBOX (N_("Show &backup files"), &panels_options.show_backups, NULL),
 694                     QUICK_CHECKBOX (N_("Show &hidden files"), &panels_options.show_dot_files, NULL),
 695                     QUICK_CHECKBOX (N_("&Fast dir reload"), &panels_options.fast_reload, NULL),
 696                     QUICK_CHECKBOX (N_("Ma&rk moves down"), &panels_options.mark_moves_down, NULL),
 697                     QUICK_CHECKBOX (N_("Re&verse files only"), &panels_options.reverse_files_only,
 698                                     NULL),
 699                     QUICK_CHECKBOX (N_("Simple s&wap"), &simple_swap, NULL),
 700                     QUICK_CHECKBOX (N_("A&uto save panels setup"), &panels_options.auto_save_setup,
 701                                     NULL),
 702                     QUICK_SEPARATOR (FALSE),
 703                     QUICK_SEPARATOR (FALSE),
 704                     QUICK_SEPARATOR (FALSE),
 705                 QUICK_STOP_GROUPBOX,
 706             QUICK_NEXT_COLUMN,
 707                 QUICK_START_GROUPBOX (N_("Navigation")),
 708                     QUICK_CHECKBOX (N_("L&ynx-like motion"), &panels_options.navigate_with_arrows,
 709                                     NULL),
 710                     QUICK_CHECKBOX (N_("Pa&ge scrolling"), &panels_options.scroll_pages, NULL),
 711                     QUICK_CHECKBOX (N_("Center &scrolling"), &panels_options.scroll_center, NULL),
 712                     QUICK_CHECKBOX (N_("&Mouse page scrolling"), &panels_options.mouse_move_pages,
 713                                     NULL),
 714                 QUICK_STOP_GROUPBOX,
 715                 QUICK_START_GROUPBOX (N_("File highlight")),
 716                     QUICK_CHECKBOX (N_("File &types"), &panels_options.filetype_mode, NULL),
 717                     QUICK_CHECKBOX (N_("&Permissions"), &panels_options.permission_mode, NULL),
 718                 QUICK_STOP_GROUPBOX,
 719                 QUICK_START_GROUPBOX (N_("Quick search")),
 720                     QUICK_RADIO (QSEARCH_NUM, qsearch_options, (int *) &panels_options.qsearch_mode,
 721                                  NULL),
 722                 QUICK_STOP_GROUPBOX,
 723             QUICK_STOP_COLUMNS,
 724             QUICK_BUTTONS_OK_CANCEL,
 725             QUICK_END
 726             /* *INDENT-ON* */
 727         };
 728 
 729         quick_dialog_t qdlg = {
 730             -1, -1, 60,
 731             N_("Panel options"), "[Panel options]",
 732             quick_widgets, NULL, NULL
 733         };
 734 
 735         if (quick_dialog (&qdlg) != B_ENTER)
 736             return;
 737     }
 738 
 739     mc_config_set_bool (mc_global.main_config, CONFIG_PANELS_SECTION, "simple_swap", simple_swap);
 740 
 741     if (!panels_options.fast_reload_msg_shown && panels_options.fast_reload)
 742     {
 743         message (D_NORMAL, _("Information"),
 744                  _("Using the fast reload option may not reflect the exact\n"
 745                    "directory contents. In this case you'll need to do a\n"
 746                    "manual reload of the directory. See the man page for\n" "the details."));
 747         panels_options.fast_reload_msg_shown = TRUE;
 748     }
 749 
 750     update_panels (UP_RELOAD, UP_KEEPSEL);
 751 }
 752 
 753 /* --------------------------------------------------------------------------------------------- */
 754 
 755 /* return list type */
 756 int
 757 panel_listing_box (WPanel * panel, int num, char **userp, char **minip, gboolean * use_msformat,
     /* [previous][next][first][last][top][bottom][index][help]  */
 758                    int *brief_cols)
 759 {
 760     int result = -1;
 761     const char *p = NULL;
 762 
 763     if (panel == NULL)
 764     {
 765         p = get_nth_panel_name (num);
 766         panel = panel_empty_new (p);
 767     }
 768 
 769     {
 770         gboolean mini_user_status;
 771         char panel_brief_cols_in[BUF_TINY];
 772         char *panel_brief_cols_out = NULL;
 773         char *panel_user_format = NULL;
 774         char *mini_user_format = NULL;
 775 
 776         /* Controls whether the array strings have been translated */
 777         const char *list_formats[LIST_FORMATS] = {
 778             N_("&Full file list"),
 779             N_("&Brief file list:"),
 780             N_("&Long file list"),
 781             N_("&User defined:")
 782         };
 783 
 784         quick_widget_t quick_widgets[] = {
 785             /* *INDENT-OFF* */
 786             QUICK_START_COLUMNS,
 787                 QUICK_RADIO (LIST_FORMATS, list_formats, &result, &panel_list_formats_id),
 788             QUICK_NEXT_COLUMN,
 789                 QUICK_SEPARATOR (FALSE),
 790                 QUICK_LABELED_INPUT (_ ("columns"), input_label_right, panel_brief_cols_in,
 791                                      "panel-brief-cols-input", &panel_brief_cols_out,
 792                                      &panel_brief_cols_id, FALSE, FALSE, INPUT_COMPLETE_NONE),
 793             QUICK_STOP_COLUMNS,
 794             QUICK_INPUT (panel->user_format, "user-fmt-input", &panel_user_format,
 795                          &panel_user_format_id, FALSE, FALSE, INPUT_COMPLETE_NONE),
 796             QUICK_SEPARATOR (TRUE),
 797             QUICK_CHECKBOX (N_("User &mini status"), &mini_user_status, &mini_user_status_id),
 798             QUICK_INPUT (panel->user_status_format[panel->list_format], "mini_input",
 799                          &mini_user_format, &mini_user_format_id, FALSE, FALSE, INPUT_COMPLETE_NONE),
 800             QUICK_BUTTONS_OK_CANCEL,
 801             QUICK_END
 802             /* *INDENT-ON* */
 803         };
 804 
 805         quick_dialog_t qdlg = {
 806             -1, -1, 48,
 807             N_("Listing format"), "[Listing Format...]",
 808             quick_widgets, panel_listing_callback, NULL
 809         };
 810 
 811         mini_user_status = panel->user_mini_status;
 812         result = panel->list_format;
 813         status_format = panel->user_status_format;
 814 
 815         g_snprintf (panel_brief_cols_in, sizeof (panel_brief_cols_in), "%d", panel->brief_cols);
 816 
 817         if ((int) panel->list_format != panel_list_brief_idx)
 818             quick_widgets[4].state = WST_DISABLED;
 819 
 820         if ((int) panel->list_format != panel_list_user_idx)
 821             quick_widgets[6].state = WST_DISABLED;
 822 
 823         if (!mini_user_status)
 824             quick_widgets[9].state = WST_DISABLED;
 825 
 826         if (quick_dialog (&qdlg) == B_CANCEL)
 827             result = -1;
 828         else
 829         {
 830             int cols;
 831             char *error = NULL;
 832 
 833             *userp = panel_user_format;
 834             *minip = mini_user_format;
 835             *use_msformat = mini_user_status;
 836 
 837             cols = strtol (panel_brief_cols_out, &error, 10);
 838             if (*error == '\0')
 839                 *brief_cols = cols;
 840             else
 841                 *brief_cols = panel->brief_cols;
 842 
 843             g_free (panel_brief_cols_out);
 844         }
 845     }
 846 
 847     if (p != NULL)
 848     {
 849         int i;
 850 
 851         g_free (panel->user_format);
 852         for (i = 0; i < LIST_FORMATS; i++)
 853             g_free (panel->user_status_format[i]);
 854         g_free (panel);
 855     }
 856 
 857     return result;
 858 }
 859 
 860 /* --------------------------------------------------------------------------------------------- */
 861 
 862 const panel_field_t *
 863 sort_box (dir_sort_options_t * op, const panel_field_t * sort_field)
     /* [previous][next][first][last][top][bottom][index][help]  */
 864 {
 865     char **sort_orders_names;
 866     gsize i;
 867     gsize sort_names_num = 0;
 868     int sort_idx = 0;
 869     const panel_field_t *result = NULL;
 870 
 871     sort_orders_names = panel_get_sortable_fields (&sort_names_num);
 872 
 873     for (i = 0; i < sort_names_num; i++)
 874         if (strcmp (sort_orders_names[i], _(sort_field->title_hotkey)) == 0)
 875         {
 876             sort_idx = i;
 877             break;
 878         }
 879 
 880     {
 881         quick_widget_t quick_widgets[] = {
 882             /* *INDENT-OFF* */
 883             QUICK_START_COLUMNS,
 884                 QUICK_RADIO (sort_names_num, (const char **) sort_orders_names, &sort_idx, NULL),
 885             QUICK_NEXT_COLUMN,
 886                 QUICK_CHECKBOX (N_("Executable &first"), &op->exec_first, NULL),
 887                 QUICK_CHECKBOX (N_("Cas&e sensitive"), &op->case_sensitive, NULL),
 888                 QUICK_CHECKBOX (N_("&Reverse"), &op->reverse, NULL),
 889             QUICK_STOP_COLUMNS,
 890             QUICK_BUTTONS_OK_CANCEL,
 891             QUICK_END
 892             /* *INDENT-ON* */
 893         };
 894 
 895         quick_dialog_t qdlg = {
 896             -1, -1, 40,
 897             N_("Sort order"), "[Sort Order...]",
 898             quick_widgets, NULL, NULL
 899         };
 900 
 901         if (quick_dialog (&qdlg) != B_CANCEL)
 902             result = panel_get_field_by_title_hotkey (sort_orders_names[sort_idx]);
 903 
 904         if (result == NULL)
 905             result = sort_field;
 906     }
 907 
 908     g_strfreev (sort_orders_names);
 909 
 910     return result;
 911 }
 912 
 913 /* --------------------------------------------------------------------------------------------- */
 914 
 915 void
 916 confirm_box (void)
     /* [previous][next][first][last][top][bottom][index][help]  */
 917 {
 918     quick_widget_t quick_widgets[] = {
 919         /* *INDENT-OFF* */
 920         /* TRANSLATORS: no need to translate 'Confirmation', it's just a context prefix */
 921         QUICK_CHECKBOX (Q_("Confirmation|&Delete"), &confirm_delete, NULL),
 922         QUICK_CHECKBOX (Q_("Confirmation|O&verwrite"), &confirm_overwrite, NULL),
 923         QUICK_CHECKBOX (Q_("Confirmation|&Execute"), &confirm_execute, NULL),
 924         QUICK_CHECKBOX (Q_("Confirmation|E&xit"), &confirm_exit, NULL),
 925         QUICK_CHECKBOX (Q_("Confirmation|Di&rectory hotlist delete"),
 926                         &confirm_directory_hotlist_delete, NULL),
 927         QUICK_CHECKBOX (Q_("Confirmation|&History cleanup"),
 928                         &mc_global.widget.confirm_history_cleanup, NULL),
 929         QUICK_BUTTONS_OK_CANCEL,
 930         QUICK_END
 931         /* *INDENT-ON* */
 932     };
 933 
 934     quick_dialog_t qdlg = {
 935         -1, -1, 46,
 936         N_("Confirmation"), "[Confirmation]",
 937         quick_widgets, NULL, NULL
 938     };
 939 
 940     (void) quick_dialog (&qdlg);
 941 }
 942 
 943 /* --------------------------------------------------------------------------------------------- */
 944 
 945 #ifndef HAVE_CHARSET
 946 void
 947 display_bits_box (void)
     /* [previous][next][first][last][top][bottom][index][help]  */
 948 {
 949     gboolean new_meta;
 950     int current_mode;
 951 
 952     const char *display_bits_str[] = {
 953         N_("&UTF-8 output"),
 954         N_("&Full 8 bits output"),
 955         N_("&ISO 8859-1"),
 956         N_("7 &bits")
 957     };
 958 
 959     quick_widget_t quick_widgets[] = {
 960         /* *INDENT-OFF* */
 961         QUICK_RADIO (4, display_bits_str, &current_mode, NULL),
 962         QUICK_SEPARATOR (TRUE),
 963         QUICK_CHECKBOX (N_("F&ull 8 bits input"), &new_meta, NULL),
 964         QUICK_BUTTONS_OK_CANCEL,
 965         QUICK_END
 966         /* *INDENT-ON* */
 967     };
 968 
 969     quick_dialog_t qdlg = {
 970         -1, -1, 46,
 971         _("Display bits"), "[Display bits]",
 972         quick_widgets, NULL, NULL
 973     };
 974 
 975     if (mc_global.full_eight_bits)
 976         current_mode = 0;
 977     else if (mc_global.eight_bit_clean)
 978         current_mode = 1;
 979     else
 980         current_mode = 2;
 981 
 982     new_meta = !use_8th_bit_as_meta;
 983 
 984     if (quick_dialog (&qdlg) != B_CANCEL)
 985     {
 986         mc_global.eight_bit_clean = current_mode < 3;
 987         mc_global.full_eight_bits = current_mode < 2;
 988 #ifndef HAVE_SLANG
 989         tty_display_8bit (mc_global.eight_bit_clean);
 990 #else
 991         tty_display_8bit (mc_global.full_eight_bits);
 992 #endif
 993         use_8th_bit_as_meta = !new_meta;
 994     }
 995 }
 996 
 997 /* --------------------------------------------------------------------------------------------- */
 998 #else /* HAVE_CHARSET */
 999 
1000 void
1001 display_bits_box (void)
     /* [previous][next][first][last][top][bottom][index][help]  */
1002 {
1003     const char *cpname;
1004 
1005     new_display_codepage = mc_global.display_codepage;
1006 
1007     cpname = (new_display_codepage < 0) ? _("Other 8 bit")
1008         : ((codepage_desc *) g_ptr_array_index (codepages, new_display_codepage))->name;
1009 
1010     {
1011         gboolean new_meta;
1012 
1013         quick_widget_t quick_widgets[] = {
1014             /* *INDENT-OFF* */
1015             QUICK_START_COLUMNS,
1016                 QUICK_LABEL (N_("Input / display codepage:"), NULL),
1017             QUICK_NEXT_COLUMN,
1018                 QUICK_BUTTON (cpname, B_USER, sel_charset_button, NULL),
1019             QUICK_STOP_COLUMNS,
1020             QUICK_SEPARATOR (TRUE),
1021                 QUICK_CHECKBOX (N_("F&ull 8 bits input"), &new_meta, NULL),
1022             QUICK_BUTTONS_OK_CANCEL,
1023             QUICK_END
1024             /* *INDENT-ON* */
1025         };
1026 
1027         quick_dialog_t qdlg = {
1028             -1, -1, 46,
1029             N_("Display bits"), "[Display bits]",
1030             quick_widgets, NULL, NULL
1031         };
1032 
1033         new_meta = !use_8th_bit_as_meta;
1034         application_keypad_mode ();
1035 
1036         if (quick_dialog (&qdlg) == B_ENTER)
1037         {
1038             char *errmsg;
1039 
1040             mc_global.display_codepage = new_display_codepage;
1041 
1042             errmsg = init_translation_table (mc_global.source_codepage, mc_global.display_codepage);
1043             if (errmsg != NULL)
1044             {
1045                 message (D_ERROR, MSG_ERROR, "%s", errmsg);
1046                 g_free (errmsg);
1047             }
1048 
1049 #ifdef HAVE_SLANG
1050             tty_display_8bit (mc_global.display_codepage != 0 && mc_global.display_codepage != 1);
1051 #else
1052             tty_display_8bit (mc_global.display_codepage != 0);
1053 #endif
1054             use_8th_bit_as_meta = !new_meta;
1055 
1056             repaint_screen ();
1057         }
1058     }
1059 }
1060 #endif /* HAVE_CHARSET */
1061 
1062 /* --------------------------------------------------------------------------------------------- */
1063 /** Show tree in a box, not on a panel */
1064 
1065 char *
1066 tree_box (const char *current_dir)
     /* [previous][next][first][last][top][bottom][index][help]  */
1067 {
1068     WTree *mytree;
1069     WDialog *dlg;
1070     WGroup *g;
1071     Widget *wd;
1072     char *val = NULL;
1073     WButtonBar *bar;
1074 
1075     (void) current_dir;
1076 
1077     /* Create the components */
1078     dlg = dlg_create (TRUE, 0, 0, LINES - 9, COLS - 20, WPOS_CENTER, FALSE, dialog_colors,
1079                       tree_callback, NULL, "[Directory Tree]", _("Directory tree"));
1080     g = GROUP (dlg);
1081     wd = WIDGET (dlg);
1082 
1083     mytree = tree_new (2, 2, wd->lines - 6, wd->cols - 5, FALSE);
1084     group_add_widget_autopos (g, mytree, WPOS_KEEP_ALL, NULL);
1085     group_add_widget_autopos (g, hline_new (wd->lines - 4, 1, -1), WPOS_KEEP_BOTTOM, NULL);
1086     bar = buttonbar_new (TRUE);
1087     group_add_widget (g, bar);
1088     /* restore ButtonBar coordinates after add_widget() */
1089     WIDGET (bar)->x = 0;
1090     WIDGET (bar)->y = LINES - 1;
1091 
1092     if (dlg_run (dlg) == B_ENTER)
1093     {
1094         const vfs_path_t *selected_name;
1095 
1096         selected_name = tree_selected_name (mytree);
1097         val = g_strdup (vfs_path_as_str (selected_name));
1098     }
1099 
1100     dlg_destroy (dlg);
1101     return val;
1102 }
1103 
1104 /* --------------------------------------------------------------------------------------------- */
1105 
1106 #ifdef ENABLE_VFS
1107 void
1108 configure_vfs_box (void)
     /* [previous][next][first][last][top][bottom][index][help]  */
1109 {
1110     char buffer2[BUF_TINY];
1111 #ifdef ENABLE_VFS_FTP
1112     char buffer3[BUF_TINY];
1113 
1114     g_snprintf (buffer3, sizeof (buffer3), "%i", ftpfs_directory_timeout);
1115 #endif
1116 
1117     g_snprintf (buffer2, sizeof (buffer2), "%i", vfs_timeout);
1118 
1119     {
1120         char *ret_timeout;
1121 #ifdef ENABLE_VFS_FTP
1122         char *ret_passwd;
1123         char *ret_ftp_proxy;
1124         char *ret_directory_timeout;
1125 #endif /* ENABLE_VFS_FTP */
1126 
1127         quick_widget_t quick_widgets[] = {
1128             /* *INDENT-OFF* */
1129             QUICK_LABELED_INPUT (N_("Timeout for freeing VFSs (sec):"), input_label_left,
1130                                  buffer2, "input-timo-vfs", &ret_timeout, NULL, FALSE, FALSE,
1131                                  INPUT_COMPLETE_NONE),
1132 #ifdef ENABLE_VFS_FTP
1133             QUICK_SEPARATOR (TRUE),
1134             QUICK_LABELED_INPUT (N_("FTP anonymous password:"), input_label_left,
1135                                  ftpfs_anonymous_passwd, "input-passwd", &ret_passwd, NULL,
1136                                  FALSE, FALSE, INPUT_COMPLETE_NONE),
1137             QUICK_LABELED_INPUT (N_("FTP directory cache timeout (sec):"), input_label_left,
1138                                  buffer3, "input-timeout", &ret_directory_timeout, NULL,
1139                                  FALSE, FALSE, INPUT_COMPLETE_NONE),
1140             QUICK_CHECKBOX (N_("&Always use ftp proxy:"), &ftpfs_always_use_proxy,
1141                             &ftpfs_always_use_proxy_id),
1142             QUICK_INPUT (ftpfs_proxy_host, "input-ftp-proxy", &ret_ftp_proxy,
1143                          &ftpfs_proxy_host_id, FALSE, FALSE, INPUT_COMPLETE_HOSTNAMES),
1144             QUICK_CHECKBOX (N_("&Use ~/.netrc"), &ftpfs_use_netrc, NULL),
1145             QUICK_CHECKBOX (N_("Use &passive mode"), &ftpfs_use_passive_connections, NULL),
1146             QUICK_CHECKBOX (N_("Use passive mode over pro&xy"),
1147                             &ftpfs_use_passive_connections_over_proxy, NULL),
1148 #endif /* ENABLE_VFS_FTP */
1149             QUICK_BUTTONS_OK_CANCEL,
1150             QUICK_END
1151             /* *INDENT-ON* */
1152         };
1153 
1154         quick_dialog_t qdlg = {
1155             -1, -1, 56,
1156             N_("Virtual File System Setting"), "[Virtual FS]",
1157             quick_widgets,
1158 #ifdef ENABLE_VFS_FTP
1159             confvfs_callback,
1160 #else
1161             NULL,
1162 #endif
1163             NULL,
1164         };
1165 
1166 #ifdef ENABLE_VFS_FTP
1167         if (!ftpfs_always_use_proxy)
1168             quick_widgets[5].state = WST_DISABLED;
1169 #endif
1170 
1171         if (quick_dialog (&qdlg) != B_CANCEL)
1172         {
1173             /* cppcheck-suppress uninitvar */
1174             vfs_timeout = atoi (ret_timeout);
1175             g_free (ret_timeout);
1176 
1177             if (vfs_timeout < 0 || vfs_timeout > 10000)
1178                 vfs_timeout = 10;
1179 #ifdef ENABLE_VFS_FTP
1180             g_free (ftpfs_anonymous_passwd);
1181             /* cppcheck-suppress uninitvar */
1182             ftpfs_anonymous_passwd = ret_passwd;
1183             g_free (ftpfs_proxy_host);
1184             /* cppcheck-suppress uninitvar */
1185             ftpfs_proxy_host = ret_ftp_proxy;
1186             /* cppcheck-suppress uninitvar */
1187             ftpfs_directory_timeout = atoi (ret_directory_timeout);
1188             g_free (ret_directory_timeout);
1189 #endif
1190         }
1191     }
1192 }
1193 
1194 #endif /* ENABLE_VFS */
1195 
1196 /* --------------------------------------------------------------------------------------------- */
1197 
1198 char *
1199 cd_box (void)
     /* [previous][next][first][last][top][bottom][index][help]  */
1200 {
1201     const Widget *w = CONST_WIDGET (current_panel);
1202     char *my_str;
1203 
1204     quick_widget_t quick_widgets[] = {
1205         QUICK_LABELED_INPUT (N_("cd"), input_label_left, "", "input", &my_str, NULL, FALSE, TRUE,
1206                              INPUT_COMPLETE_FILENAMES | INPUT_COMPLETE_CD),
1207         QUICK_END
1208     };
1209 
1210     quick_dialog_t qdlg = {
1211         w->y + w->lines - 6, w->x, w->cols,
1212         N_("Quick cd"), "[Quick cd]",
1213         quick_widgets, NULL, NULL
1214     };
1215 
1216     return (quick_dialog (&qdlg) != B_CANCEL) ? my_str : NULL;
1217 }
1218 
1219 /* --------------------------------------------------------------------------------------------- */
1220 
1221 void
1222 symlink_box (const vfs_path_t * existing_vpath, const vfs_path_t * new_vpath,
     /* [previous][next][first][last][top][bottom][index][help]  */
1223              char **ret_existing, char **ret_new)
1224 {
1225     quick_widget_t quick_widgets[] = {
1226         /* *INDENT-OFF* */
1227         QUICK_LABELED_INPUT (N_("Existing filename (filename symlink will point to):"),
1228                              input_label_above, vfs_path_as_str (existing_vpath), "input-2",
1229                              ret_existing, NULL, FALSE, FALSE, INPUT_COMPLETE_FILENAMES),
1230         QUICK_SEPARATOR (FALSE),
1231         QUICK_LABELED_INPUT (N_("Symbolic link filename:"), input_label_above,
1232                              vfs_path_as_str (new_vpath), "input-1",
1233                              ret_new, NULL, FALSE, FALSE, INPUT_COMPLETE_FILENAMES),
1234         QUICK_BUTTONS_OK_CANCEL,
1235         QUICK_END
1236         /* *INDENT-ON* */
1237     };
1238 
1239     quick_dialog_t qdlg = {
1240         -1, -1, 64,
1241         N_("Symbolic link"), "[File Menu]",
1242         quick_widgets, NULL, NULL
1243     };
1244 
1245     if (quick_dialog (&qdlg) == B_CANCEL)
1246     {
1247         *ret_new = NULL;
1248         *ret_existing = NULL;
1249     }
1250 }
1251 
1252 /* --------------------------------------------------------------------------------------------- */
1253 
1254 #ifdef ENABLE_BACKGROUND
1255 void
1256 jobs_box (void)
     /* [previous][next][first][last][top][bottom][index][help]  */
1257 {
1258     struct
1259     {
1260         const char *name;
1261         int flags;
1262         int value;
1263         int len;
1264         bcback_fn callback;
1265     }
1266     job_but[] =
1267     {
1268         /* *INDENT-OFF* */
1269         { N_("&Stop"), NORMAL_BUTTON, B_STOP, 0, task_cb },
1270         { N_("&Resume"), NORMAL_BUTTON, B_RESUME, 0, task_cb },
1271         { N_("&Kill"), NORMAL_BUTTON, B_KILL, 0, task_cb },
1272         { N_("&OK"), DEFPUSH_BUTTON, B_CANCEL, 0, NULL }
1273         /* *INDENT-ON* */
1274     };
1275 
1276     size_t i;
1277     const size_t n_but = G_N_ELEMENTS (job_but);
1278 
1279     WDialog *jobs_dlg;
1280     WGroup *g;
1281     int cols = 60;
1282     int lines = 15;
1283     int x = 0;
1284 
1285     for (i = 0; i < n_but; i++)
1286     {
1287 #ifdef ENABLE_NLS
1288         job_but[i].name = _(job_but[i].name);
1289 #endif /* ENABLE_NLS */
1290 
1291         job_but[i].len = str_term_width1 (job_but[i].name) + 3;
1292         if (job_but[i].flags == DEFPUSH_BUTTON)
1293             job_but[i].len += 2;
1294         x += job_but[i].len;
1295     }
1296 
1297     x += (int) n_but - 1;
1298     cols = MAX (cols, x + 6);
1299 
1300     jobs_dlg = dlg_create (TRUE, 0, 0, lines, cols, WPOS_CENTER, FALSE, dialog_colors, NULL, NULL,
1301                            "[Background jobs]", _("Background jobs"));
1302     g = GROUP (jobs_dlg);
1303 
1304     bg_list = listbox_new (2, 2, lines - 6, cols - 6, FALSE, NULL);
1305     jobs_fill_listbox (bg_list);
1306     group_add_widget (g, bg_list);
1307 
1308     group_add_widget (g, hline_new (lines - 4, -1, -1));
1309 
1310     x = (cols - x) / 2;
1311     for (i = 0; i < n_but; i++)
1312     {
1313         group_add_widget (g, button_new (lines - 3, x, job_but[i].value, job_but[i].flags,
1314                                          job_but[i].name, job_but[i].callback));
1315         x += job_but[i].len + 1;
1316     }
1317 
1318     (void) dlg_run (jobs_dlg);
1319     dlg_destroy (jobs_dlg);
1320 }
1321 #endif /* ENABLE_BACKGROUND */
1322 
1323 /* --------------------------------------------------------------------------------------------- */
1324 
1325 #ifdef ENABLE_VFS_SMB
1326 struct smb_authinfo *
1327 vfs_smb_get_authinfo (const char *host, const char *share, const char *domain, const char *user)
     /* [previous][next][first][last][top][bottom][index][help]  */
1328 {
1329     char *label;
1330     struct smb_authinfo *return_value = NULL;
1331 
1332     if (domain == NULL)
1333         domain = "";
1334     if (user == NULL)
1335         user = "";
1336 
1337     label = g_strdup_printf (_("Password for \\\\%s\\%s"), host, share);
1338 
1339     {
1340         char *ret_domain, *ret_user, *ret_password;
1341 
1342         quick_widget_t quick_widgets[] = {
1343             /* *INDENT-OFF* */
1344             QUICK_LABEL (label, NULL),
1345             QUICK_SEPARATOR (TRUE),
1346             QUICK_START_COLUMNS,
1347                 QUICK_LABEL (N_("Domain:"), NULL),
1348                 QUICK_SEPARATOR (FALSE),
1349                 QUICK_LABEL (N_("Username:"), NULL),
1350                 QUICK_SEPARATOR (FALSE),
1351                 QUICK_LABEL (N_("Password:"), NULL),
1352             QUICK_NEXT_COLUMN,
1353                 QUICK_INPUT (domain, "auth_domain", &ret_domain, NULL, FALSE, FALSE, INPUT_COMPLETE_HOSTNAMES),
1354                 QUICK_SEPARATOR (FALSE),
1355                 QUICK_INPUT (user, "auth_name", &ret_user, NULL, FALSE, FALSE, INPUT_COMPLETE_USERNAMES),
1356                 QUICK_SEPARATOR (FALSE),
1357                 QUICK_INPUT ("", "auth_password", &ret_password, NULL, TRUE, FALSE, INPUT_COMPLETE_NONE),
1358             QUICK_STOP_COLUMNS,
1359             QUICK_BUTTONS_OK_CANCEL,
1360             QUICK_END
1361             /* *INDENT-ON* */
1362         };
1363 
1364         quick_dialog_t qdlg = {
1365             -1, -1, 40,
1366             N_("SMB authentication"), "[Smb Authinfo]",
1367             quick_widgets, NULL, NULL
1368         };
1369 
1370         if (quick_dialog (&qdlg) != B_CANCEL)
1371         {
1372             return_value = vfs_smb_authinfo_new (host, share, ret_domain, ret_user, ret_password);
1373 
1374             g_free (ret_domain);
1375             g_free (ret_user);
1376             g_free (ret_password);
1377         }
1378     }
1379 
1380     g_free (label);
1381 
1382     return return_value;
1383 }
1384 #endif /* ENABLE_VFS_SMB */
1385 
1386 /* --------------------------------------------------------------------------------------------- */

/* [previous][next][first][last][top][bottom][index][help]  */