annotate src/gtk/rename_dialog.c @ 104:31a004f868f7

Update Czech translation
author mitr
date Fri, 07 Feb 2003 22:02:51 +0000
parents a12bcbc2fce4
children fe0b21c006f6
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 /* rename_dialog.c - rename dialog box and ftp routines */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
3 /* Copyright (C) 1998-2002 Brian Masney <masneyb@gftp.org> */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
4 /* */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
5 /* This program is free software; you can redistribute it and/or modify */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
6 /* it under the terms of the GNU General Public License as published by */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
7 /* the Free Software Foundation; either version 2 of the License, or */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
8 /* (at your option) any later version. */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
9 /* */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
10 /* This program is distributed in the hope that it will be useful, */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
11 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
12 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
13 /* GNU General Public License for more details. */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
14 /* */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
15 /* You should have received a copy of the GNU General Public License */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
16 /* along with this program; if not, write to the Free Software */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
17 /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA */
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
18 /*****************************************************************************/
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
19
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
20 #include "gftp-gtk.h"
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 const char *edttext;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
24 static gftp_file * curfle;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
25
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
26
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
27 static void *
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
28 do_rename_thread (void * data)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
29 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
30 gftp_window_data * wdata;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
31 int success, sj;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
32
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
33 wdata = data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
34
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
35 if (wdata->request->use_threads)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
36 {
42
cd169e4789df 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 33
diff changeset
37 sj = sigsetjmp (jmp_environment, 1);
cd169e4789df 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 33
diff changeset
38 use_jmp_environment = 1;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
39 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
40 else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
41 sj = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
42
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
43 success = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
44 if (sj == 0)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
45 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
46 if (wdata->request->network_timeout > 0)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
47 alarm (wdata->request->network_timeout);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
48 success = gftp_rename_file (wdata->request, curfle->file, edttext) == 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
49 alarm (0);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
50 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
51 else
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
52 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
53 gftp_disconnect (wdata->request);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
54 wdata->request->logging_function (gftp_logging_error,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
55 wdata->request->user_data,
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
56 _("Operation canceled\n"));
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
57 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
58
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
59 if (wdata->request->use_threads)
42
cd169e4789df 2002-10-29 Brian Masney <masneyb@gftp.org>
masneyb
parents: 33
diff changeset
60 use_jmp_environment = 0;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
61
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
62 wdata->request->stopable = 0;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
63 return ((void *) success);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
64 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
65
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
66
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
67 static void
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
68 dorenCB (gftp_window_data * wdata, gftp_dialog_data * ddata)
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
69 {
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
70 edttext = gtk_entry_get_text (GTK_ENTRY (ddata->edit));
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
71 if (*edttext == '\0')
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
72 {
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
73 ftp_log (gftp_logging_misc, NULL,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
74 _("Rename: Operation canceled...you must enter a string\n"));
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
75 return;
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
76 }
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
77
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
78 if (check_reconnect (wdata) < 0)
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
79 return;
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
80
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
81 if ((int) generic_thread (do_rename_thread, wdata))
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
82 refresh ((gpointer) wdata);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
83 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
84
19
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
85
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
86 void
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
87 rename_dialog (gpointer data)
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
88 {
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
89 GList *templist, *filelist;
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
90 gftp_window_data * wdata;
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
91 char *tempstr;
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
92 int num;
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
93
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
94 wdata = data;
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
95 if (!check_status (_("Rename"), wdata, wdata->request->use_threads, 1, 1,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
96 wdata->request->rename != NULL))
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
97 return;
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
98
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
99 templist = GTK_CLIST (wdata->listbox)->selection;
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
100 num = 0;
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
101 filelist = wdata->files;
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
102 templist = get_next_selection (templist, &filelist, &num);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
103 curfle = filelist->data;
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
104
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
105 tempstr = g_strdup_printf (_("What would you like to rename %s to?"),
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
106 curfle->file);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
107 MakeEditDialog (_("Rename"), tempstr, curfle->file, 1, NULL,
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
108 gftp_dialog_button_rename, dorenCB, wdata, NULL, NULL);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
109 g_free (tempstr);
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
110 }
3b2dcdefc7e9 2002-09-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 1
diff changeset
111