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

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

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