1
|
1 /*****************************************************************************/
|
|
2 /* mkdir_dialog.c - make directory dialog box and ftp routines */
|
|
3 /* Copyright (C) 1998-2002 Brian Masney <masneyb@gftp.org> */
|
|
4 /* */
|
|
5 /* This program is free software; you can redistribute it and/or modify */
|
|
6 /* it under the terms of the GNU General Public License as published by */
|
|
7 /* the Free Software Foundation; either version 2 of the License, or */
|
|
8 /* (at your option) any later version. */
|
|
9 /* */
|
|
10 /* This program is distributed in the hope that it will be useful, */
|
|
11 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
|
12 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
|
13 /* GNU General Public License for more details. */
|
|
14 /* */
|
|
15 /* You should have received a copy of the GNU General Public License */
|
|
16 /* along with this program; if not, write to the Free Software */
|
|
17 /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA */
|
|
18 /*****************************************************************************/
|
|
19
|
|
20 #include "gftp-gtk.h"
|
33
|
21 static const char cvsid[] = "$Id$";
|
1
|
22
|
|
23 static const char *edttext;
|
|
24
|
|
25
|
|
26 static void *
|
|
27 do_make_dir_thread (void * data)
|
|
28 {
|
129
|
29 int success, sj, network_timeout;
|
1
|
30 gftp_window_data * wdata;
|
|
31
|
|
32 wdata = data;
|
|
33
|
129
|
34 gftp_lookup_request_option (wdata->request, "network_timeout",
|
|
35 &network_timeout);
|
|
36
|
1
|
37 if (wdata->request->use_threads)
|
|
38 {
|
42
|
39 sj = sigsetjmp (jmp_environment, 1);
|
|
40 use_jmp_environment = 1;
|
1
|
41 }
|
|
42 else
|
|
43 sj = 0;
|
|
44
|
|
45 success = 0;
|
|
46 if (sj == 0)
|
|
47 {
|
129
|
48 if (network_timeout > 0)
|
|
49 alarm (network_timeout);
|
1
|
50 success = gftp_make_directory (wdata->request, edttext) == 0;
|
|
51 alarm (0);
|
|
52 }
|
|
53 else
|
|
54 {
|
|
55 gftp_disconnect (wdata->request);
|
|
56 wdata->request->logging_function (gftp_logging_error,
|
|
57 wdata->request->user_data,
|
|
58 _("Operation canceled\n"));
|
|
59 }
|
|
60
|
|
61 if (wdata->request->use_threads)
|
42
|
62 use_jmp_environment = 0;
|
1
|
63
|
|
64 wdata->request->stopable = 0;
|
|
65 return ((void *) success);
|
|
66 }
|
|
67
|
|
68
|
19
|
69 static void
|
|
70 domkdir (gftp_window_data * wdata, gftp_dialog_data * ddata)
|
1
|
71 {
|
19
|
72 edttext = gtk_entry_get_text (GTK_ENTRY (ddata->edit));
|
|
73 if (*edttext == '\0')
|
|
74 {
|
|
75 ftp_log (gftp_logging_misc, NULL,
|
|
76 _("Mkdir: Operation canceled...you must enter a string\n"));
|
|
77 return;
|
|
78 }
|
|
79
|
|
80 if (check_reconnect (wdata) < 0)
|
|
81 return;
|
|
82
|
|
83 if ((int) generic_thread (do_make_dir_thread, wdata))
|
|
84 {
|
47
|
85 gftp_delete_cache_entry (wdata->request, 0);
|
19
|
86 refresh (wdata);
|
|
87 }
|
1
|
88 }
|
|
89
|
19
|
90
|
|
91 void
|
|
92 mkdir_dialog (gpointer data)
|
|
93 {
|
|
94 gftp_window_data * wdata;
|
|
95
|
|
96 wdata = data;
|
|
97 if (!check_status (_("Mkdir"), wdata, wdata->request->use_threads, 0, 0,
|
|
98 wdata->request->mkdir != NULL))
|
|
99 return;
|
|
100
|
|
101 MakeEditDialog (_("Make Directory"), _("Enter name of directory to create"),
|
|
102 NULL, 1, NULL, gftp_dialog_button_create, domkdir, wdata,
|
|
103 NULL, NULL);
|
|
104 }
|
|
105
|