Mercurial > gftp.yaz
changeset 510:e0585b062a75
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
* lib/local.c (local_connect) - don't step on request->directory if
it is already set to the current working directory
author | masneyb |
---|---|
date | Sat, 24 Jul 2004 12:43:03 +0000 |
parents | b6ce74de1cd9 |
children | c3ff4479a92d |
files | ChangeLog lib/local.c src/uicommon/gftpui.c src/uicommon/gftpui.h |
diffstat | 4 files changed, 36 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Sat Jul 24 12:14:32 2004 +0000 +++ b/ChangeLog Sat Jul 24 12:43:03 2004 +0000 @@ -1,4 +1,10 @@ 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 + + * lib/local.c (local_connect) - don't step on request->directory if + it is already set to the current working directory + * lib/protocols.c (gftp_get_all_subdirs) - if there is an error in the protocol function, make sure the error code is returned as is. This is so that timeouts can be detected properly @@ -2599,7 +2605,7 @@ * cvsclean - added this script - * *.[ch] - added $Id: ChangeLog,v 1.287 2004/07/24 12:14:32 masneyb Exp $ tags + * *.[ch] - added $Id: ChangeLog,v 1.288 2004/07/24 12:43:03 masneyb Exp $ tags * debian/* - updated files from Debian maintainer
--- a/lib/local.c Sat Jul 24 12:14:32 2004 +0000 +++ b/lib/local.c Sat Jul 24 12:43:03 2004 +0000 @@ -59,8 +59,12 @@ g_return_val_if_fail (request != NULL, GFTP_EFATAL); g_return_val_if_fail (request->protonum == GFTP_LOCAL_NUM, GFTP_EFATAL); - if (request->directory) + if (request->directory != NULL) { + if (getcwd (tempstr, sizeof (tempstr)) != NULL && + strcmp (tempstr, request->directory) == 0) + return (0); + if (chdir (request->directory) != 0) { request->logging_function (gftp_logging_error, request,
--- a/src/uicommon/gftpui.c Sat Jul 24 12:14:32 2004 +0000 +++ b/src/uicommon/gftpui.c Sat Jul 24 12:43:03 2004 +0000 @@ -28,6 +28,26 @@ gftp_logging_func gftpui_common_logfunc; +static int +_gftpui_cb_connect (gftpui_callback_data * cdata) +{ + if (cdata->connect_function != NULL) + return (cdata->connect_function (cdata)); + else + return (gftp_connect (cdata->request)); +} + + +static void +_gftpui_cb_disconnect (gftpui_callback_data * cdata) +{ + if (cdata->connect_function != NULL) + cdata->disconnect_function (cdata); + else + gftp_disconnect (cdata->request); +} + + static void * _gftpui_common_thread_callback (void * data) { @@ -58,7 +78,7 @@ if (success == GFTP_ETIMEDOUT && num_timeouts == 0) { num_timeouts++; - if (gftp_connect (cdata->request) == 0) + if (_gftpui_cb_connect (cdata) == 0) continue; } @@ -75,6 +95,7 @@ } else { + _gftpui_cb_disconnect (cdata); gftp_disconnect (cdata->request); cdata->request->logging_function (gftp_logging_error, cdata->request, _("Operation canceled\n"));
--- a/src/uicommon/gftpui.h Sat Jul 24 12:14:32 2004 +0000 +++ b/src/uicommon/gftpui.h Sat Jul 24 12:43:03 2004 +0000 @@ -36,6 +36,8 @@ void *user_data; int retries; 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; };