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

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