Mercurial > gftp.yaz
changeset 511:c3ff4479a92d
2004-7-25 Brian Masney <masneyb@gftp.org>
* src/gtk/transfer.c - when spawning a thread to get the
subdirectories, don't refresh the local directory listing. Also added
custom connect/disconnect functions so that timeouts can be handled
properly.
* src/gtk/delete_dialog.c - make sure that 2 connections to the server
don't get established
* src/uicommon/gftpui.c src/uicommon/gftpui.h - added dont_refresh
variable to gftpui_callback_data structure. If this is true, then it
will not run gftpui_refresh() after the thread terminates
author | masneyb |
---|---|
date | Sun, 25 Jul 2004 14:15:00 +0000 |
parents | e0585b062a75 |
children | 2c8a42a63a31 |
files | ChangeLog src/gtk/delete_dialog.c src/gtk/transfer.c src/uicommon/gftpui.c src/uicommon/gftpui.h |
diffstat | 5 files changed, 71 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Sat Jul 24 12:43:03 2004 +0000 +++ b/ChangeLog Sun Jul 25 14:15:00 2004 +0000 @@ -1,3 +1,16 @@ +2004-7-25 Brian Masney <masneyb@gftp.org> + * src/gtk/transfer.c - when spawning a thread to get the + subdirectories, don't refresh the local directory listing. Also added + custom connect/disconnect functions so that timeouts can be handled + properly. + + * src/gtk/delete_dialog.c - make sure that 2 connections to the server + don't get established + + * src/uicommon/gftpui.c src/uicommon/gftpui.h - added dont_refresh + variable to gftpui_callback_data structure. If this is true, then it + will not run gftpui_refresh() after the thread terminates + 2004-7-24 Brian Masney <masneyb@gftp.org> * src/uicommon/gftpui.c src/uicommon/gftpui.h - added support for a custom connect and disconnect function in the thread callback @@ -2605,7 +2618,7 @@ * cvsclean - added this script - * *.[ch] - added $Id: ChangeLog,v 1.288 2004/07/24 12:43:03 masneyb Exp $ tags + * *.[ch] - added $Id: ChangeLog,v 1.289 2004/07/25 14:15:00 masneyb Exp $ tags * debian/* - updated files from Debian maintainer
--- a/src/gtk/delete_dialog.c Sat Jul 24 12:43:03 2004 +0000 +++ b/src/gtk/delete_dialog.c Sun Jul 25 14:15:00 2004 +0000 @@ -36,18 +36,12 @@ cdata->files = transfer->files; cdata->uidata = wdata; cdata->run_function = gftpui_common_run_delete; + cdata->dont_refresh = 1; gftpui_common_run_callback_function (cdata); g_free (cdata); - free_tdata (transfer); - - if (!GFTP_IS_CONNECTED (wdata->request)) - gftpui_disconnect (wdata); - else - gftpui_refresh (wdata); - - gtk_clist_thaw (GTK_CLIST (wdata->listbox)); + /* FIXME free_tdata (transfer); */ } @@ -87,7 +81,8 @@ int num, ret; wdata = data; - if (!check_status (_("Delete"), wdata, gftpui_common_use_threads (wdata->request), 0, 1, 1)) + if (!check_status (_("Delete"), wdata, + gftpui_common_use_threads (wdata->request), 0, 1, 1)) return; transfer = g_malloc0 (sizeof (*transfer));
--- a/src/gtk/transfer.c Sat Jul 24 12:43:03 2004 +0000 +++ b/src/gtk/transfer.c Sun Jul 25 14:15:00 2004 +0000 @@ -33,6 +33,7 @@ cdata->request = wdata->request; cdata->uidata = wdata; cdata->run_function = gftpui_common_run_ls; + cdata->dont_refresh = 1; gftpui_common_run_callback_function (cdata); @@ -168,6 +169,49 @@ static int +gftpui_gtk_tdata_connect (gftpui_callback_data * cdata) +{ + gftp_transfer * tdata; + int ret; + + tdata = cdata->user_data; + + if (tdata->fromreq != NULL) + { + ret = gftp_connect (tdata->fromreq); + if (ret < 0) + return (ret); + } + + if (tdata->toreq != NULL) + { + ret = gftp_connect (tdata->toreq); + if (ret < 0) + return (ret); + } + + return (0); +} + + +static void +gftpui_gtk_tdata_disconnect (gftpui_callback_data * cdata) +{ + gftp_transfer * tdata; + + tdata = cdata->user_data; + + if (tdata->fromreq != NULL) + gftp_disconnect (tdata->fromreq); + + if (tdata->toreq != NULL) + gftp_disconnect (tdata->toreq); + + cdata->request->datafd = -1; +} + + +static int _gftp_getdir_thread (gftpui_callback_data * cdata) { return (gftp_get_all_subdirs (cdata->user_data, NULL)); @@ -187,6 +231,10 @@ cdata->uidata = transfer->fromwdata; cdata->request = ((gftp_window_data *) transfer->fromwdata)->request; cdata->run_function = _gftp_getdir_thread; + cdata->connect_function = gftpui_gtk_tdata_connect; + cdata->disconnect_function = gftpui_gtk_tdata_disconnect; + cdata->dont_check_connection = 1; + cdata->dont_refresh = 1; timeout_num = gtk_timeout_add (100, progress_timeout, transfer); ret = gftpui_common_run_callback_function (cdata);
--- a/src/uicommon/gftpui.c Sat Jul 24 12:43:03 2004 +0000 +++ b/src/uicommon/gftpui.c Sun Jul 25 14:15:00 2004 +0000 @@ -77,6 +77,7 @@ if (success == GFTP_ETIMEDOUT && num_timeouts == 0) { + _gftpui_cb_disconnect (cdata); num_timeouts++; if (_gftpui_cb_connect (cdata) == 0) continue; @@ -96,7 +97,6 @@ else { _gftpui_cb_disconnect (cdata); - gftp_disconnect (cdata->request); cdata->request->logging_function (gftp_logging_error, cdata->request, _("Operation canceled\n")); } @@ -121,7 +121,7 @@ else ret = GPOINTER_TO_INT (cdata->run_function (cdata)); - if (ret == 0 && cdata->run_function != gftpui_common_run_ls) + if (ret == 0 && !cdata->dont_refresh) gftpui_refresh (cdata->uidata); return (ret == 0); @@ -613,6 +613,7 @@ cdata->uidata = uidata; cdata->source_string = *command != '\0' ? (char *) command : NULL; cdata->run_function = gftpui_common_run_ls; + cdata->dont_refresh = 1; gftpui_common_run_callback_function (cdata);
--- a/src/uicommon/gftpui.h Sat Jul 24 12:43:03 2004 +0000 +++ b/src/uicommon/gftpui.h Sun Jul 25 14:15:00 2004 +0000 @@ -38,7 +38,8 @@ int (*run_function) (gftpui_callback_data * cdata); int (*connect_function) (gftpui_callback_data * cdata); void (*disconnect_function) (gftpui_callback_data * cdata); - unsigned int dont_check_connection : 1; + unsigned int dont_check_connection : 1, + dont_refresh : 1; };