annotate src/gtk/delete_dialog.c @ 960:540226447e15

Added translations done by CDAC after review
author ankitp
date Thu, 04 Sep 2008 13:27:23 +0000
parents 1808cebed602
children 4c7a58ef26c1
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 /* delete_dialog.c - the delete dialog */
885
1808cebed602 2007-3-12 Brian Masney <masneyb@gftp.org>
masneyb
parents: 827
diff changeset
3 /* Copyright (C) 1998-2007 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: 31
diff changeset
21 static const char cvsid[] = "$Id$";
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
22
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
23 static void
525
7262851e3ae8 2004-8-1 Brian Masney <masneyb@gftp.org>
masneyb
parents: 514
diff changeset
24 _gftp_gtk_free_del_data (gftp_transfer * transfer, gftp_dialog_data * ddata)
7262851e3ae8 2004-8-1 Brian Masney <masneyb@gftp.org>
masneyb
parents: 514
diff changeset
25 {
7262851e3ae8 2004-8-1 Brian Masney <masneyb@gftp.org>
masneyb
parents: 514
diff changeset
26 free_tdata (transfer);
7262851e3ae8 2004-8-1 Brian Masney <masneyb@gftp.org>
masneyb
parents: 514
diff changeset
27 }
7262851e3ae8 2004-8-1 Brian Masney <masneyb@gftp.org>
masneyb
parents: 514
diff changeset
28
7262851e3ae8 2004-8-1 Brian Masney <masneyb@gftp.org>
masneyb
parents: 514
diff changeset
29
7262851e3ae8 2004-8-1 Brian Masney <masneyb@gftp.org>
masneyb
parents: 514
diff changeset
30 static void
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
31 yesCB (gftp_transfer * transfer, gftp_dialog_data * ddata)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
32 {
507
34a4c6ec453c 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 506
diff changeset
33 gftpui_callback_data * cdata;
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
34 gftp_window_data * wdata;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
35
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
36 g_return_if_fail (transfer != NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
37 g_return_if_fail (transfer->files != NULL);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
38
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
39 wdata = transfer->fromwdata;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
40
507
34a4c6ec453c 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 506
diff changeset
41 cdata = g_malloc0 (sizeof (*cdata));
34a4c6ec453c 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 506
diff changeset
42 cdata->request = wdata->request;
34a4c6ec453c 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 506
diff changeset
43 cdata->files = transfer->files;
34a4c6ec453c 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 506
diff changeset
44 cdata->uidata = wdata;
34a4c6ec453c 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 506
diff changeset
45 cdata->run_function = gftpui_common_run_delete;
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
46
507
34a4c6ec453c 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 506
diff changeset
47 gftpui_common_run_callback_function (cdata);
34a4c6ec453c 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 506
diff changeset
48
34a4c6ec453c 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 506
diff changeset
49 g_free (cdata);
525
7262851e3ae8 2004-8-1 Brian Masney <masneyb@gftp.org>
masneyb
parents: 514
diff changeset
50 _gftp_gtk_free_del_data (transfer, ddata);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
51 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
52
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
53
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
54 static void
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
55 askdel (gftp_transfer * transfer)
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
56 {
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
57 char *tempstr;
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
58
507
34a4c6ec453c 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 506
diff changeset
59 if (transfer->numfiles > 0 && transfer->numdirs > 0)
34a4c6ec453c 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 506
diff changeset
60 {
34a4c6ec453c 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 506
diff changeset
61 tempstr = g_strdup_printf (_("Are you sure you want to delete these %ld files and %ld directories"), transfer->numfiles, transfer->numdirs);
34a4c6ec453c 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 506
diff changeset
62 }
34a4c6ec453c 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 506
diff changeset
63 else if (transfer->numfiles > 0)
34a4c6ec453c 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 506
diff changeset
64 {
34a4c6ec453c 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 506
diff changeset
65 tempstr = g_strdup_printf (_("Are you sure you want to delete these %ld files"), transfer->numfiles, transfer->numdirs);
34a4c6ec453c 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 506
diff changeset
66 }
34a4c6ec453c 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 506
diff changeset
67 else if (transfer->numdirs > 0)
34a4c6ec453c 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 506
diff changeset
68 {
827
251682017c97 2006-10-15 Brian Masney <masneyb@gftp.org>
masneyb
parents: 767
diff changeset
69 tempstr = g_strdup_printf (_("Are you sure you want to delete these %ld directories"), transfer->numdirs);
507
34a4c6ec453c 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 506
diff changeset
70 }
34a4c6ec453c 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 506
diff changeset
71 else
34a4c6ec453c 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 506
diff changeset
72 return;
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
73
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
74 MakeYesNoDialog (_("Delete Files/Directories"), tempstr,
525
7262851e3ae8 2004-8-1 Brian Masney <masneyb@gftp.org>
masneyb
parents: 514
diff changeset
75 yesCB, transfer, _gftp_gtk_free_del_data, transfer);
48
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
76 g_free (tempstr);
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
77 }
e5f6054590b5 2002-11-5 Brian Masney <masneyb@gftp.org>
masneyb
parents: 47
diff changeset
78
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
79
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
80 void
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
81 delete_dialog (gpointer data)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
82 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
83 gftp_file * tempfle, * newfle;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
84 GList * templist, * filelist;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
85 gftp_transfer * transfer;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
86 gftp_window_data * wdata;
506
5944bd059ae0 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 499
diff changeset
87 int num, ret;
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
88
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
89 wdata = data;
511
c3ff4479a92d 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 507
diff changeset
90 if (!check_status (_("Delete"), wdata,
c3ff4479a92d 2004-7-25 Brian Masney <masneyb@gftp.org>
masneyb
parents: 507
diff changeset
91 gftpui_common_use_threads (wdata->request), 0, 1, 1))
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
92 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
93
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
94 transfer = g_malloc0 (sizeof (*transfer));
368
af541d789f4c 2003-1-18 Brian Masney <masneyb@gftp.org>
masneyb
parents: 341
diff changeset
95 transfer->fromreq = gftp_copy_request (wdata->request);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
96 transfer->fromwdata = wdata;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
97
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
98 num = 0;
525
7262851e3ae8 2004-8-1 Brian Masney <masneyb@gftp.org>
masneyb
parents: 514
diff changeset
99 templist = gftp_gtk_get_list_selection (wdata);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
100 filelist = wdata->files;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
101 while (templist != NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
102 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
103 templist = get_next_selection (templist, &filelist, &num);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
104 tempfle = filelist->data;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
105 if (strcmp (tempfle->file, "..") == 0 ||
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
106 strcmp (tempfle->file, ".") == 0)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
107 continue;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
108 newfle = copy_fdata (tempfle);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
109 transfer->files = g_list_append (transfer->files, newfle);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
110 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
111
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
112 if (transfer->files == NULL)
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
113 {
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
114 free_tdata (transfer);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
115 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
116 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
117
63
41b71c4e5076 2002-11-2333 Brian Masney <masneyb@gftp.org>
masneyb
parents: 56
diff changeset
118 gftp_swap_socks (transfer->fromreq, wdata->request);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
119
767
49cfbe02926b 2006-7-13 Brian Masney <masneyb@gftp.org>
masneyb
parents: 525
diff changeset
120 ret = gftp_gtk_get_subdirs (transfer);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
121
525
7262851e3ae8 2004-8-1 Brian Masney <masneyb@gftp.org>
masneyb
parents: 514
diff changeset
122 gftp_swap_socks (wdata->request, transfer->fromreq);
7262851e3ae8 2004-8-1 Brian Masney <masneyb@gftp.org>
masneyb
parents: 514
diff changeset
123
7262851e3ae8 2004-8-1 Brian Masney <masneyb@gftp.org>
masneyb
parents: 514
diff changeset
124 if (!GFTP_IS_CONNECTED (wdata->request))
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
125 {
380
05ee37a5558b 2003-1-28 Brian Masney <masneyb@gftp.org>
masneyb
parents: 368
diff changeset
126 gftpui_disconnect (wdata);
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
127 return;
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
128 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
129
506
5944bd059ae0 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 499
diff changeset
130 if (!ret)
5944bd059ae0 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 499
diff changeset
131 return;
5944bd059ae0 2004-7-19 Brian Masney <masneyb@gftp.org>
masneyb
parents: 499
diff changeset
132
1
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
133 askdel (transfer);
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
134 }
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
135
8b1883341c6f Initial revision
masneyb
parents:
diff changeset
136