2 Some misc dialog boxes for the program.
4 Copyright (C) 1994, 1995, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
5 2005, 2006, 2009, 2010, 2011, 2012
6 The Free Software Foundation, Inc.
9 Miguel de Icaza, 1994, 1995
11 Andrew Borodin <aborodin@vmail.ru>, 2009, 2010, 2011, 2012
13 This file is part of the Midnight Commander.
15 The Midnight Commander is free software: you can redistribute it
16 and/or modify it under the terms of the GNU General Public License as
17 published by the Free Software Foundation, either version 3 of the License,
18 or (at your option) any later version.
20 The Midnight Commander is distributed in the hope that it will be useful,
21 but WITHOUT ANY WARRANTY; without even the implied warranty of
22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 GNU General Public License for more details.
25 You should have received a copy of the GNU General Public License
26 along with this program. If not, see <http://www.gnu.org/licenses/>.
30 * \brief Source: Some misc dialog boxes for the program
40 #include <sys/types.h>
43 #include "lib/global.h"
45 #include "lib/tty/tty.h"
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"
51 #include "lib/vfs/vfs.h"
53 #include "src/vfs/ftpfs/ftpfs.h"
54 #endif /* ENABLE_VFS_FTP */
56 #include "src/vfs/smbfs/smbfs.h"
57 #endif /* ENABLE_VFS_SMB */
59 #include "lib/util.h" /* Q_() */
60 #include "lib/widget.h"
62 #include "src/setup.h" /* For profile_name */
63 #ifdef ENABLE_BACKGROUND
64 #include "src/background.h" /* task_list */
68 #include "lib/charsets.h"
69 #include "src/selcodepage.h"
72 #include "command.h" /* For cmdline */
74 #include "panel.h" /* LIST_TYPES */
76 #include "layout.h" /* for get_nth_panel_name proto */
77 #include "midnight.h" /* current_panel */
81 /*** global variables ****************************************************************************/
83 /*** file scope macro definitions ****************************************************************/
85 #ifdef ENABLE_BACKGROUND
86 #define B_STOP (B_USER+1)
87 #define B_RESUME (B_USER+2)
88 #define B_KILL (B_USER+3)
90 #endif /* ENABLE_BACKGROUND */
92 /*** file scope type declarations ****************************************************************/
94 /*** file scope variables ************************************************************************/
96 /* Index in list_types[] for "user defined" */
97 static const int panel_listing_user_idx
= 3;
99 static char **status_format
;
100 static int listing_user_hotkey
= 'u';
101 static unsigned long panel_listing_types_id
, panel_user_format_id
;
102 static unsigned long mini_user_status_id
, mini_user_format_id
;
105 static int new_display_codepage
;
106 static unsigned long disp_bits_name_id
;
107 #endif /* HAVE_CHARSET */
109 #if defined(ENABLE_VFS) && defined(ENABLE_VFS_FTP)
110 static unsigned long ftpfs_always_use_proxy_id
, ftpfs_proxy_host_id
;
111 #endif /* ENABLE_VFS && ENABLE_VFS_FTP */
113 #ifdef ENABLE_BACKGROUND
114 static int JOBS_X
= 60;
115 static WListbox
*bg_list
;
116 static Dlg_head
*jobs_dlg
;
118 static int task_cb (WButton
* button
, int action
);
130 { N_("&Stop"), 3, B_STOP
, task_cb
},
131 { N_("&Resume"), 12, B_RESUME
, task_cb
},
132 { N_("&Kill"), 23, B_KILL
, task_cb
},
133 { N_("&OK"), 35, B_CANCEL
, NULL
}
137 #endif /* ENABLE_BACKGROUND */
139 /* --------------------------------------------------------------------------------------------- */
140 /*** file scope functions ************************************************************************/
141 /* --------------------------------------------------------------------------------------------- */
144 panel_listing_callback (Dlg_head
* h
, Widget
* sender
, dlg_msg_t msg
, int parm
, void *data
)
153 wi
= dlg_find_by_id (h
, panel_listing_types_id
);
154 if (dlg_widget_active (wi
))
158 in
= (WInput
*) dlg_find_by_id (h
, mini_user_format_id
);
159 input_assign_text (in
, status_format
[((WRadio
*) wi
)->sel
]);
164 wi
= dlg_find_by_id (h
, panel_user_format_id
);
165 if (dlg_widget_active (wi
))
167 h
->ret_value
= B_USER
+ 6;
172 wi
= dlg_find_by_id (h
, mini_user_format_id
);
173 if (dlg_widget_active (wi
))
175 h
->ret_value
= B_USER
+ 7;
181 if (g_ascii_tolower (parm
) == listing_user_hotkey
)
185 wi
= dlg_find_by_id (h
, panel_user_format_id
);
186 if (dlg_widget_active (wi
))
188 wi
= dlg_find_by_id (h
, mini_user_format_id
);
189 if (dlg_widget_active (wi
))
193 r
= (WRadio
*) dlg_find_by_id (h
, panel_listing_types_id
);
194 r
->pos
= r
->sel
= panel_listing_user_idx
;
195 dlg_select_widget (WIDGET (r
)); /* force redraw */
196 h
->callback (h
, WIDGET (r
), DLG_ACTION
, 0, NULL
);
201 return MSG_NOT_HANDLED
;
204 if (sender
!= NULL
&& sender
->id
== panel_listing_types_id
)
209 in1
= (WInput
*) dlg_find_by_id (h
, panel_user_format_id
);
210 ch
= (WCheck
*) dlg_find_by_id (h
, mini_user_status_id
);
211 in2
= (WInput
*) dlg_find_by_id (h
, mini_user_format_id
);
213 if (!(ch
->state
& C_BOOL
))
214 input_assign_text (in2
, status_format
[((WRadio
*) sender
)->sel
]);
215 input_update (in2
, FALSE
);
216 input_update (in1
, FALSE
);
217 widget_disable (WIDGET (in1
), ((WRadio
*) sender
)->sel
!= panel_listing_user_idx
);
221 if (sender
!= NULL
&& sender
->id
== mini_user_status_id
)
225 in
= (WInput
*) dlg_find_by_id (h
, mini_user_format_id
);
227 if (((WCheck
*) sender
)->state
& C_BOOL
)
229 widget_disable (WIDGET (in
), FALSE
);
230 input_assign_text (in
, status_format
[3]);
236 r
= (WRadio
*) dlg_find_by_id (h
, panel_listing_types_id
);
237 widget_disable (WIDGET (in
), TRUE
);
238 input_assign_text (in
, status_format
[r
->sel
]);
240 /* input_update (in, FALSE); */
244 return MSG_NOT_HANDLED
;
247 return default_dlg_callback (h
, sender
, msg
, parm
, data
);
251 /* --------------------------------------------------------------------------------------------- */
255 sel_charset_button (WButton
* button
, int action
)
261 new_dcp
= select_charset (-1, -1, new_display_codepage
, TRUE
);
263 if (new_dcp
!= SELECT_CHARSET_CANCEL
)
269 new_display_codepage
= new_dcp
;
270 cpname
= (new_display_codepage
== SELECT_CHARSET_OTHER_8BIT
) ?
272 ((codepage_desc
*) g_ptr_array_index (codepages
, new_display_codepage
))->name
;
274 mc_global
.utf8_display
= str_isutf8 (cpname
);
275 /* avoid strange bug with label repainting */
276 g_snprintf (buf
, sizeof (buf
), "%-27s", cpname
);
277 w
= dlg_find_by_id (WIDGET (button
)->owner
, disp_bits_name_id
);
278 label_set_text ((WLabel
*) w
, buf
);
283 #endif /* HAVE_CHARSET */
285 /* --------------------------------------------------------------------------------------------- */
288 tree_callback (Dlg_head
* h
, Widget
* sender
, dlg_msg_t msg
, int parm
, void *data
)
293 /* The enter key will be processed by the tree widget */
296 h
->ret_value
= B_ENTER
;
302 return send_message (WIDGET (find_tree (h
)), NULL
, WIDGET_COMMAND
, parm
, NULL
);
305 return default_dlg_callback (h
, sender
, msg
, parm
, data
);
309 /* --------------------------------------------------------------------------------------------- */
311 #if defined(ENABLE_VFS) && defined (ENABLE_VFS_FTP)
313 confvfs_callback (Dlg_head
* h
, Widget
* sender
, dlg_msg_t msg
, int parm
, void *data
)
318 /* message from "Always use ftp proxy" checkbutton */
319 if (sender
!= NULL
&& sender
->id
== ftpfs_always_use_proxy_id
)
321 const gboolean not_use
= !(((WCheck
*) sender
)->state
& C_BOOL
);
325 w
= dlg_find_by_id (h
, ftpfs_proxy_host_id
);
326 widget_disable (w
, not_use
);
329 return MSG_NOT_HANDLED
;
332 return default_dlg_callback (h
, sender
, msg
, parm
, data
);
335 #endif /* ENABLE_VFS && ENABLE_VFS_FTP */
337 /* --------------------------------------------------------------------------------------------- */
339 #ifdef ENABLE_BACKGROUND
341 jobs_fill_listbox (void)
343 static const char *state_str
[2];
344 TaskList
*tl
= task_list
;
348 state_str
[0] = _("Running");
349 state_str
[1] = _("Stopped");
356 s
= g_strconcat (state_str
[tl
->state
], " ", tl
->info
, (char *) NULL
);
357 listbox_add_item (bg_list
, LISTBOX_APPEND_AT_END
, 0, s
, (void *) tl
);
363 /* --------------------------------------------------------------------------------------------- */
366 task_cb (WButton
* button
, int action
)
373 if (bg_list
->list
== NULL
)
376 /* Get this instance information */
377 listbox_get_current (bg_list
, NULL
, (void **) &tl
);
380 if (action
== B_STOP
)
383 tl
->state
= Task_Stopped
;
385 else if (action
== B_RESUME
)
388 tl
->state
= Task_Running
;
392 if (action
== B_KILL
)
398 unregister_task_running (tl
->pid
, tl
->fd
);
401 listbox_remove_list (bg_list
);
402 jobs_fill_listbox ();
404 /* This can be optimized to just redraw this widget :-) */
405 dlg_redraw (jobs_dlg
);
409 #endif /* ENABLE_BACKGROUND */
411 /* --------------------------------------------------------------------------------------------- */
412 /*** public functions ****************************************************************************/
413 /* --------------------------------------------------------------------------------------------- */
415 /* return list type */
417 panel_listing_box (WPanel
* panel
, char **userp
, char **minip
, int *use_msformat
, int num
)
420 char *section
= NULL
;
427 p
= get_nth_panel_name (num
);
428 panel
= g_new (WPanel
, 1);
429 panel
->list_type
= list_full
;
430 panel
->user_format
= g_strdup (DEFAULT_USER_FORMAT
);
431 panel
->user_mini_status
= 0;
432 for (i
= 0; i
< LIST_TYPES
; i
++)
433 panel
->user_status_format
[i
] = g_strdup (DEFAULT_USER_FORMAT
);
434 section
= g_strconcat ("Temporal:", p
, (char *) NULL
);
435 if (!mc_config_has_group (mc_main_config
, section
))
438 section
= g_strdup (p
);
440 panel_load_setup (panel
, section
);
445 int mini_user_status
;
446 char *panel_user_format
;
447 char *mini_user_format
;
450 /* Controls whether the array strings have been translated */
451 const char *list_types
[LIST_TYPES
] = {
452 N_("&Full file list"),
453 N_("&Brief file list"),
454 N_("&Long file list"),
458 quick_widget_t quick_widgets
[] = {
460 QUICK_RADIO (LIST_TYPES
, list_types
, &result
, &panel_listing_types_id
),
461 QUICK_INPUT (panel
->user_format
, INPUT_COMPLETE_DEFAULT
, "user-fmt-input",
462 &panel_user_format
, &panel_user_format_id
),
463 QUICK_SEPARATOR (TRUE
),
464 QUICK_CHECKBOX (N_("User &mini status"), &mini_user_status
, &mini_user_status_id
),
465 QUICK_INPUT (panel
->user_status_format
[panel
->list_type
], INPUT_COMPLETE_DEFAULT
,
466 "mini_input", &mini_user_format
, &mini_user_format_id
),
467 QUICK_BUTTONS_OK_CANCEL
,
472 quick_dialog_t qdlg
= {
474 N_("Listing mode"), "[Listing Mode...]",
475 quick_widgets
, panel_listing_callback
, NULL
478 /* get hotkey of user-defined format string */
479 cp
= strchr (_(list_types
[panel_listing_user_idx
]), '&');
480 if (cp
!= NULL
&& *++cp
!= '\0')
481 listing_user_hotkey
= g_ascii_tolower (*cp
);
483 mini_user_status
= panel
->user_mini_status
;
484 result
= panel
->list_type
;
485 status_format
= panel
->user_status_format
;
487 if (panel
->list_type
!= panel_listing_user_idx
)
488 quick_widgets
[1].options
= W_DISABLED
;
490 if (!mini_user_status
)
491 quick_widgets
[4].options
= W_DISABLED
;
493 if (quick_dialog (&qdlg
) == B_CANCEL
)
497 *userp
= panel_user_format
;
498 *minip
= mini_user_format
;
499 *use_msformat
= mini_user_status
;
507 g_free (panel
->user_format
);
508 for (i
= 0; i
< LIST_TYPES
; i
++)
509 g_free (panel
->user_status_format
[i
]);
516 /* --------------------------------------------------------------------------------------------- */
518 const panel_field_t
*
519 sort_box (panel_sort_info_t
* info
)
521 const char **sort_orders_names
;
522 gsize sort_names_num
, i
;
524 const panel_field_t
*result
= info
->sort_field
;
526 sort_orders_names
= panel_get_sortable_fields (&sort_names_num
);
528 for (i
= 0; i
< sort_names_num
; i
++)
529 if (strcmp (sort_orders_names
[i
], _(info
->sort_field
->title_hotkey
)) == 0)
536 quick_widget_t quick_widgets
[] = {
539 QUICK_RADIO (sort_names_num
, sort_orders_names
, &sort_idx
, NULL
),
541 QUICK_CHECKBOX (N_("Executable &first"), &info
->exec_first
, NULL
),
542 QUICK_CHECKBOX (N_("Case sensi&tive"), &info
->case_sensitive
, NULL
),
543 QUICK_CHECKBOX (N_("&Reverse"), &info
->reverse
, NULL
),
545 QUICK_BUTTONS_OK_CANCEL
,
550 quick_dialog_t qdlg
= {
552 N_("Sort order"), "[Sort Order...]",
553 quick_widgets
, NULL
, NULL
556 if (quick_dialog (&qdlg
) != B_CANCEL
)
557 result
= panel_get_field_by_title_hotkey (sort_orders_names
[sort_idx
]);
560 result
= info
->sort_field
;
563 g_strfreev ((gchar
**) sort_orders_names
);
568 /* --------------------------------------------------------------------------------------------- */
573 quick_widget_t quick_widgets
[] = {
575 /* TRANSLATORS: no need to translate 'Confirmation', it's just a context prefix */
576 QUICK_CHECKBOX (N_("Confirmation|&Delete"), &confirm_delete
, NULL
),
577 QUICK_CHECKBOX (N_("Confirmation|O&verwrite"), &confirm_overwrite
, NULL
),
578 QUICK_CHECKBOX (N_("Confirmation|&Execute"), &confirm_execute
, NULL
),
579 QUICK_CHECKBOX (N_("Confirmation|E&xit"), &confirm_exit
, NULL
),
580 QUICK_CHECKBOX (N_("Confirmation|Di&rectory hotlist delete"),
581 &confirm_directory_hotlist_delete
, NULL
),
582 QUICK_CHECKBOX (N_("Confirmation|&History cleanup"),
583 &mc_global
.widget
.confirm_history_cleanup
, NULL
),
584 QUICK_BUTTONS_OK_CANCEL
,
589 quick_dialog_t qdlg
= {
591 N_("Confirmation"), "[Confirmation]",
592 quick_widgets
, NULL
, NULL
595 (void) quick_dialog (&qdlg
);
598 /* --------------------------------------------------------------------------------------------- */
602 display_bits_box (void)
607 const char *display_bits_str
[] = {
609 N_("&Full 8 bits output"),
614 quick_widget_t quick_widgets
[] = {
616 QUICK_RADIO (4, display_bits_str
, ¤t_mode
, NULL
),
617 QUICK_SEPARATOR (TRUE
),
618 QUICK_CHECKBOX (N_("F&ull 8 bits input"), &new_meta
, NULL
),
619 QUICK_BUTTONS_OK_CANCEL
,
624 quick_dialog_t qdlg
= {
626 _("Display bits"), "[Display bits]",
627 quick_widgets
, NULL
, NULL
630 if (mc_global
.full_eight_bits
)
632 else if (mc_global
.eight_bit_clean
)
637 new_meta
= !use_8th_bit_as_meta
;
639 if (quick_dialog (&qdlg
) != B_CANCEL
)
641 mc_global
.eight_bit_clean
= current_mode
< 3;
642 mc_global
.full_eight_bits
= current_mode
< 2;
644 meta (stdscr
, mc_global
.eight_bit_clean
);
646 SLsmg_Display_Eight_Bit
= mc_global
.full_eight_bits
? 128 : 160;
648 use_8th_bit_as_meta
= !new_meta
;
652 /* --------------------------------------------------------------------------------------------- */
653 #else /* HAVE_CHARSET */
656 display_bits_box (void)
660 cpname
= (new_display_codepage
< 0) ? _("Other 8 bit")
661 : ((codepage_desc
*) g_ptr_array_index (codepages
, new_display_codepage
))->name
;
663 new_display_codepage
= mc_global
.display_codepage
;
668 quick_widget_t quick_widgets
[] = {
671 QUICK_LABEL (N_("Input / display codepage:"), NULL
),
675 QUICK_LABEL (cpname
, &disp_bits_name_id
),
677 QUICK_BUTTON (N_("&Select"), B_USER
, sel_charset_button
, NULL
),
679 QUICK_SEPARATOR (TRUE
),
680 QUICK_CHECKBOX (N_("F&ull 8 bits input"), &new_meta
, NULL
),
681 QUICK_BUTTONS_OK_CANCEL
,
686 quick_dialog_t qdlg
= {
688 N_("Display bits"), "[Display bits]",
689 quick_widgets
, NULL
, NULL
692 new_meta
= !use_8th_bit_as_meta
;
693 application_keypad_mode ();
695 if (quick_dialog (&qdlg
) == B_ENTER
)
699 mc_global
.display_codepage
= new_display_codepage
;
701 errmsg
= init_translation_table (mc_global
.source_codepage
, mc_global
.display_codepage
);
704 message (D_ERROR
, MSG_ERROR
, "%s", errmsg
);
709 tty_display_8bit (mc_global
.display_codepage
!= 0 && mc_global
.display_codepage
!= 1);
711 tty_display_8bit (mc_global
.display_codepage
!= 0);
713 use_8th_bit_as_meta
= !new_meta
;
719 #endif /* HAVE_CHARSET */
721 /* --------------------------------------------------------------------------------------------- */
722 /** Show tree in a box, not on a panel */
725 tree_box (const char *current_dir
)
735 /* Create the components */
736 dlg
= create_dlg (TRUE
, 0, 0, LINES
- 9, COLS
- 20, dialog_colors
,
737 tree_callback
, NULL
, "[Directory Tree]",
738 _("Directory tree"), DLG_CENTER
| DLG_REVERSE
);
741 mytree
= tree_new (2, 2, wd
->lines
- 6, wd
->cols
- 5, FALSE
);
742 add_widget (dlg
, mytree
);
743 add_widget (dlg
, hline_new (wd
->lines
- 4, 1, -1));
744 bar
= buttonbar_new (TRUE
);
745 add_widget (dlg
, bar
);
746 /* restore ButtonBar coordinates after add_widget() */
748 WIDGET (bar
)->y
= LINES
- 1;
750 if (run_dlg (dlg
) == B_ENTER
)
751 val
= vfs_path_to_str (tree_selected_name (mytree
));
757 /* --------------------------------------------------------------------------------------------- */
763 char buffer2
[BUF_TINY
];
764 #ifdef ENABLE_VFS_FTP
765 char buffer3
[BUF_TINY
];
767 g_snprintf (buffer3
, sizeof (buffer3
), "%i", ftpfs_directory_timeout
);
770 g_snprintf (buffer2
, sizeof (buffer2
), "%i", vfs_timeout
);
774 #ifdef ENABLE_VFS_FTP
777 char *ret_directory_timeout
;
778 #endif /* ENABLE_VFS_FTP */
780 quick_widget_t quick_widgets
[] = {
782 QUICK_LABELED_INPUT (N_("Timeout for freeing VFSs (sec):"), input_label_left
,
783 buffer2
, 0, "input-timo-vfs", &ret_timeout
, NULL
),
784 #ifdef ENABLE_VFS_FTP
785 QUICK_SEPARATOR (TRUE
),
786 QUICK_LABELED_INPUT (N_("FTP anonymous password:"), input_label_left
,
787 ftpfs_anonymous_passwd
, 0, "input-passwd", &ret_passwd
, NULL
),
788 QUICK_LABELED_INPUT (N_("FTP directory cache timeout (sec):"), input_label_left
,
789 buffer3
, 0, "input-timeout", &ret_directory_timeout
, NULL
),
790 QUICK_CHECKBOX (N_("&Always use ftp proxy:"), &ftpfs_always_use_proxy
,
791 &ftpfs_always_use_proxy_id
),
792 QUICK_INPUT (ftpfs_proxy_host
, 0, "input-ftp-proxy", &ret_ftp_proxy
,
793 &ftpfs_proxy_host_id
),
794 QUICK_CHECKBOX (N_("&Use ~/.netrc"), &ftpfs_use_netrc
, NULL
),
795 QUICK_CHECKBOX (N_("Use &passive mode"), &ftpfs_use_passive_connections
, NULL
),
796 QUICK_CHECKBOX (N_("Use passive mode over pro&xy"),
797 &ftpfs_use_passive_connections_over_proxy
, NULL
),
798 #endif /* ENABLE_VFS_FTP */
799 QUICK_BUTTONS_OK_CANCEL
,
804 quick_dialog_t qdlg
= {
806 N_("Virtual File System Setting"), "[Virtual FS]",
808 #ifdef ENABLE_VFS_FTP
816 #ifdef ENABLE_VFS_FTP
817 if (!ftpfs_always_use_proxy
)
818 quick_widgets
[5].options
= W_DISABLED
;
821 if (quick_dialog (&qdlg
) != B_CANCEL
)
823 vfs_timeout
= atoi (ret_timeout
);
824 g_free (ret_timeout
);
826 if (vfs_timeout
< 0 || vfs_timeout
> 10000)
828 #ifdef ENABLE_VFS_FTP
829 g_free (ftpfs_anonymous_passwd
);
830 ftpfs_anonymous_passwd
= ret_passwd
;
831 g_free (ftpfs_proxy_host
);
832 ftpfs_proxy_host
= ret_ftp_proxy
;
833 ftpfs_directory_timeout
= atoi (ret_directory_timeout
);
834 g_free (ret_directory_timeout
);
840 #endif /* ENABLE_VFS */
842 /* --------------------------------------------------------------------------------------------- */
847 const Widget
*w
= WIDGET (current_panel
);
850 quick_widget_t quick_widgets
[] = {
851 QUICK_LABELED_INPUT (N_("cd"), input_label_left
, "", 2, "input", &my_str
, NULL
),
855 quick_dialog_t qdlg
= {
856 w
->y
+ w
->lines
- 6, w
->x
, w
->cols
,
857 N_("Quick cd"), "[Quick cd]",
858 quick_widgets
, NULL
, NULL
861 return (quick_dialog (&qdlg
) != B_CANCEL
) ? my_str
: NULL
;
864 /* --------------------------------------------------------------------------------------------- */
867 symlink_dialog (const vfs_path_t
* existing_vpath
, const vfs_path_t
* new_vpath
,
868 char **ret_existing
, char **ret_new
)
873 existing
= vfs_path_to_str (existing_vpath
);
874 new = vfs_path_to_str (new_vpath
);
877 quick_widget_t quick_widgets
[] = {
879 QUICK_LABELED_INPUT (N_("Existing filename (filename symlink will point to):"),
881 existing
, 0, "input-2", ret_existing
, NULL
),
882 QUICK_SEPARATOR (FALSE
),
883 QUICK_LABELED_INPUT (N_("Symbolic link filename:"), input_label_above
,
884 new, 0, "input-1", ret_new
, NULL
),
885 QUICK_BUTTONS_OK_CANCEL
,
890 quick_dialog_t qdlg
= {
892 N_("Symbolic link"), "[File Menu]",
893 quick_widgets
, NULL
, NULL
896 if (quick_dialog (&qdlg
) == B_CANCEL
)
899 *ret_existing
= NULL
;
907 /* --------------------------------------------------------------------------------------------- */
909 #ifdef ENABLE_BACKGROUND
914 int n_buttons
= sizeof (job_buttons
) / sizeof (job_buttons
[0]);
917 static int i18n_flag
= 0;
920 int startx
= job_buttons
[0].xpos
;
923 for (i
= 0; i
< n_buttons
; i
++)
925 job_buttons
[i
].name
= _(job_buttons
[i
].name
);
927 len
= str_term_width1 (job_buttons
[i
].name
) + 4;
928 JOBS_X
= max (JOBS_X
, startx
+ len
+ 3);
930 job_buttons
[i
].xpos
= startx
;
934 /* Last button - Ok a.k.a. Cancel :) */
935 job_buttons
[n_buttons
- 1].xpos
=
936 JOBS_X
- str_term_width1 (job_buttons
[n_buttons
- 1].name
) - 7;
940 #endif /* ENABLE_NLS */
942 jobs_dlg
= create_dlg (TRUE
, 0, 0, JOBS_Y
, JOBS_X
, dialog_colors
, NULL
, NULL
,
943 "[Background jobs]", _("Background Jobs"), DLG_CENTER
| DLG_REVERSE
);
945 bg_list
= listbox_new (2, 3, JOBS_Y
- 9, JOBS_X
- 7, FALSE
, NULL
);
946 add_widget (jobs_dlg
, bg_list
);
951 add_widget (jobs_dlg
, button_new (JOBS_Y
- 4,
952 job_buttons
[i
].xpos
, job_buttons
[i
].value
,
953 NORMAL_BUTTON
, job_buttons
[i
].name
,
954 job_buttons
[i
].callback
));
957 /* Insert all of task information in the list */
958 jobs_fill_listbox ();
961 destroy_dlg (jobs_dlg
);
963 #endif /* ENABLE_BACKGROUND */
965 /* --------------------------------------------------------------------------------------------- */
967 #ifdef ENABLE_VFS_SMB
968 struct smb_authinfo
*
969 vfs_smb_get_authinfo (const char *host
, const char *share
, const char *domain
, const char *user
)
972 struct smb_authinfo
*return_value
= NULL
;
979 label
= g_strdup_printf (_("Password for \\\\%s\\%s"), host
, share
);
982 char *ret_domain
, *ret_user
, *ret_password
;
984 quick_widget_t quick_widgets
[] = {
986 QUICK_LABEL (label
, NULL
),
987 QUICK_SEPARATOR (TRUE
),
989 QUICK_LABEL (N_("Domain:"), NULL
),
990 QUICK_SEPARATOR (FALSE
),
991 QUICK_LABEL (N_("Username:"), NULL
),
992 QUICK_SEPARATOR (FALSE
),
993 QUICK_LABEL (N_("Password:"), NULL
),
995 QUICK_INPUT (domain
, 0, "auth_domain", &ret_domain
, NULL
),
996 QUICK_SEPARATOR (FALSE
),
997 QUICK_INPUT (user
, 0, "auth_name", &ret_user
, NULL
),
998 QUICK_SEPARATOR (FALSE
),
999 QUICK_INPUT ("", 1, "auth_password", &ret_password
, NULL
),
1001 QUICK_BUTTONS_OK_CANCEL
,
1006 quick_dialog_t qdlg
= {
1008 N_("SMB authentication"), "[Smb Authinfo]",
1009 quick_widgets
, NULL
, NULL
1012 if (quick_dialog (&qdlg
) != B_CANCEL
)
1014 return_value
= vfs_smb_authinfo_new (host
, share
, ret_domain
, ret_user
, ret_password
);
1016 g_free (ret_domain
);
1018 g_free (ret_password
);
1024 return return_value
;
1026 #endif /* ENABLE_VFS_SMB */
1028 /* --------------------------------------------------------------------------------------------- */