annotate src/gtk/chmod_dialog.c @ 21:4b244bf9d84d

2002-09-16 Brian Masney <masneyb@gftp.org> * src/gtk/gftp-gtk.c, src/gtk/menu-items.c, src/gtk/misc-gtk.c - Fixed compile errors when compiling against GTK+ 1.2 * src/gtk/misc-gtk.c (MakeEditDialog, MakeYesNoDialog) - fixed to work with GTK+ 1.2
author masneyb
date Tue, 17 Sep 2002 12:00:50 +0000
parents 3b2dcdefc7e9
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 /* chmod_dialog.c - the chmod dialog box */
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 void dochmod ( GtkWidget * widget,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
23 gftp_window_data * wdata );
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
24 static void *do_chmod_thread ( void * data );
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
25 static RETSIGTYPE sig_chmodquit ( int signo );
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
26
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
27
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
28 static GtkWidget *suid, *sgid, *sticky, *ur, *uw, *ux, *gr, *gw, *gx, *or, *ow,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
29 *ox;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
30 static sigjmp_buf chmodenvir;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
31 static int mode;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
32
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
33 #if !(GTK_MAJOR_VERSION == 1 && GTK_MINOR_VERSION == 2)
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
34 static void
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
35 chmod_action (GtkWidget * widget, gint response, gpointer wdata)
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
36 {
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
37 switch (response)
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
38 {
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
39 case GTK_RESPONSE_OK:
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
40 dochmod (widget, wdata);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
41 /* no break */
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
42 default:
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
43 gtk_widget_destroy (widget);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
44 }
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
45 }
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
46 #endif
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
47
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
48
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
49 void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
50 chmod_dialog (gpointer data)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
51 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
52 GtkWidget *tempwid, *dialog, *hbox, *vbox;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
53 GList * templist, * filelist;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
54 gftp_window_data * wdata;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
55 gftp_file * tempfle;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
56 int num;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
57
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
58 wdata = data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
59 if (!check_status (_("Chmod"), wdata, wdata->request->use_threads, 1, 1,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
60 wdata->request->chmod != NULL))
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
61 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
62
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
63 #if GTK_MAJOR_VERSION == 1 && GTK_MINOR_VERSION == 2
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
64 dialog = gtk_dialog_new ();
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
65 gtk_window_set_title (GTK_WINDOW (dialog), _("Chmod"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
66 gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
67 5);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
68 gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (dialog)->action_area), TRUE);
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
69 #else
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
70 dialog = gtk_dialog_new_with_buttons (_("Chmod"), NULL, 0,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
71 GTK_STOCK_OK,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
72 GTK_RESPONSE_OK,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
73 GTK_STOCK_CANCEL,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
74 GTK_RESPONSE_CANCEL,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
75 NULL);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
76 #endif
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
77 gtk_window_set_wmclass (GTK_WINDOW(dialog), "Chmod", "gFTP");
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
78 gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
79 gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 5);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
80 gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), 10);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
81 gtk_widget_realize (dialog);
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 (gftp_icon != NULL)
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
84 {
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
85 gdk_window_set_icon (dialog->window, NULL, gftp_icon->pixmap,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
86 gftp_icon->bitmap);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
87 gdk_window_set_icon_name (dialog->window, _("gFTP Icon"));
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
88 }
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
89
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
90 tempwid = gtk_label_new (_("You can now adjust the attributes of your file(s)\nNote: Not all ftp servers support the chmod feature"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
91 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), tempwid, FALSE,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
92 FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
93 gtk_widget_show (tempwid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
94
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
95 hbox = gtk_hbox_new (TRUE, 5);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
96 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, FALSE, FALSE,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
97 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
98 gtk_widget_show (hbox);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
99
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
100 tempwid = gtk_frame_new (_("Special"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
101 gtk_box_pack_start (GTK_BOX (hbox), tempwid, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
102 gtk_widget_show (tempwid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
103
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
104 vbox = gtk_vbox_new (TRUE, 5);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
105 gtk_container_add (GTK_CONTAINER (tempwid), vbox);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
106 gtk_widget_show (vbox);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
107
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
108 suid = gtk_check_button_new_with_label (_("SUID"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
109 gtk_box_pack_start (GTK_BOX (vbox), suid, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
110 gtk_widget_show (suid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
111
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
112 sgid = gtk_check_button_new_with_label (_("SGID"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
113 gtk_box_pack_start (GTK_BOX (vbox), sgid, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
114 gtk_widget_show (sgid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
115
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
116 sticky = gtk_check_button_new_with_label (_("Sticky"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
117 gtk_box_pack_start (GTK_BOX (vbox), sticky, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
118 gtk_widget_show (sticky);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
119
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
120 tempwid = gtk_frame_new (_("User"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
121 gtk_box_pack_start (GTK_BOX (hbox), tempwid, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
122 gtk_widget_show (tempwid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
123
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
124 vbox = gtk_vbox_new (TRUE, 5);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
125 gtk_container_add (GTK_CONTAINER (tempwid), vbox);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
126 gtk_widget_show (vbox);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
127
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
128 ur = gtk_check_button_new_with_label (_("Read"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
129 gtk_box_pack_start (GTK_BOX (vbox), ur, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
130 gtk_widget_show (ur);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
131
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
132 uw = gtk_check_button_new_with_label (_("Write"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
133 gtk_box_pack_start (GTK_BOX (vbox), uw, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
134 gtk_widget_show (uw);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
135
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
136 ux = gtk_check_button_new_with_label (_("Execute"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
137 gtk_box_pack_start (GTK_BOX (vbox), ux, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
138 gtk_widget_show (ux);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
139
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
140 tempwid = gtk_frame_new (_("Group"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
141 gtk_box_pack_start (GTK_BOX (hbox), tempwid, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
142 gtk_widget_show (tempwid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
143
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
144 vbox = gtk_vbox_new (TRUE, 5);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
145 gtk_container_add (GTK_CONTAINER (tempwid), vbox);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
146 gtk_widget_show (vbox);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
147
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
148 gr = gtk_check_button_new_with_label (_("Read"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
149 gtk_box_pack_start (GTK_BOX (vbox), gr, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
150 gtk_widget_show (gr);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
151
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
152 gw = gtk_check_button_new_with_label (_("Write"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
153 gtk_box_pack_start (GTK_BOX (vbox), gw, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
154 gtk_widget_show (gw);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
155
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
156 gx = gtk_check_button_new_with_label (_("Execute"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
157 gtk_box_pack_start (GTK_BOX (vbox), gx, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
158 gtk_widget_show (gx);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
159
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
160 tempwid = gtk_frame_new (_("Other"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
161 gtk_box_pack_start (GTK_BOX (hbox), tempwid, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
162 gtk_widget_show (tempwid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
163
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
164 vbox = gtk_vbox_new (TRUE, 5);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
165 gtk_container_add (GTK_CONTAINER (tempwid), vbox);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
166 gtk_widget_show (vbox);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
167
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
168 or = gtk_check_button_new_with_label (_("Read"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
169 gtk_box_pack_start (GTK_BOX (vbox), or, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
170 gtk_widget_show (or);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
171
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
172 ow = gtk_check_button_new_with_label (_("Write"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
173 gtk_box_pack_start (GTK_BOX (vbox), ow, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
174 gtk_widget_show (ow);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
175
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
176 ox = gtk_check_button_new_with_label (_("Execute"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
177 gtk_box_pack_start (GTK_BOX (vbox), ox, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
178 gtk_widget_show (ox);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
179
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
180 #if GTK_MAJOR_VERSION == 1 && GTK_MINOR_VERSION == 2
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
181 tempwid = gtk_button_new_with_label (_("OK"));
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
182 GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
183 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), tempwid,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
184 TRUE, TRUE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
185 gtk_signal_connect (GTK_OBJECT (tempwid), "clicked",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
186 GTK_SIGNAL_FUNC (dochmod), (gpointer) wdata);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
187 gtk_signal_connect_object (GTK_OBJECT (tempwid), "clicked",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
188 GTK_SIGNAL_FUNC (gtk_widget_destroy),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
189 GTK_OBJECT (dialog));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
190 gtk_widget_grab_default (tempwid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
191 gtk_widget_show (tempwid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
192
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
193 tempwid = gtk_button_new_with_label (_(" Cancel "));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
194 GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
195 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), tempwid,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
196 TRUE, TRUE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
197 gtk_signal_connect_object (GTK_OBJECT (tempwid), "clicked",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
198 GTK_SIGNAL_FUNC (gtk_widget_destroy),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
199 GTK_OBJECT (dialog));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
200 gtk_widget_show (tempwid);
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
201 #else
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
202 g_signal_connect (GTK_OBJECT (dialog), "response",
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
203 G_CALLBACK (chmod_action), wdata);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
204 #endif
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
205
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
206 if (IS_ONE_SELECTED (wdata))
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
207 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
208 filelist = wdata->files;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
209 templist = GTK_CLIST (wdata->listbox)->selection;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
210 num = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
211 templist = get_next_selection (templist, &filelist, &num);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
212 tempfle = filelist->data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
213 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (suid),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
214 tolower (tempfle->attribs[3]) == 's');
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
215 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sgid),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
216 tolower (tempfle->attribs[6]) == 's');
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
217 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sticky),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
218 tolower (tempfle->attribs[9]) == 't');
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
219 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ur),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
220 tempfle->attribs[1] == 'r');
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
221 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (uw),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
222 tempfle->attribs[2] == 'w');
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
223 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ux),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
224 tempfle->attribs[3] == 'x' ||
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
225 tempfle->attribs[3] == 's');
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
226 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gr),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
227 tempfle->attribs[4] == 'r');
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
228 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gw),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
229 tempfle->attribs[5] == 'w');
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
230 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gx),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
231 tempfle->attribs[6] == 'x' ||
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
232 tempfle->attribs[6] == 's');
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
233 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (or),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
234 tempfle->attribs[7] == 'r');
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
235 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ow),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
236 tempfle->attribs[8] == 'w');
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
237 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ox),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
238 tempfle->attribs[9] == 'x' ||
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
239 tempfle->attribs[9] == 't');
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
240 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
241 gtk_widget_show (dialog);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
242 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
243
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
244
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
245 static void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
246 dochmod (GtkWidget * widget, gftp_window_data * wdata)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
247 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
248 int cur;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
249
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
250 mode = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
251 if (GTK_TOGGLE_BUTTON (suid)->active)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
252 mode += 4;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
253 if (GTK_TOGGLE_BUTTON (sgid)->active)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
254 mode += 2;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
255 if (GTK_TOGGLE_BUTTON (sticky)->active)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
256 mode += 1;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
257
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
258 cur = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
259 if (GTK_TOGGLE_BUTTON (ur)->active)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
260 cur += 4;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
261 if (GTK_TOGGLE_BUTTON (uw)->active)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
262 cur += 2;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
263 if (GTK_TOGGLE_BUTTON (ux)->active)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
264 cur += 1;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
265 mode = mode * 10 + cur;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
266
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
267 cur = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
268 if (GTK_TOGGLE_BUTTON (gr)->active)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
269 cur += 4;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
270 if (GTK_TOGGLE_BUTTON (gw)->active)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
271 cur += 2;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
272 if (GTK_TOGGLE_BUTTON (gx)->active)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
273 cur += 1;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
274 mode = mode * 10 + cur;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
275
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
276 cur = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
277 if (GTK_TOGGLE_BUTTON (or)->active)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
278 cur += 4;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
279 if (GTK_TOGGLE_BUTTON (ow)->active)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
280 cur += 2;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
281 if (GTK_TOGGLE_BUTTON (ox)->active)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
282 cur += 1;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
283 mode = mode * 10 + cur;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
284
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
285 if (check_reconnect (wdata) < 0)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
286 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
287
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
288 if ((int) generic_thread (do_chmod_thread, wdata))
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
289 refresh (wdata);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
290 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
291
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
292
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
293 static void *
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
294 do_chmod_thread (void * data)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
295 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
296 GList * filelist, * templist;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
297 gftp_window_data * wdata;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
298 int success, num, sj;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
299 gftp_file * tempfle;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
300
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
301 wdata = data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
302 wdata->request->user_data = (void *) 0x01;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
303
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
304 if (wdata->request->use_threads)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
305 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
306 sj = sigsetjmp (chmodenvir, 1);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
307 signal (SIGINT, sig_chmodquit);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
308 signal (SIGALRM, sig_chmodquit);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
309 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
310 else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
311 sj = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
312
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
313 success = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
314 if (sj == 0)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
315 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
316 filelist = wdata->files;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
317 templist = GTK_CLIST (wdata->listbox)->selection;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
318 num = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
319 while (templist != NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
320 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
321 templist = get_next_selection (templist, &filelist, &num);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
322 tempfle = filelist->data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
323 if (wdata->request->network_timeout > 0)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
324 alarm (wdata->request->network_timeout);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
325 if (gftp_chmod (wdata->request, tempfle->file, mode) == 0)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
326 success = 1;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
327 if (!GFTP_IS_CONNECTED (wdata->request))
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
328 break;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
329 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
330 alarm (0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
331 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
332 else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
333 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
334 gftp_disconnect (wdata->request);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
335 wdata->request->logging_function (gftp_logging_error,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
336 wdata->request->user_data,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
337 _("Operation canceled\n"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
338 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
339
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
340 if (wdata->request->use_threads)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
341 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
342 signal (SIGINT, SIG_DFL);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
343 signal (SIGALRM, SIG_IGN);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
344 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
345
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
346 wdata->request->user_data = NULL;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
347 wdata->request->stopable = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
348 return ((void *) success);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
349 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
350
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
351
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
352 static RETSIGTYPE
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
353 sig_chmodquit (int signo)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
354 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
355 signal (signo, sig_chmodquit);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
356 siglongjmp (chmodenvir, signo == SIGINT ? 1 : 2);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
357 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
358