comparison src/gtk/delete_dialog.c @ 525:7262851e3ae8

2004-8-1 Brian Masney <masneyb@gftp.org> * lib/sshv2.c - treat all integers from the remote server as unsigned * src/gtk/delete_dialog.c - fixed memory leak * src/gtk/chmod_dialog.c src/gtk/delete_dialog.c src/gtk/dnd.c src/gtk/gftp-gtk.c src/gtk/gftp-gtk.h src/gtk/gtkui.c src/gtk/menu-items.c src/gtk/transfer.c - added gftp_gtk_get_list_selection() macro
author masneyb
date Sun, 01 Aug 2004 11:03:39 +0000
parents e55d8b35d809
children 49cfbe02926b
comparison
equal deleted inserted replaced
524:1f7d97e7c475 525:7262851e3ae8
19 19
20 #include "gftp-gtk.h" 20 #include "gftp-gtk.h"
21 static const char cvsid[] = "$Id$"; 21 static const char cvsid[] = "$Id$";
22 22
23 static void 23 static void
24 _gftp_gtk_free_del_data (gftp_transfer * transfer, gftp_dialog_data * ddata)
25 {
26 free_tdata (transfer);
27 }
28
29
30 static void
24 yesCB (gftp_transfer * transfer, gftp_dialog_data * ddata) 31 yesCB (gftp_transfer * transfer, gftp_dialog_data * ddata)
25 { 32 {
26 gftpui_callback_data * cdata; 33 gftpui_callback_data * cdata;
27 gftp_window_data * wdata; 34 gftp_window_data * wdata;
28 35
38 cdata->run_function = gftpui_common_run_delete; 45 cdata->run_function = gftpui_common_run_delete;
39 46
40 gftpui_common_run_callback_function (cdata); 47 gftpui_common_run_callback_function (cdata);
41 48
42 g_free (cdata); 49 g_free (cdata);
43 /* FIXME free_tdata (transfer); */ 50 _gftp_gtk_free_del_data (transfer, ddata);
44 } 51 }
45 52
46 53
47 static void 54 static void
48 askdel (gftp_transfer * transfer) 55 askdel (gftp_transfer * transfer)
63 } 70 }
64 else 71 else
65 return; 72 return;
66 73
67 MakeYesNoDialog (_("Delete Files/Directories"), tempstr, 74 MakeYesNoDialog (_("Delete Files/Directories"), tempstr,
68 yesCB, transfer, NULL, NULL); 75 yesCB, transfer, _gftp_gtk_free_del_data, transfer);
69 g_free (tempstr); 76 g_free (tempstr);
70 } 77 }
71 78
72 79
73 void 80 void
87 transfer = g_malloc0 (sizeof (*transfer)); 94 transfer = g_malloc0 (sizeof (*transfer));
88 transfer->fromreq = gftp_copy_request (wdata->request); 95 transfer->fromreq = gftp_copy_request (wdata->request);
89 transfer->fromwdata = wdata; 96 transfer->fromwdata = wdata;
90 97
91 num = 0; 98 num = 0;
92 templist = GTK_CLIST (wdata->listbox)->selection; 99 templist = gftp_gtk_get_list_selection (wdata);
93 filelist = wdata->files; 100 filelist = wdata->files;
94 while (templist != NULL) 101 while (templist != NULL)
95 { 102 {
96 templist = get_next_selection (templist, &filelist, &num); 103 templist = get_next_selection (templist, &filelist, &num);
97 tempfle = filelist->data; 104 tempfle = filelist->data;
110 117
111 gftp_swap_socks (transfer->fromreq, wdata->request); 118 gftp_swap_socks (transfer->fromreq, wdata->request);
112 119
113 ret = gftp_gtk_get_subdirs (transfer, &wdata->tid); 120 ret = gftp_gtk_get_subdirs (transfer, &wdata->tid);
114 121
115 if (!GFTP_IS_CONNECTED (transfer->fromreq)) 122 gftp_swap_socks (wdata->request, transfer->fromreq);
123
124 if (!GFTP_IS_CONNECTED (wdata->request))
116 { 125 {
117 gftpui_disconnect (wdata); 126 gftpui_disconnect (wdata);
118 return; 127 return;
119 } 128 }
120
121 gftp_swap_socks (wdata->request, transfer->fromreq);
122 129
123 if (!ret) 130 if (!ret)
124 return; 131 return;
125 132
126 askdel (transfer); 133 askdel (transfer);