annotate src/gtk/chmod_dialog.c @ 186:13ca1defdc75

2003-6-16 Brian Masney <masneyb@gftp.org> * lib/gftp.h src/text/gftp-text.c src/gtk/misc-gtk.c - changed 2nd parameter of logging function to be a request structure, instead of request->user_data. In the logging functions, if the string isn't in UTF-8, convert it with gftp_string_to_utf8() * lib/bookmark.c lib/cache.c lib/gftp.h lib/https.c lib/local.c lib/protocols.c lib/rfc2068.c lib/rfc959.c lib/sshv2.c lib/sslcommon.c src/gtk/chmod_dialog.c src/gtk/delete_dialog.c src/gtk/gftp-gtk.h src/gtk/menu-items.c src/gtk/misc-gtk.c src/gtk/mkdir_dialog.c src/gtk/rename_dialog.c src/gtk/transfer.c src/text/gftp-text.c src/gtk/gftp-gtk.h src/text/gftp-text.h - pass request structure to logging function instead of request->user_data
author masneyb
date Tue, 17 Jun 2003 10:49:16 +0000
parents c505d9ba9d53
children 3fa7b4f4ab78
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"
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
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
28 static void *
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
29 do_chmod_thread (void * data)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
30 {
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 65
diff changeset
31 int success, num, sj, network_timeout;
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
32 GList * filelist, * templist;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
33 gftp_window_data * wdata;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
34 gftp_file * tempfle;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
35
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
36 wdata = data;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
37
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 65
diff changeset
38 gftp_lookup_request_option (wdata->request, "network_timeout",
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 65
diff changeset
39 &network_timeout);
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 65
diff changeset
40
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
41 if (wdata->request->use_threads)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
42 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
43 sj = sigsetjmp (jmp_environment, 1);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
44 use_jmp_environment = 1;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
45 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
46 else
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
47 sj = 0;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
49 success = 0;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
50 if (sj == 0)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
51 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
52 filelist = wdata->files;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
53 templist = GTK_CLIST (wdata->listbox)->selection;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
54 num = 0;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
55 while (templist != NULL)
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 templist = get_next_selection (templist, &filelist, &num);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
58 tempfle = filelist->data;
129
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 65
diff changeset
59 if (network_timeout > 0)
fe0b21c006f6 2003-4-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 65
diff changeset
60 alarm (network_timeout);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
61 if (gftp_chmod (wdata->request, tempfle->file, mode) == 0)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
62 success = 1;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
63 if (!GFTP_IS_CONNECTED (wdata->request))
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
64 break;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
65 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
66 alarm (0);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
67 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
68 else
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
69 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
70 gftp_disconnect (wdata->request);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
71 wdata->request->logging_function (gftp_logging_error,
186
13ca1defdc75 2003-6-16 Brian Masney <masneyb@gftp.org>
masneyb
parents: 168
diff changeset
72 wdata->request,
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
73 _("Operation canceled\n"));
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
74 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
75
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
76 if (wdata->request->use_threads)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
77 use_jmp_environment = 0;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
78
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
79 wdata->request->stopable = 0;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
80 return ((void *) success);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
81 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
82
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
83
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
84 static void
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
85 dochmod (GtkWidget * widget, gftp_window_data * wdata)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
86 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
87 int cur;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
88
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
89 mode = 0;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
90 if (GTK_TOGGLE_BUTTON (suid)->active)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
91 mode += 4;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
92 if (GTK_TOGGLE_BUTTON (sgid)->active)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
93 mode += 2;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
94 if (GTK_TOGGLE_BUTTON (sticky)->active)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
95 mode += 1;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
96
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
97 cur = 0;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
98 if (GTK_TOGGLE_BUTTON (ur)->active)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
99 cur += 4;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
100 if (GTK_TOGGLE_BUTTON (uw)->active)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
101 cur += 2;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
102 if (GTK_TOGGLE_BUTTON (ux)->active)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
103 cur += 1;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
104 mode = mode * 10 + cur;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
105
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
106 cur = 0;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
107 if (GTK_TOGGLE_BUTTON (gr)->active)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
108 cur += 4;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
109 if (GTK_TOGGLE_BUTTON (gw)->active)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
110 cur += 2;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
111 if (GTK_TOGGLE_BUTTON (gx)->active)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
112 cur += 1;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
113 mode = mode * 10 + cur;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
114
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
115 cur = 0;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
116 if (GTK_TOGGLE_BUTTON (or)->active)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
117 cur += 4;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
118 if (GTK_TOGGLE_BUTTON (ow)->active)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
119 cur += 2;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
120 if (GTK_TOGGLE_BUTTON (ox)->active)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
121 cur += 1;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
122 mode = mode * 10 + cur;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
123
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
124 if (check_reconnect (wdata) < 0)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
125 return;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
126
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
127 if ((int) generic_thread (do_chmod_thread, wdata))
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
128 refresh (wdata);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
129 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
130
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 45
diff changeset
131
45
311e29c40ed6 2002-10-31 Brian Masney <masneyb@gftp.org>
masneyb
parents: 42
diff changeset
132 #if GTK_MAJOR_VERSION > 1
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
133 static void
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
134 chmod_action (GtkWidget * widget, gint response, gpointer wdata)
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
135 {
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
136 switch (response)
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
137 {
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
138 case GTK_RESPONSE_OK:
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
139 dochmod (widget, wdata);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
140 /* no break */
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
141 default:
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
142 gtk_widget_destroy (widget);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
143 }
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
144 }
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
145 #endif
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
146
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
147
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
148 void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
149 chmod_dialog (gpointer data)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
150 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
151 GtkWidget *tempwid, *dialog, *hbox, *vbox;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
152 GList * templist, * filelist;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
153 gftp_window_data * wdata;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
154 gftp_file * tempfle;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
155 int num;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
156
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
157 wdata = data;
65
4b5fec7711e9 2002-11-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 56
diff changeset
158 if (!check_status (_("Chmod"), wdata, wdata->request->use_threads, 0, 1,
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
159 wdata->request->chmod != NULL))
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
160 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
161
45
311e29c40ed6 2002-10-31 Brian Masney <masneyb@gftp.org>
masneyb
parents: 42
diff changeset
162 #if GTK_MAJOR_VERSION == 1
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
163 dialog = gtk_dialog_new ();
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
164 gtk_window_set_title (GTK_WINDOW (dialog), _("Chmod"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
165 gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
166 5);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
167 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
168 #else
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
169 dialog = gtk_dialog_new_with_buttons (_("Chmod"), NULL, 0,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
170 GTK_STOCK_OK,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
171 GTK_RESPONSE_OK,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
172 GTK_STOCK_CANCEL,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
173 GTK_RESPONSE_CANCEL,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
174 NULL);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
175 #endif
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
176 gtk_window_set_wmclass (GTK_WINDOW(dialog), "Chmod", "gFTP");
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
177 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
178 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
179 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
180 gtk_widget_realize (dialog);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
181
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
182 if (gftp_icon != NULL)
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
183 {
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
184 gdk_window_set_icon (dialog->window, NULL, gftp_icon->pixmap,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
185 gftp_icon->bitmap);
168
c505d9ba9d53 2003-6-6 Brian Masney <masneyb@gftp.org>
masneyb
parents: 129
diff changeset
186 gdk_window_set_icon_name (dialog->window, gftp_version);
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
187 }
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
188
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
189 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
190 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), tempwid, FALSE,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
191 FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
192 gtk_widget_show (tempwid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
193
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
194 hbox = gtk_hbox_new (TRUE, 5);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
195 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, FALSE, FALSE,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
196 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
197 gtk_widget_show (hbox);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
198
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
199 tempwid = gtk_frame_new (_("Special"));
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 suid = gtk_check_button_new_with_label (_("SUID"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
208 gtk_box_pack_start (GTK_BOX (vbox), suid, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
209 gtk_widget_show (suid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
210
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
211 sgid = gtk_check_button_new_with_label (_("SGID"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
212 gtk_box_pack_start (GTK_BOX (vbox), sgid, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
213 gtk_widget_show (sgid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
214
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
215 sticky = gtk_check_button_new_with_label (_("Sticky"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
216 gtk_box_pack_start (GTK_BOX (vbox), sticky, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
217 gtk_widget_show (sticky);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
218
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
219 tempwid = gtk_frame_new (_("User"));
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 ur = gtk_check_button_new_with_label (_("Read"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
228 gtk_box_pack_start (GTK_BOX (vbox), ur, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
229 gtk_widget_show (ur);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
230
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
231 uw = gtk_check_button_new_with_label (_("Write"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
232 gtk_box_pack_start (GTK_BOX (vbox), uw, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
233 gtk_widget_show (uw);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
234
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
235 ux = gtk_check_button_new_with_label (_("Execute"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
236 gtk_box_pack_start (GTK_BOX (vbox), ux, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
237 gtk_widget_show (ux);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
238
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
239 tempwid = gtk_frame_new (_("Group"));
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 gr = gtk_check_button_new_with_label (_("Read"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
248 gtk_box_pack_start (GTK_BOX (vbox), gr, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
249 gtk_widget_show (gr);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
250
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
251 gw = gtk_check_button_new_with_label (_("Write"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
252 gtk_box_pack_start (GTK_BOX (vbox), gw, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
253 gtk_widget_show (gw);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
254
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
255 gx = gtk_check_button_new_with_label (_("Execute"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
256 gtk_box_pack_start (GTK_BOX (vbox), gx, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
257 gtk_widget_show (gx);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
258
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
259 tempwid = gtk_frame_new (_("Other"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
260 gtk_box_pack_start (GTK_BOX (hbox), tempwid, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
261 gtk_widget_show (tempwid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
262
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
263 vbox = gtk_vbox_new (TRUE, 5);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
264 gtk_container_add (GTK_CONTAINER (tempwid), vbox);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
265 gtk_widget_show (vbox);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
266
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
267 or = gtk_check_button_new_with_label (_("Read"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
268 gtk_box_pack_start (GTK_BOX (vbox), or, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
269 gtk_widget_show (or);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
270
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
271 ow = gtk_check_button_new_with_label (_("Write"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
272 gtk_box_pack_start (GTK_BOX (vbox), ow, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
273 gtk_widget_show (ow);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
274
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
275 ox = gtk_check_button_new_with_label (_("Execute"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
276 gtk_box_pack_start (GTK_BOX (vbox), ox, FALSE, FALSE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
277 gtk_widget_show (ox);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
278
45
311e29c40ed6 2002-10-31 Brian Masney <masneyb@gftp.org>
masneyb
parents: 42
diff changeset
279 #if GTK_MAJOR_VERSION == 1
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
280 tempwid = gtk_button_new_with_label (_("OK"));
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
281 GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
282 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), tempwid,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
283 TRUE, TRUE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
284 gtk_signal_connect (GTK_OBJECT (tempwid), "clicked",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
285 GTK_SIGNAL_FUNC (dochmod), (gpointer) wdata);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
286 gtk_signal_connect_object (GTK_OBJECT (tempwid), "clicked",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
287 GTK_SIGNAL_FUNC (gtk_widget_destroy),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
288 GTK_OBJECT (dialog));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
289 gtk_widget_grab_default (tempwid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
290 gtk_widget_show (tempwid);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
291
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
292 tempwid = gtk_button_new_with_label (_(" Cancel "));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
293 GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
294 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), tempwid,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
295 TRUE, TRUE, 0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
296 gtk_signal_connect_object (GTK_OBJECT (tempwid), "clicked",
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
297 GTK_SIGNAL_FUNC (gtk_widget_destroy),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
298 GTK_OBJECT (dialog));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
299 gtk_widget_show (tempwid);
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
300 #else
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
301 g_signal_connect (GTK_OBJECT (dialog), "response",
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
302 G_CALLBACK (chmod_action), wdata);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
303 #endif
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
304
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
305 if (IS_ONE_SELECTED (wdata))
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
306 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
307 filelist = wdata->files;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
308 templist = GTK_CLIST (wdata->listbox)->selection;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
309 num = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
310 templist = get_next_selection (templist, &filelist, &num);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
311 tempfle = filelist->data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
312 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (suid),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
313 tolower (tempfle->attribs[3]) == 's');
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
314 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sgid),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
315 tolower (tempfle->attribs[6]) == 's');
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
316 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sticky),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
317 tolower (tempfle->attribs[9]) == 't');
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
318 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ur),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
319 tempfle->attribs[1] == 'r');
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
320 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (uw),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
321 tempfle->attribs[2] == 'w');
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
322 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ux),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
323 tempfle->attribs[3] == 'x' ||
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
324 tempfle->attribs[3] == 's');
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
325 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gr),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
326 tempfle->attribs[4] == 'r');
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
327 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gw),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
328 tempfle->attribs[5] == 'w');
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
329 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gx),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
330 tempfle->attribs[6] == 'x' ||
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
331 tempfle->attribs[6] == 's');
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
332 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (or),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
333 tempfle->attribs[7] == 'r');
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
334 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ow),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
335 tempfle->attribs[8] == 'w');
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
336 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ox),
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
337 tempfle->attribs[9] == 'x' ||
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
338 tempfle->attribs[9] == 't');
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
339 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
340 gtk_widget_show (dialog);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
341 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
342