annotate src/gtk/mkdir_dialog.c @ 139:c363b08e0118

2003-4-21 Brian Masney <masneyb@gftp.org> * lib/gftp.h - added ui_cancel_function to struct gftp_option_type_var * src/gtk/gftp-gtk.c - added custom_edit_value to struct gftp_textcomboedt_widget_data * src/gtk/options_dialog.c - fixups for gftp_option_type_textcomboedt. The value will always convert %n to \n when reading in and then do the opposite conversion when saving the variable. Also, added tooltips to the options * lib/rfc959.c - remove FIXME comment
author masneyb
date Tue, 22 Apr 2003 01:42:05 +0000
parents fe0b21c006f6
children 33b394ebba68
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 {
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 56
diff changeset
29 int success, sj, network_timeout;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
30 gftp_window_data * wdata;
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
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 56
diff changeset
34 gftp_lookup_request_option (wdata->request, "network_timeout",
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 56
diff changeset
35 &network_timeout);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 56
diff changeset
36
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
37 if (wdata->request->use_threads)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
38 {
42
cd169e4789df 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 33
diff changeset
39 sj = sigsetjmp (jmp_environment, 1);
cd169e4789df 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 33
diff changeset
40 use_jmp_environment = 1;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
41 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
42 else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
43 sj = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
44
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
45 success = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
46 if (sj == 0)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
47 {
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 56
diff changeset
48 if (network_timeout > 0)
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 56
diff changeset
49 alarm (network_timeout);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
50 success = gftp_make_directory (wdata->request, edttext) == 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
51 alarm (0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
52 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
53 else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
54 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
55 gftp_disconnect (wdata->request);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
56 wdata->request->logging_function (gftp_logging_error,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
57 wdata->request->user_data,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
58 _("Operation canceled\n"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
59 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
60
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
61 if (wdata->request->use_threads)
42
cd169e4789df 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 33
diff changeset
62 use_jmp_environment = 0;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
63
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
64 wdata->request->stopable = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
65 return ((void *) success);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
66 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
67
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
68
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
69 static void
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
70 domkdir (gftp_window_data * wdata, gftp_dialog_data * ddata)
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
71 {
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
72 edttext = gtk_entry_get_text (GTK_ENTRY (ddata->edit));
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
73 if (*edttext == '\0')
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
74 {
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
75 ftp_log (gftp_logging_misc, NULL,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
76 _("Mkdir: Operation canceled...you must enter a string\n"));
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
77 return;
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
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
80 if (check_reconnect (wdata) < 0)
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
81 return;
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
82
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
83 if ((int) generic_thread (do_make_dir_thread, wdata))
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
84 {
47
eec25f215772 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 42
diff changeset
85 gftp_delete_cache_entry (wdata->request, 0);
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
86 refresh (wdata);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
87 }
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
88 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
89
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
90
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
91 void
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
92 mkdir_dialog (gpointer data)
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
93 {
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
94 gftp_window_data * wdata;
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
95
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
96 wdata = data;
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
97 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
98 wdata->request->mkdir != NULL))
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
99 return;
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
100
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
101 MakeEditDialog (_("Make Directory"), _("Enter name of directory to create"),
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
102 NULL, 1, NULL, gftp_dialog_button_create, domkdir, wdata,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
103 NULL, NULL);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
104 }
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
105