annotate src/gtk/chmod_dialog.c @ 441:f8a0c22af707

2004-3-20 Brian Masney <masneyb@gftp.org> * src/gtk/chmod_dialog.c - use gftpui_common_run_callback_function() to do the chmod operation. This will spawn a thread if necessary
author masneyb
date Sat, 20 Mar 2004 19:17:48 +0000
parents eedc2c5727fa
children 39e9945288ea
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 */
255
2ad324cf4930 2003-8-11 Brian Masney <masneyb@gftp.org>
masneyb
parents: 195
diff changeset
3 /* Copyright (C) 1998-2003 Brian Masney <masneyb@gftp.org> */
1
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 GtkWidget *suid, *sgid, *sticky, *ur, *uw, *ux, *gr, *gw, *gx, *or, *ow,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
24 *ox;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
25 static int mode;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
26
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
27
441
f8a0c22af707 2004-3-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 341
diff changeset
28 static int
f8a0c22af707 2004-3-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 341
diff changeset
29 do_chmod_thread (gftpui_callback_data * cdata)
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
30 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
31 GList * filelist, * templist;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
32 gftp_window_data * wdata;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
33 gftp_file * tempfle;
441
f8a0c22af707 2004-3-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 341
diff changeset
34 int error, num;
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 65
diff changeset
35
441
f8a0c22af707 2004-3-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 341
diff changeset
36 wdata = cdata->uidata;
f8a0c22af707 2004-3-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 341
diff changeset
37 error = 0;
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
38
441
f8a0c22af707 2004-3-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 341
diff changeset
39 filelist = wdata->files;
f8a0c22af707 2004-3-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 341
diff changeset
40 templist = GTK_CLIST (wdata->listbox)->selection;
f8a0c22af707 2004-3-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 341
diff changeset
41 num = 0;
f8a0c22af707 2004-3-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 341
diff changeset
42 while (templist != NULL)
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
43 {
441
f8a0c22af707 2004-3-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 341
diff changeset
44 templist = get_next_selection (templist, &filelist, &num);
f8a0c22af707 2004-3-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 341
diff changeset
45 tempfle = filelist->data;
f8a0c22af707 2004-3-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 341
diff changeset
46
f8a0c22af707 2004-3-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 341
diff changeset
47 if (gftp_chmod (wdata->request, tempfle->file, mode) != 0)
f8a0c22af707 2004-3-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 341
diff changeset
48 error = 1;
f8a0c22af707 2004-3-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 341
diff changeset
49
f8a0c22af707 2004-3-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 341
diff changeset
50 if (!GFTP_IS_CONNECTED (wdata->request))
f8a0c22af707 2004-3-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 341
diff changeset
51 break;
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
52 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
53
441
f8a0c22af707 2004-3-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 341
diff changeset
54 return (error);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
55 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
56
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
57
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
58 static void
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
59 dochmod (GtkWidget * widget, gftp_window_data * wdata)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
60 {
441
f8a0c22af707 2004-3-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 341
diff changeset
61 gftpui_callback_data * cdata;
195
3fa7b4f4ab78 2003-6-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 186
diff changeset
62 int cur, ret;
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
63
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
64 mode = 0;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
65 if (GTK_TOGGLE_BUTTON (suid)->active)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
66 mode += 4;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
67 if (GTK_TOGGLE_BUTTON (sgid)->active)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
68 mode += 2;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
69 if (GTK_TOGGLE_BUTTON (sticky)->active)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
70 mode += 1;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
71
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
72 cur = 0;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
73 if (GTK_TOGGLE_BUTTON (ur)->active)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
74 cur += 4;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
75 if (GTK_TOGGLE_BUTTON (uw)->active)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
76 cur += 2;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
77 if (GTK_TOGGLE_BUTTON (ux)->active)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
78 cur += 1;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
79 mode = mode * 10 + cur;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
80
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
81 cur = 0;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
82 if (GTK_TOGGLE_BUTTON (gr)->active)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
83 cur += 4;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
84 if (GTK_TOGGLE_BUTTON (gw)->active)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
85 cur += 2;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
86 if (GTK_TOGGLE_BUTTON (gx)->active)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
87 cur += 1;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
88 mode = mode * 10 + cur;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
89
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
90 cur = 0;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
91 if (GTK_TOGGLE_BUTTON (or)->active)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
92 cur += 4;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
93 if (GTK_TOGGLE_BUTTON (ow)->active)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
94 cur += 2;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
95 if (GTK_TOGGLE_BUTTON (ox)->active)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
96 cur += 1;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
97 mode = mode * 10 + cur;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
98
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
99 if (check_reconnect (wdata) < 0)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
100 return;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
101
441
f8a0c22af707 2004-3-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 341
diff changeset
102 cdata = g_malloc0 (sizeof (*cdata));
f8a0c22af707 2004-3-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 341
diff changeset
103 cdata->request = wdata->request;
f8a0c22af707 2004-3-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 341
diff changeset
104 cdata->uidata = wdata;
f8a0c22af707 2004-3-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 341
diff changeset
105 cdata->run_function = do_chmod_thread;
f8a0c22af707 2004-3-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 341
diff changeset
106
f8a0c22af707 2004-3-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 341
diff changeset
107 ret = gftpui_common_run_callback_function (cdata);
f8a0c22af707 2004-3-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 341
diff changeset
108
f8a0c22af707 2004-3-20 Brian Masney <masneyb@gftp.org>
masneyb
parents: 341
diff changeset
109 g_free (cdata);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
110 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
111
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
112
45
311e29c40ed6 2002-10-31 Brian Masney <masneyb@gftp.org>
masneyb
parents: 42
diff changeset
113 #if GTK_MAJOR_VERSION > 1
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
114 static void
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
115 chmod_action (GtkWidget * widget, gint response, gpointer wdata)
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
116 {
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
117 switch (response)
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
118 {
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
119 case GTK_RESPONSE_OK:
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
120 dochmod (widget, wdata);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
121 /* no break */
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
122 default:
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
123 gtk_widget_destroy (widget);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
124 }
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
125 }
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
126 #endif
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
127
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
128
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
129 void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
130 chmod_dialog (gpointer data)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
131 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
132 GtkWidget *tempwid, *dialog, *hbox, *vbox;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
133 GList * templist, * filelist;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
134 gftp_window_data * wdata;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
135 gftp_file * tempfle;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
136 int num;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
137
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
138 wdata = data;
341
eedc2c5727fa 2003-12-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 326
diff changeset
139 if (!check_status (_("Chmod"), wdata, gftpui_common_use_threads (wdata->request), 0, 1, wdata->request->chmod != NULL))
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
140 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
141
45
311e29c40ed6 2002-10-31 Brian Masney <masneyb@gftp.org>
masneyb
parents: 42
diff changeset
142 #if GTK_MAJOR_VERSION == 1
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
143 dialog = gtk_dialog_new ();
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
144 gtk_window_set_title (GTK_WINDOW (dialog), _("Chmod"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
145 gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
146 5);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
147 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
148 #else
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
149 dialog = gtk_dialog_new_with_buttons (_("Chmod"), NULL, 0,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
150 GTK_STOCK_OK,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
151 GTK_RESPONSE_OK,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
152 GTK_STOCK_CANCEL,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
153 GTK_RESPONSE_CANCEL,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
154 NULL);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
155 #endif
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
156 gtk_window_set_wmclass (GTK_WINDOW(dialog), "Chmod", "gFTP");
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
157 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
158 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
159 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
160 gtk_widget_realize (dialog);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
161
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
162 if (gftp_icon != NULL)
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
163 {
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
164 gdk_window_set_icon (dialog->window, NULL, gftp_icon->pixmap,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
165 gftp_icon->bitmap);
168
c505d9ba9d53 2003-6-6 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
166 gdk_window_set_icon_name (dialog->window, gftp_version);
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
167 }
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
168
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
169 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
170 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), tempwid, FALSE,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
171 FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
172 gtk_widget_show (tempwid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
173
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
174 hbox = gtk_hbox_new (TRUE, 5);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
175 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, FALSE, FALSE,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
176 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
177 gtk_widget_show (hbox);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
178
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
179 tempwid = gtk_frame_new (_("Special"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
180 gtk_box_pack_start (GTK_BOX (hbox), tempwid, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
181 gtk_widget_show (tempwid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
182
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
183 vbox = gtk_vbox_new (TRUE, 5);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
184 gtk_container_add (GTK_CONTAINER (tempwid), vbox);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
185 gtk_widget_show (vbox);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
186
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
187 suid = gtk_check_button_new_with_label (_("SUID"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
188 gtk_box_pack_start (GTK_BOX (vbox), suid, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
189 gtk_widget_show (suid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
190
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
191 sgid = gtk_check_button_new_with_label (_("SGID"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
192 gtk_box_pack_start (GTK_BOX (vbox), sgid, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
193 gtk_widget_show (sgid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
194
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
195 sticky = gtk_check_button_new_with_label (_("Sticky"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
196 gtk_box_pack_start (GTK_BOX (vbox), sticky, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
197 gtk_widget_show (sticky);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
198
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
199 tempwid = gtk_frame_new (_("User"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
200 gtk_box_pack_start (GTK_BOX (hbox), tempwid, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
201 gtk_widget_show (tempwid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
202
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
203 vbox = gtk_vbox_new (TRUE, 5);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
204 gtk_container_add (GTK_CONTAINER (tempwid), vbox);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
205 gtk_widget_show (vbox);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
206
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
207 ur = gtk_check_button_new_with_label (_("Read"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
208 gtk_box_pack_start (GTK_BOX (vbox), ur, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
209 gtk_widget_show (ur);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
210
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
211 uw = gtk_check_button_new_with_label (_("Write"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
212 gtk_box_pack_start (GTK_BOX (vbox), uw, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
213 gtk_widget_show (uw);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
214
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
215 ux = gtk_check_button_new_with_label (_("Execute"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
216 gtk_box_pack_start (GTK_BOX (vbox), ux, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
217 gtk_widget_show (ux);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
218
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
219 tempwid = gtk_frame_new (_("Group"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
220 gtk_box_pack_start (GTK_BOX (hbox), tempwid, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
221 gtk_widget_show (tempwid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
222
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
223 vbox = gtk_vbox_new (TRUE, 5);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
224 gtk_container_add (GTK_CONTAINER (tempwid), vbox);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
225 gtk_widget_show (vbox);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
226
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
227 gr = gtk_check_button_new_with_label (_("Read"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
228 gtk_box_pack_start (GTK_BOX (vbox), gr, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
229 gtk_widget_show (gr);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
230
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
231 gw = gtk_check_button_new_with_label (_("Write"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
232 gtk_box_pack_start (GTK_BOX (vbox), gw, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
233 gtk_widget_show (gw);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
234
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
235 gx = gtk_check_button_new_with_label (_("Execute"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
236 gtk_box_pack_start (GTK_BOX (vbox), gx, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
237 gtk_widget_show (gx);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
238
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
239 tempwid = gtk_frame_new (_("Other"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
240 gtk_box_pack_start (GTK_BOX (hbox), tempwid, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
241 gtk_widget_show (tempwid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
242
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
243 vbox = gtk_vbox_new (TRUE, 5);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
244 gtk_container_add (GTK_CONTAINER (tempwid), vbox);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
245 gtk_widget_show (vbox);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
246
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
247 or = gtk_check_button_new_with_label (_("Read"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
248 gtk_box_pack_start (GTK_BOX (vbox), or, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
249 gtk_widget_show (or);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
250
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
251 ow = gtk_check_button_new_with_label (_("Write"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
252 gtk_box_pack_start (GTK_BOX (vbox), ow, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
253 gtk_widget_show (ow);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
254
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
255 ox = gtk_check_button_new_with_label (_("Execute"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
256 gtk_box_pack_start (GTK_BOX (vbox), ox, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
257 gtk_widget_show (ox);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
258
45
311e29c40ed6 2002-10-31 Brian Masney <masneyb@gftp.org>
masneyb
parents: 42
diff changeset
259 #if GTK_MAJOR_VERSION == 1
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
260 tempwid = gtk_button_new_with_label (_("OK"));
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
261 GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
262 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), tempwid,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
263 TRUE, TRUE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
264 gtk_signal_connect (GTK_OBJECT (tempwid), "clicked",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
265 GTK_SIGNAL_FUNC (dochmod), (gpointer) wdata);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
266 gtk_signal_connect_object (GTK_OBJECT (tempwid), "clicked",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
267 GTK_SIGNAL_FUNC (gtk_widget_destroy),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
268 GTK_OBJECT (dialog));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
269 gtk_widget_grab_default (tempwid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
270 gtk_widget_show (tempwid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
271
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
272 tempwid = gtk_button_new_with_label (_(" Cancel "));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
273 GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
274 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), tempwid,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
275 TRUE, TRUE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
276 gtk_signal_connect_object (GTK_OBJECT (tempwid), "clicked",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
277 GTK_SIGNAL_FUNC (gtk_widget_destroy),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
278 GTK_OBJECT (dialog));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
279 gtk_widget_show (tempwid);
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
280 #else
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
281 g_signal_connect (GTK_OBJECT (dialog), "response",
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
282 G_CALLBACK (chmod_action), wdata);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
283 #endif
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
284
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
285 if (IS_ONE_SELECTED (wdata))
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
286 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
287 filelist = wdata->files;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
288 templist = GTK_CLIST (wdata->listbox)->selection;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
289 num = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
290 templist = get_next_selection (templist, &filelist, &num);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
291 tempfle = filelist->data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
292 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (suid),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
293 tolower (tempfle->attribs[3]) == 's');
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
294 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sgid),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
295 tolower (tempfle->attribs[6]) == 's');
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
296 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sticky),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
297 tolower (tempfle->attribs[9]) == 't');
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
298 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ur),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
299 tempfle->attribs[1] == 'r');
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
300 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (uw),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
301 tempfle->attribs[2] == 'w');
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
302 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ux),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
303 tempfle->attribs[3] == 'x' ||
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
304 tempfle->attribs[3] == 's');
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
305 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gr),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
306 tempfle->attribs[4] == 'r');
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
307 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gw),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
308 tempfle->attribs[5] == 'w');
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
309 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gx),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
310 tempfle->attribs[6] == 'x' ||
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
311 tempfle->attribs[6] == 's');
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
312 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (or),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
313 tempfle->attribs[7] == 'r');
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
314 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ow),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
315 tempfle->attribs[8] == 'w');
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
316 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ox),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
317 tempfle->attribs[9] == 'x' ||
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
318 tempfle->attribs[9] == 't');
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
319 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
320 gtk_widget_show (dialog);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
321 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
322