comparison src/gtk/transfer.c @ 341:eedc2c5727fa

2003-12-28 Brian Masney <masneyb@gftp.org> **** NOTE: this commit breaks a lot of functionality in gftp. I **** **** still have more work to do on this. Please don't email me **** **** saying that the CVS code is broken. **** * lib/bookmark.c lib/gftp.h lib/local.c lib/options.h lib/rfc2068.c lib/rfc959.c lib/sshv2.c - moved the use_threads option from the request structure over to the protocol declaration in options.h. * lib/options.h src/gtk/gftp-gtk.c - added cmd_in_gui option. When this option is enabled, a new toolbar will be shown in the GTK+ port that will allow you to control the GUI by entering manual commands. * src/Makefile.am - added uicommon directory * src/gtk/Makefile.am src/text/Makefile.am - link in the uicommon library. * src/uicommon/* src/text/gftp-text.c - moved most of the functionality of the text port over to the uicommon directory. Made this code a little more generic so that the GTK+ port can have a text interface associated with it. * src/gtk/gtkui.c src/gtk/gftp-gtk.c src/gtk/mkdir_dialog.c src/gtk/rename_dialog.c src/gtk/menu-items.c src/gtk/misc-gtk.c - started to clean up the callback functions and make them more tightly integrated with the uicommon code. * src/gtk/bookmarks.c src/gtk/chmod_dialog.c src/gtk/delete_dialog.c src/gtk/gftp-gtk.c src/gtk/menu-items.c src/gtk/misc-gtk.c src/gtk/transfer.c - s/refresh/gftpui_refresh/g s/jmp_environment/gftpui_common_jmp_environment/g s/request->use_threads/gftpui_common_use_threads (request)/g * src/gtk/options_dialog.c (apply_changes) - whenever the options are saved, check to see if the command entry needs to be shown or hidden.
author masneyb
date Sun, 28 Dec 2003 16:02:07 +0000
parents cdabbe5c9a95
children 60d3da6ab336
comparison
equal deleted inserted replaced
340:c45fdcb87667 341:eedc2c5727fa
77 gftp_file * fle; 77 gftp_file * fle;
78 GList * files; 78 GList * files;
79 79
80 request = data; 80 request = data;
81 81
82 if (request->use_threads) 82 if (gftpui_common_use_threads (request))
83 { 83 {
84 sj = sigsetjmp (jmp_environment, 1); 84 sj = sigsetjmp (gftpui_common_jmp_environment, 1);
85 use_jmp_environment = 1; 85 gftpui_common_use_jmp_environment = 1;
86 } 86 }
87 else 87 else
88 sj = 0; 88 sj = 0;
89 89
90 files = NULL; 90 files = NULL;
91 if (sj == 0 || sj == 2) 91 if (sj == 0 || sj == 2)
92 { 92 {
93 if (gftp_list_files (request) != 0 || !GFTP_IS_CONNECTED (request)) 93 if (gftp_list_files (request) != 0 || !GFTP_IS_CONNECTED (request))
94 { 94 {
95 if (request->use_threads) 95 if (gftpui_common_use_threads (request))
96 use_jmp_environment = 0; 96 gftpui_common_use_jmp_environment = 0;
97 97
98 request->stopable = 0; 98 request->stopable = 0;
99 if (request->wakeup_main_thread[1] > 0) 99 if (request->wakeup_main_thread[1] > 0)
100 write (request->wakeup_main_thread[1], " ", 1); 100 write (request->wakeup_main_thread[1], " ", 1);
101 return (NULL); 101 return (NULL);
127 } 127 }
128 g_free (fle); 128 g_free (fle);
129 129
130 if (!GFTP_IS_CONNECTED (request)) 130 if (!GFTP_IS_CONNECTED (request))
131 { 131 {
132 if (request->use_threads) 132 if (gftpui_common_use_threads (request))
133 use_jmp_environment = 0; 133 gftpui_common_use_jmp_environment = 0;
134 134
135 request->stopable = 0; 135 request->stopable = 0;
136 if (request->wakeup_main_thread[1] > 0) 136 if (request->wakeup_main_thread[1] > 0)
137 write (request->wakeup_main_thread[1], " ", 1); 137 write (request->wakeup_main_thread[1], " ", 1);
138 return (NULL); 138 return (NULL);
152 fle->isdir = 1; 152 fle->isdir = 1;
153 files = g_list_prepend (files, fle); 153 files = g_list_prepend (files, fle);
154 } 154 }
155 } 155 }
156 156
157 if (request->use_threads) 157 if (gftpui_common_use_threads (request))
158 use_jmp_environment = 0; 158 gftpui_common_use_jmp_environment = 0;
159 159
160 request->stopable = 0; 160 request->stopable = 0;
161 if (request->wakeup_main_thread[1] > 0) 161 if (request->wakeup_main_thread[1] > 0)
162 write (request->wakeup_main_thread[1], " ", 1); 162 write (request->wakeup_main_thread[1], " ", 1);
163 return (files); 163 return (files);
178 if (check_reconnect (wdata) < 0) 178 if (check_reconnect (wdata) < 0)
179 return (0); 179 return (0);
180 180
181 gtk_clist_freeze (GTK_CLIST (wdata->listbox)); 181 gtk_clist_freeze (GTK_CLIST (wdata->listbox));
182 wdata->request->stopable = 1; 182 wdata->request->stopable = 1;
183 if (wdata->request->use_threads) 183 if (gftpui_common_use_threads (wdata->request))
184 { 184 {
185 gtk_widget_set_sensitive (stop_btn, 1); 185 gtk_widget_set_sensitive (stop_btn, 1);
186 186
187 handler = setup_wakeup_main_thread (wdata->request); 187 handler = setup_wakeup_main_thread (wdata->request);
188 pthread_create (&wdata->tid, NULL, getdir_thread, wdata->request); 188 pthread_create (&wdata->tid, NULL, getdir_thread, wdata->request);
249 gftp_lookup_request_option (request, "retries", &retries); 249 gftp_lookup_request_option (request, "retries", &retries);
250 gftp_lookup_request_option (request, "sleep_time", &sleep_time); 250 gftp_lookup_request_option (request, "sleep_time", &sleep_time);
251 gftp_lookup_request_option (request, "network_timeout", &network_timeout); 251 gftp_lookup_request_option (request, "network_timeout", &network_timeout);
252 252
253 conn_num = 0; 253 conn_num = 0;
254 if (request->use_threads) 254 if (gftpui_common_use_threads (request))
255 { 255 {
256 sj = sigsetjmp (jmp_environment, 1); 256 sj = sigsetjmp (gftpui_common_jmp_environment, 1);
257 use_jmp_environment = 1; 257 gftpui_common_use_jmp_environment = 1;
258 } 258 }
259 else 259 else
260 sj = 0; 260 sj = 0;
261 261
262 ret = 0; 262 ret = 0;
292 alarm (sleep_time); 292 alarm (sleep_time);
293 pause (); 293 pause ();
294 } 294 }
295 } 295 }
296 296
297 if (request->use_threads) 297 if (gftpui_common_use_threads (request))
298 use_jmp_environment = 0; 298 gftpui_common_use_jmp_environment = 0;
299 299
300 request->stopable = 0; 300 request->stopable = 0;
301 if (request->wakeup_main_thread[1] > 0) 301 if (request->wakeup_main_thread[1] > 0)
302 write (request->wakeup_main_thread[1], " ", 1); 302 write (request->wakeup_main_thread[1], " ", 1);
303 return (GINT_TO_POINTER (ret)); 303 return (GINT_TO_POINTER (ret));
345 } 345 }
346 else 346 else
347 gftp_set_password (request, ""); 347 gftp_set_password (request, "");
348 } 348 }
349 349
350 if (wdata && wdata->request == request && request->use_threads) 350 if (wdata && wdata->request == request && gftpui_common_use_threads (request))
351 { 351 {
352 request->stopable = 1; 352 request->stopable = 1;
353 if (wdata) 353 if (wdata)
354 gtk_clist_freeze (GTK_CLIST (wdata->listbox)); 354 gtk_clist_freeze (GTK_CLIST (wdata->listbox));
355 gtk_widget_set_sensitive (stop_btn, 1); 355 gtk_widget_set_sensitive (stop_btn, 1);
453 if (transfer->files != NULL) 453 if (transfer->files != NULL)
454 { 454 {
455 gftp_swap_socks (transfer->fromreq, fromwdata->request); 455 gftp_swap_socks (transfer->fromreq, fromwdata->request);
456 gftp_swap_socks (transfer->toreq, towdata->request); 456 gftp_swap_socks (transfer->toreq, towdata->request);
457 457
458 if (transfer->fromreq->use_threads || 458 if (gftpui_common_use_threads (transfer->fromreq) ||
459 (transfer->toreq && transfer->toreq->use_threads)) 459 (transfer->toreq && gftpui_common_use_threads (transfer->toreq)))
460 { 460 {
461 transfer->fromreq->stopable = 1; 461 transfer->fromreq->stopable = 1;
462 pthread_create (&fromwdata->tid, NULL, do_getdir_thread, transfer); 462 pthread_create (&fromwdata->tid, NULL, do_getdir_thread, transfer);
463 463
464 timeout_num = gtk_timeout_add (100, progress_timeout, transfer); 464 timeout_num = gtk_timeout_add (100, progress_timeout, transfer);
515 gftp_transfer * transfer; 515 gftp_transfer * transfer;
516 int success, sj; 516 int success, sj;
517 517
518 transfer = data; 518 transfer = data;
519 519
520 if (transfer->fromreq->use_threads || 520 if (gftpui_common_use_threads (transfer->fromreq) ||
521 (transfer->toreq && transfer->toreq->use_threads)) 521 (transfer->toreq && gftpui_common_use_threads (transfer->toreq)))
522 { 522 {
523 sj = sigsetjmp (jmp_environment, 1); 523 sj = sigsetjmp (gftpui_common_jmp_environment, 1);
524 use_jmp_environment = 1; 524 gftpui_common_use_jmp_environment = 1;
525 } 525 }
526 else 526 else
527 sj = 0; 527 sj = 0;
528 528
529 success = 0; 529 success = 0;
537 transfer->fromreq->logging_function (gftp_logging_error, 537 transfer->fromreq->logging_function (gftp_logging_error,
538 transfer->fromreq, 538 transfer->fromreq,
539 _("Operation canceled\n")); 539 _("Operation canceled\n"));
540 } 540 }
541 541
542 if (transfer->fromreq->use_threads || 542 if (gftpui_common_use_threads (transfer->fromreq) ||
543 (transfer->toreq && transfer->toreq->use_threads)) 543 (transfer->toreq && gftpui_common_use_threads (transfer->toreq)))
544 use_jmp_environment = 0; 544 gftpui_common_use_jmp_environment = 0;
545 545
546 transfer->fromreq->stopable = 0; 546 transfer->fromreq->stopable = 0;
547 return (GINT_TO_POINTER (success)); 547 return (GINT_TO_POINTER (success));
548 } 548 }
549 549
1096 gftp_lookup_request_option (tdata->fromreq, "refresh_files", &refresh_files); 1096 gftp_lookup_request_option (tdata->fromreq, "refresh_files", &refresh_files);
1097 1097
1098 if (refresh_files && tdata->curfle && tdata->curfle->next && 1098 if (refresh_files && tdata->curfle && tdata->curfle->next &&
1099 compare_request (tdata->toreq, 1099 compare_request (tdata->toreq,
1100 ((gftp_window_data *) tdata->towdata)->request, 1)) 1100 ((gftp_window_data *) tdata->towdata)->request, 1))
1101 refresh (tdata->towdata); 1101 gftpui_refresh (tdata->towdata);
1102 } 1102 }
1103 1103
1104 1104
1105 static void 1105 static void
1106 get_trans_password (gftp_request * request, gftp_dialog_data * ddata) 1106 get_trans_password (gftp_request * request, gftp_dialog_data * ddata)
1251 else 1251 else
1252 gftp_disconnect (tdata->toreq); 1252 gftp_disconnect (tdata->toreq);
1253 1253
1254 if (tdata->towdata != NULL && compare_request (tdata->toreq, 1254 if (tdata->towdata != NULL && compare_request (tdata->toreq,
1255 ((gftp_window_data *) tdata->towdata)->request, 1)) 1255 ((gftp_window_data *) tdata->towdata)->request, 1))
1256 refresh (tdata->towdata); 1256 gftpui_refresh (tdata->towdata);
1257 1257
1258 num_transfers_in_progress--; 1258 num_transfers_in_progress--;
1259 } 1259 }
1260 1260
1261 if (!tdata->show && tdata->started) 1261 if (!tdata->show && tdata->started)