annotate src/gtk/mkdir_dialog.c @ 19:3b2dcdefc7e9

2002-09-15 Brian Masney <masneyb@gftp.org> * lib/gftp.h (struct gftp_transfer) - changed the type of numfiles and numdirs from unsigned long to long. This must be a signed field. This is a bug I introduced a few days ago. * lib/local.c (local_put_file) - remove the + off of the ab mode to fdopen. This is also a bug I introduced a few days ago. * src/gtk/transfer.c (gftp_gtk_calc_kbs) - make sure that the variable difftime isn't a negative number when computing the KB/s * src/gtk/menu-items.c (save_directory_listing) - remove casts to GTK_OBJECT for the str variable * src/gtk/gftp-gtk.c - use GTK_STOCK_* icons in place of left.xpm, right.xpm, up.xpm, down.xpm and stop.xpm in GTK+ 2.0 port * src/gtk/bookmarks.c - show GTK_STOCK_* icons on the popup menu * src/gtk/bookmarks.c, src/gtk/chmod_dialog.c, src/gtk/menu-items.c, src/gtk/misc-gtk.c, src/gtk/options_dialog.c and src/gtk/view_dialog.c - use gtk_dialog_new_with_buttons in GTK+ 2.0 port to create the dialog. Also, associate gFTP icon with this dialog * src/gtk/misc-gtk.c - changed the interface of MakeEditDialog and MakeYesNoDialog. In the GTK+ 2.0 port, I now use stock icons in the dialog buttons.
author masneyb
date Mon, 16 Sep 2002 12:27:50 +0000
parents 8b1883341c6f
children c8ec7877432e
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"
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
21
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
22 static const char *edttext;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
23 static sigjmp_buf mkdirenvir;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
24
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
25
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
26 static RETSIGTYPE
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
27 sig_mkdirquit (int signo)
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
28 {
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
29 signal (signo, sig_mkdirquit);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
30 siglongjmp (mkdirenvir, signo == SIGINT ? 1 : 2);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
31 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
32
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
33
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
34 static void *
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
35 do_make_dir_thread (void * data)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
36 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
37 gftp_window_data * wdata;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
38 int success, sj;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
39
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
40 wdata = data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
41 wdata->request->user_data = (void *) 0x01;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
42
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
43 if (wdata->request->use_threads)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
44 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
45 sj = sigsetjmp (mkdirenvir, 1);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
46 signal (SIGINT, sig_mkdirquit);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
47 signal (SIGALRM, sig_mkdirquit);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
48 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
49 else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
50 sj = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
51
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
52 success = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
53 if (sj == 0)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
54 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
55 if (wdata->request->network_timeout > 0)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
56 alarm (wdata->request->network_timeout);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
57 success = gftp_make_directory (wdata->request, edttext) == 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
58 alarm (0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
59 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
60 else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
61 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
62 gftp_disconnect (wdata->request);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
63 wdata->request->logging_function (gftp_logging_error,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
64 wdata->request->user_data,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
65 _("Operation canceled\n"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
66 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
67
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
68 if (wdata->request->use_threads)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
69 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
70 signal (SIGINT, SIG_DFL);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
71 signal (SIGALRM, SIG_IGN);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
72 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
73
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
74 wdata->request->user_data = NULL;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
75 wdata->request->stopable = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
76 return ((void *) success);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
77 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
78
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
79
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
80 static void
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
81 domkdir (gftp_window_data * wdata, gftp_dialog_data * ddata)
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
82 {
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
83 edttext = gtk_entry_get_text (GTK_ENTRY (ddata->edit));
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
84 if (*edttext == '\0')
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
85 {
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
86 ftp_log (gftp_logging_misc, NULL,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
87 _("Mkdir: Operation canceled...you must enter a string\n"));
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
88 return;
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
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
91 if (check_reconnect (wdata) < 0)
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
92 return;
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 if ((int) generic_thread (do_make_dir_thread, 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 gftp_delete_cache_entry (wdata->request);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
97 refresh (wdata);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
98 }
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
99 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
100
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
101
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
102 void
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
103 mkdir_dialog (gpointer data)
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 gftp_window_data * wdata;
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
106
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
107 wdata = data;
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
108 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
109 wdata->request->mkdir != NULL))
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
110 return;
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
111
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
112 MakeEditDialog (_("Make Directory"), _("Enter name of directory to create"),
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
113 NULL, 1, NULL, gftp_dialog_button_create, domkdir, wdata,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
114 NULL, NULL);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
115 }
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
116