annotate src/gtk/mkdir_dialog.c @ 43:36e2868ce8b7

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