comparison 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
comparison
equal deleted inserted replaced
18:6b2e606554aa 19:3b2dcdefc7e9
17 /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA */ 17 /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA */
18 /*****************************************************************************/ 18 /*****************************************************************************/
19 19
20 #include "gftp-gtk.h" 20 #include "gftp-gtk.h"
21 21
22 static void domkdir ( GtkWidget * widget,
23 gftp_dialog_data * data );
24 static void *do_make_dir_thread ( void * data );
25 static RETSIGTYPE sig_mkdirquit ( int signo );
26
27 static const char *edttext; 22 static const char *edttext;
28 static sigjmp_buf mkdirenvir; 23 static sigjmp_buf mkdirenvir;
29 24
30 void 25
31 mkdir_dialog (gpointer data) 26 static RETSIGTYPE
27 sig_mkdirquit (int signo)
32 { 28 {
33 gftp_window_data * wdata; 29 signal (signo, sig_mkdirquit);
34 30 siglongjmp (mkdirenvir, signo == SIGINT ? 1 : 2);
35 wdata = data;
36 if (!check_status (_("Mkdir"), wdata, wdata->request->use_threads, 0, 0,
37 wdata->request->mkdir != NULL))
38 return;
39
40 MakeEditDialog (_("Make Directory"), _("Enter name of directory to create"),
41 NULL, 1, 1, NULL, _("Create"), domkdir, wdata,
42 _(" Cancel "), NULL, NULL);
43 } 31 }
44
45
46 static void
47 domkdir (GtkWidget * widget, gftp_dialog_data * data)
48 {
49 gftp_window_data * wdata;
50
51 wdata = data->data;
52 edttext = gtk_entry_get_text (GTK_ENTRY (data->edit));
53 if (*edttext == '\0')
54 {
55 ftp_log (gftp_logging_misc, NULL,
56 _("Mkdir: Operation canceled...you must enter a string\n"));
57 return;
58 }
59
60 if (check_reconnect (wdata) < 0)
61 return;
62
63 if ((int) generic_thread (do_make_dir_thread, wdata))
64 {
65 gftp_delete_cache_entry (wdata->request);
66 refresh (wdata);
67 }
68 }
69
70 32
71 33
72 static void * 34 static void *
73 do_make_dir_thread (void * data) 35 do_make_dir_thread (void * data)
74 { 36 {
113 wdata->request->stopable = 0; 75 wdata->request->stopable = 0;
114 return ((void *) success); 76 return ((void *) success);
115 } 77 }
116 78
117 79
118 static RETSIGTYPE 80 static void
119 sig_mkdirquit (int signo) 81 domkdir (gftp_window_data * wdata, gftp_dialog_data * ddata)
120 { 82 {
121 signal (signo, sig_mkdirquit); 83 edttext = gtk_entry_get_text (GTK_ENTRY (ddata->edit));
122 siglongjmp (mkdirenvir, signo == SIGINT ? 1 : 2); 84 if (*edttext == '\0')
85 {
86 ftp_log (gftp_logging_misc, NULL,
87 _("Mkdir: Operation canceled...you must enter a string\n"));
88 return;
89 }
90
91 if (check_reconnect (wdata) < 0)
92 return;
93
94 if ((int) generic_thread (do_make_dir_thread, wdata))
95 {
96 gftp_delete_cache_entry (wdata->request);
97 refresh (wdata);
98 }
123 } 99 }
124 100
101
102 void
103 mkdir_dialog (gpointer data)
104 {
105 gftp_window_data * wdata;
106
107 wdata = data;
108 if (!check_status (_("Mkdir"), wdata, wdata->request->use_threads, 0, 0,
109 wdata->request->mkdir != NULL))
110 return;
111
112 MakeEditDialog (_("Make Directory"), _("Enter name of directory to create"),
113 NULL, 1, NULL, gftp_dialog_button_create, domkdir, wdata,
114 NULL, NULL);
115 }
116