# HG changeset patch # User masneyb # Date 1035946401 0 # Node ID 4bcfaf6307b591307c1a859b8678450d2d9be420 # Parent 66c064fd05bcde6dda62e8468e3e93eabf427e48 2002-10-29 Brian Masney * lib/config_file.c lib/gftp.h lib/options.h src/gtk/menu-items.c src/gtk/view_dialog.c - removed tmp_directory variable. Instead use g_get_tmp_dir () * lib/gftp.h (struct gftp_request) - added int cancel : 1 * lib/misc.c lib/protocols.c lib/rfc2068.c lib/rfc959.c lib/ssh.c lib/sshv2.c - check for interrupted signal calls * lib/protocols.c - added gftp_fgets() and gftp_fwrite() functions * src/gtk/delete_dialog.c src/gtk/misc-gtk.c src/gtk/transfer.c - use g_main_context_iteration in GTK+ 2.0 port * src/gtk/misc-gtk.c - use g_object_unref instead of gdk_drawable_unref in GTK+ 2.0 port diff -r 66c064fd05bc -r 4bcfaf6307b5 ChangeLog --- a/ChangeLog Fri Oct 18 02:53:52 2002 +0000 +++ b/ChangeLog Wed Oct 30 02:53:21 2002 +0000 @@ -1,3 +1,21 @@ +2002-10-29 Brian Masney + * lib/config_file.c lib/gftp.h lib/options.h src/gtk/menu-items.c + src/gtk/view_dialog.c - removed tmp_directory variable. Instead use + g_get_tmp_dir () + + * lib/gftp.h (struct gftp_request) - added int cancel : 1 + + * lib/misc.c lib/protocols.c lib/rfc2068.c lib/rfc959.c lib/ssh.c + lib/sshv2.c - check for interrupted signal calls + + * lib/protocols.c - added gftp_fgets() and gftp_fwrite() functions + + * src/gtk/delete_dialog.c src/gtk/misc-gtk.c src/gtk/transfer.c - use + g_main_context_iteration in GTK+ 2.0 port + + * src/gtk/misc-gtk.c - use g_object_unref instead of gdk_drawable_unref + in GTK+ 2.0 port + 2002-10-17 Brian Masney * lib/protocols.c - add gftp_abort_transfer function. Also, in gftp_transfer_file, when we do a gftp_put_file, if that fails, @@ -79,7 +97,7 @@ * cvsclean - added this script - * *.[ch] - added $Id: ChangeLog,v 1.19 2002/10/18 02:53:50 masneyb Exp $ tags + * *.[ch] - added $Id: ChangeLog,v 1.20 2002/10/30 02:53:20 masneyb Exp $ tags * debian/* - updated files from Debian maintainer diff -r 66c064fd05bc -r 4bcfaf6307b5 autogen.sh --- a/autogen.sh Fri Oct 18 02:53:52 2002 +0000 +++ b/autogen.sh Wed Oct 30 02:53:21 2002 +0000 @@ -71,7 +71,7 @@ *xlc | *xlc\ * | *lcc | *lcc\ *) am_opt=--include-deps;; esac -gettextize -c --intl --no-changelog +gettextize -f -c --intl --no-changelog aclocal-1.4 $ACLOCAL_FLAGS diff -r 66c064fd05bc -r 4bcfaf6307b5 lib/config_file.c --- a/lib/config_file.c Fri Oct 18 02:53:52 2002 +0000 +++ b/lib/config_file.c Wed Oct 30 02:53:21 2002 +0000 @@ -521,11 +521,6 @@ emailaddr = g_strconcat (pw->pw_name, "@", unme.nodename, NULL); gftp_write_config_file (); } - - if ((tempstr = getenv ("TMP")) != NULL && *tempstr != '\0') - tmp_directory = g_strconcat (tempstr, NULL); - else - tmp_directory = g_strconcat ("/tmp", NULL); } diff -r 66c064fd05bc -r 4bcfaf6307b5 lib/gftp.h --- a/lib/gftp.h Fri Oct 18 02:53:52 2002 +0000 +++ b/lib/gftp.h Wed Oct 30 02:53:21 2002 +0000 @@ -211,6 +211,8 @@ use_threads : 1, /* Whether we need to spawn a thread for this protocol */ cached : 1, /* Is this directory listing cached? */ + cancel : 1, /* If a signal is received, should + we cancel this operation */ stopable : 1; off_t gotbytes; @@ -441,7 +443,7 @@ extern char version[], *emailaddr, *edit_program, *view_program, *firewall_host, *firewall_username, *firewall_password, *firewall_account, *proxy_config, *http_proxy_host, - *http_proxy_username, *http_proxy_password, *tmp_directory, + *http_proxy_username, *http_proxy_password, *startup_directory, *ssh_prog_name, *ssh_extra_params, **ssh_extra_params_list, *default_protocol, *ssh1_sftp_path, *ssh2_sftp_path; @@ -793,5 +795,15 @@ void print_file_list ( GList * list ); +char *gftp_fgets ( gftp_request * request, + char * str, + size_t len, + FILE * fd ); + +size_t gftp_fwrite ( gftp_request * request, + const void *ptr, + size_t size, + FILE * fd ); + #endif diff -r 66c064fd05bc -r 4bcfaf6307b5 lib/misc.c --- a/lib/misc.c Fri Oct 18 02:53:52 2002 +0000 +++ b/lib/misc.c Wed Oct 30 02:53:21 2002 +0000 @@ -864,6 +864,7 @@ return (NULL); } + errno = 0; while (1) { FD_ZERO (&rdfds); @@ -872,7 +873,7 @@ tv.tv_usec = 0; if (select (fd + 1, &rdfds, NULL, NULL, &tv) < 0) { - if (errno == EINTR) + if (errno == EINTR && !request->cancel) continue; ok = 0; break; @@ -880,7 +881,7 @@ if ((rd = read (fd, tempstr + diff, rem - 1)) < 0) { - if (errno == EINTR) + if (errno == EINTR && !request->cancel) continue; ok = 0; break; diff -r 66c064fd05bc -r 4bcfaf6307b5 lib/options.h --- a/lib/options.h Fri Oct 18 02:53:52 2002 +0000 +++ b/lib/options.h Wed Oct 30 02:53:21 2002 +0000 @@ -60,7 +60,6 @@ *http_proxy_host = NULL, *http_proxy_username = NULL, *http_proxy_password = NULL, - *tmp_directory = NULL, *startup_directory = NULL, *ssh_prog_name = NULL, *ssh_extra_params = NULL, diff -r 66c064fd05bc -r 4bcfaf6307b5 lib/protocols.c --- a/lib/protocols.c Fri Oct 18 02:53:52 2002 +0000 +++ b/lib/protocols.c Wed Oct 30 02:53:21 2002 +0000 @@ -241,6 +241,7 @@ struct timeval tv; fd_set fset; size_t len; + int ret; g_return_val_if_fail (request != NULL, -2); g_return_val_if_fail (buf != NULL, -2); @@ -248,28 +249,57 @@ if (request->get_next_file_chunk != NULL) return (request->get_next_file_chunk (request, buf, size)); - FD_ZERO (&fset); - FD_SET (fileno (request->datafd), &fset); - tv.tv_sec = request->network_timeout; - tv.tv_usec = 0; - if (select (fileno (request->datafd) + 1, &fset, NULL, NULL, &tv) <= 0) + errno = 0; + len = 0; + do { - request->logging_function (gftp_logging_error, request->user_data, - _("Connection to %s timed out\n"), - request->hostname); + FD_ZERO (&fset); + FD_SET (fileno (request->datafd), &fset); + tv.tv_sec = request->network_timeout; + tv.tv_usec = 0; + ret = select (fileno (request->datafd) + 1, &fset, NULL, NULL, &tv); + if (ret == -1 && errno == EINTR) + { + if (request->cancel) + break; + else + continue; + } + else if (ret <= 0) + { + request->logging_function (gftp_logging_error, request->user_data, + _("Connection to %s timed out\n"), + request->hostname); + gftp_disconnect (request); + return (-1); + } + + if ((len = read (fileno (request->datafd), buf, size)) == -1) + { + if (errno == EINTR) + { + if (request->cancel) + break; + else + continue; + } + + request->logging_function (gftp_logging_error, request->user_data, + _("Error reading from host %s: %s\n"), + request->hostname, + g_strerror (errno)); + gftp_disconnect (request); + return (-1); + } + } + while (errno == EINTR && !request->cancel); + + if (errno == EINTR && request->cancel) + { gftp_disconnect (request); return (-1); } - if ((len = read (fileno (request->datafd), buf, size)) == -1) - { - request->logging_function (gftp_logging_error, request->user_data, - _("Error reading from host %s: %s\n"), - request->hostname, - g_strerror (errno)); - gftp_disconnect (request); - return (-1); - } return (len); } @@ -281,6 +311,7 @@ size_t len, ret; fd_set fset; char *pos; + int sret; g_return_val_if_fail (request != NULL, -2); @@ -294,30 +325,57 @@ pos = buf; while (size > 0) { - FD_ZERO (&fset); - FD_SET (fileno (request->datafd), &fset); - tv.tv_sec = request->network_timeout; - tv.tv_usec = 0; - if (!select (fileno (request->datafd) + 1, NULL, &fset, NULL, &tv)) + errno = 0; + do { - request->logging_function (gftp_logging_error, request->user_data, - _("Connection to %s timed out\n"), - request->hostname); - gftp_disconnect (request); - return (-1); + FD_ZERO (&fset); + FD_SET (fileno (request->datafd), &fset); + tv.tv_sec = request->network_timeout; + tv.tv_usec = 0; + sret = select (fileno (request->datafd) + 1, NULL, &fset, NULL, &tv); + if (sret == -1 && errno == EINTR) + { + if (request->cancel) + break; + else + continue; + } + else if (sret <= 0) + { + request->logging_function (gftp_logging_error, request->user_data, + _("Connection to %s timed out\n"), + request->hostname); + gftp_disconnect (request); + return (-1); + } + + if ((len = write (fileno (request->datafd), pos, size)) < 0) + { + if (sret == -1 && errno == EINTR) + { + if (request->cancel) + break; + else + continue; + } + + request->logging_function (gftp_logging_error, request->user_data, + _("Error writing to host %s: %s\n"), + request->hostname, + g_strerror (errno)); + gftp_disconnect (request); + return (-1); + } + size -= len; + pos += len; } + while (errno == EINTR && !request->cancel); + } - if ((len = write (fileno (request->datafd), pos, size)) < 0) - { - request->logging_function (gftp_logging_error, request->user_data, - _("Error writing to host %s: %s\n"), - request->hostname, - g_strerror (errno)); - gftp_disconnect (request); - return (-1); - } - size -= len; - pos += len; + if (errno == EINTR && request->cancel) + { + gftp_disconnect (request); + return (-1); } return (ret); @@ -1970,3 +2028,105 @@ printf ("--END OF FILE LISTING--\n"); } + +char * +gftp_fgets (gftp_request * request, char * str, size_t len, FILE * fd) +{ + char * ret = NULL; + + errno = 0; + do + { + ret = fgets (str, len, fd); + if (ferror (fd)) + { + if (errno == EINTR) + { + clearerr (fd); + if (request->cancel) + break; + else + continue; + } + + request->logging_function (gftp_logging_error, request->user_data, + _("Error: Could not read from socket: %s\n"), + g_strerror (errno)); + gftp_disconnect (request); + return (NULL); + } + } + while (errno == EINTR && !request->cancel); + + if (errno == EINTR && request->cancel) + { + gftp_disconnect (request); + return (NULL); + } + + return (ret); +} + + +size_t +gftp_fwrite (gftp_request * request, const void *ptr, size_t size, FILE * fd) +{ + size_t ret; + + errno = 0; + ret = 0; + do + { + ret = fwrite (ptr, size, 1, fd); + if (ferror (fd)) + { + if (errno == EINTR) + { + if (request->cancel) + break; + else + { + clearerr (fd); + continue; + } + } + + request->logging_function (gftp_logging_error, request->user_data, + _("Error: Could not write to socket: %s\n"), + g_strerror (errno)); + gftp_disconnect (request); + return (-1); + } + + fflush (request->sockfd_write); + if (ferror (fd)) + { + if (errno == EINTR) + { + if (request->cancel) + break; + else + { + clearerr (fd); + continue; + } + } + + request->logging_function (gftp_logging_error, request->user_data, + _("Error: Could not write to socket: %s\n"), + g_strerror (errno)); + gftp_disconnect (request); + return (-1); + } + } + while (errno == EINTR && !request->cancel); + + if (errno == EINTR && request->cancel) + { + gftp_disconnect (request); + return (-1); + } + + return (ret); +} + diff -r 66c064fd05bc -r 4bcfaf6307b5 lib/rfc2068.c --- a/lib/rfc2068.c Fri Oct 18 02:53:52 2002 +0000 +++ b/lib/rfc2068.c Wed Oct 30 02:53:21 2002 +0000 @@ -249,8 +249,6 @@ rfc2068_get_next_file_chunk (gftp_request * request, char *buf, size_t size) { rfc2068_params * params; - struct timeval tv; - fd_set fset; size_t len; g_return_val_if_fail (request != NULL, -2); @@ -260,32 +258,31 @@ if (params->max_bytes == params->read_bytes || feof (request->sockfd)) return (0); - FD_ZERO (&fset); - FD_SET (fileno (request->sockfd), &fset); - tv.tv_sec = request->network_timeout; - tv.tv_usec = 0; - if (select (fileno (request->sockfd) + 1, &fset, NULL, NULL, &tv) <= 0) + errno = 0; + do { - request->logging_function (gftp_logging_error, request->user_data, - _("Connection to %s timed out\n"), - request->hostname); - gftp_disconnect (request); - return (-1); - } + if (params->max_bytes > 0 && + size + params->read_bytes > params->max_bytes) + size = params->max_bytes - params->read_bytes; - if (params->max_bytes > 0 && size + params->read_bytes > params->max_bytes) - size = params->max_bytes - params->read_bytes; + len = fread (buf, 1, size, request->sockfd); + if (ferror (request->sockfd)) + { + if (errno == EINTR && !request->cancel) + { + clearerr (request->sockfd); + continue; + } - len = fread (buf, 1, size, request->sockfd); - if (ferror (request->sockfd)) - { - request->logging_function (gftp_logging_error, request->user_data, - _("Error reading from host %s: %s\n"), - request->hostname, - g_strerror (errno)); - gftp_disconnect (request); - return (-1); + request->logging_function (gftp_logging_error, request->user_data, + _("Error reading from host %s: %s\n"), + request->hostname, + g_strerror (errno)); + gftp_disconnect (request); + return (-1); + } } + while (errno == EINTR && !request->cancel); params->read_bytes += len; return (len); @@ -428,23 +425,18 @@ while (1) { - /* I don't run select() here because select could return - successfully saying there is data, but the fgets call could block if - there is no carriage return */ - if (!fgets (tempstr, sizeof (tempstr), fd)) - { - gftp_file_destroy (fle); - return (-2); - } + if (!gftp_fgets (request, tempstr, sizeof (tempstr), fd)) + { + gftp_file_destroy (fle); + return (-2); + } + tempstr[sizeof (tempstr) - 1] = '\0'; params->read_bytes += strlen (tempstr); if (params->chunked_transfer && strcmp (tempstr, "0\r\n") == 0) { - /* I don't run select() here because select could return - successfully saying there is data, but the fgets call could block - if there is no carriage return */ - while (fgets (tempstr, sizeof (tempstr), fd)) + while (gftp_fgets (request, tempstr, sizeof (tempstr), fd)) { if (strcmp (tempstr, "\r\n") == 0) break; @@ -589,14 +581,13 @@ params = request->protocol_data; params->max_bytes = 0; - /* I don't run select() here because select could return - successfully saying there is data, but the fgets call could block if - there is no carriage return */ - if (!fgets (tempstr, sizeof (tempstr), request->sockfd)) + + if (!gftp_fgets (request, tempstr, sizeof (tempstr), request->sockfd)) { gftp_disconnect (request); return (0); } + if (request->last_ftp_response) g_free (request->last_ftp_response); request->last_ftp_response = g_malloc (strlen (tempstr) + 1); @@ -608,11 +599,8 @@ params->chunked_transfer = 0; while (1) { - /* I don't run select() here because select could return - successfully saying there is data, but the fgets call could block if - there is no carriage return */ /* Read rest of proxy header */ - if (!fgets (tempstr, sizeof (tempstr), request->sockfd)) + if (!gftp_fgets (request, tempstr, sizeof (tempstr), request->sockfd)) { gftp_disconnect (request); return (0); diff -r 66c064fd05bc -r 4bcfaf6307b5 lib/rfc959.c --- a/lib/rfc959.c Fri Oct 18 02:53:52 2002 +0000 +++ b/lib/rfc959.c Wed Oct 30 02:53:21 2002 +0000 @@ -48,8 +48,6 @@ static int rfc959_accept_active_connection ( gftp_request * request ); static int rfc959_send_command ( gftp_request * request, const char *command ); -static int write_to_socket ( gftp_request *request, - const char *command ); static int rfc959_read_response ( gftp_request * request ); static int rfc959_chdir ( gftp_request * request, const char *directory ); @@ -456,7 +454,8 @@ g_free (tempstr); tempstr = g_strconcat ("RETR ", fromfile, "\r\n", NULL); - if (write_to_socket (fromreq, tempstr) < 0) + if (gftp_fwrite (fromreq, tempstr, strlen (tempstr), + fromreq->sockfd_write) < 0) { g_free (tempstr); return (-2); @@ -464,7 +463,7 @@ g_free (tempstr); tempstr = g_strconcat ("STOR ", tofile, "\r\n", NULL); - if (write_to_socket (toreq, tempstr) < 0) + if (gftp_fwrite (toreq, tempstr, strlen (tempstr), toreq->sockfd_write) < 0) { g_free (tempstr); return (-2); @@ -578,10 +577,7 @@ } do { - /* I don't run select() here because select could return - successfully saying there is data, but the fgets call could block if - there is no carriage return */ - if (!fgets (tempstr, sizeof (tempstr), fd)) + if (!gftp_fgets (request, tempstr, sizeof (tempstr), fd)) { gftp_file_destroy (fle); if (ferror (fd)) @@ -846,55 +842,13 @@ command); } - if (write_to_socket (request, command) < 0) + if (gftp_fwrite (request, command, strlen (command), + request->sockfd_write) < 0) return (-1); return (rfc959_read_response (request)); } -static int -write_to_socket (gftp_request *request, const char *command) -{ - struct timeval tv; - fd_set fset; - - FD_ZERO (&fset); - FD_SET (fileno (request->sockfd_write), &fset); - tv.tv_sec = request->network_timeout; - tv.tv_usec = 0; - if (!select (fileno (request->sockfd_write) + 1, NULL, &fset, NULL, &tv)) - { - request->logging_function (gftp_logging_error, request->user_data, - _("Connection to %s timed out\n"), - request->hostname); - gftp_disconnect (request); - return (-1); - } - - fwrite (command, strlen (command), 1, request->sockfd_write); - if (ferror (request->sockfd_write)) - { - request->logging_function (gftp_logging_error, request->user_data, - _("Error: Could not write to socket: %s\n"), - g_strerror (errno)); - gftp_disconnect (request); - return (-1); - } - - fflush (request->sockfd_write); - if (ferror (request->sockfd_write)) - { - request->logging_function (gftp_logging_error, request->user_data, - _("Error: Could not write to socket: %s\n"), - g_strerror (errno)); - gftp_disconnect (request); - return (-1); - } - - return (0); -} - - static int rfc959_read_response (gftp_request * request) @@ -914,10 +868,7 @@ do { - /* I don't run select() here because select could return - successfully saying there is data, but the fgets call could block if - there is no carriage return */ - if (!fgets (tempstr, sizeof (tempstr), request->sockfd)) + if (!gftp_fgets (request, tempstr, sizeof (tempstr), request->sockfd)) break; tempstr[strlen (tempstr) - 1] = '\0'; if (tempstr[strlen (tempstr) - 1] == '\r') diff -r 66c064fd05bc -r 4bcfaf6307b5 lib/ssh.c --- a/lib/ssh.c Fri Oct 18 02:53:52 2002 +0000 +++ b/lib/ssh.c Wed Oct 30 02:53:21 2002 +0000 @@ -1011,7 +1011,6 @@ ssh_send_command (gftp_request * request, int cmdnum, const char *command, size_t len) { - ssize_t wrote; ssh_parms * params; char *buf; int clen; @@ -1026,28 +1025,9 @@ memcpy (&buf[6], command, len); ssh_log_command (request, params->channel, cmdnum, command, len, 1); - wrote = fwrite (buf, 1, len + 6, request->sockfd_write); - if (ferror (request->sockfd_write)) - { - request->logging_function (gftp_logging_error, request->user_data, - _("Error: Could not write to socket: %s\n"), - g_strerror (errno)); - gftp_disconnect (request); - g_free (buf); - return (-1); - } + if (gftp_fwrite (request, buf, len + 6, request->sockfd_write) < 0) + return (-2); - g_free (buf); - - fflush (request->sockfd_write); - if (ferror (request->sockfd_write)) - { - request->logging_function (gftp_logging_error, request->user_data, - _("Error: Could not write to socket: %s\n"), - g_strerror (errno)); - gftp_disconnect (request); - return (-1); - } return 0; } diff -r 66c064fd05bc -r 4bcfaf6307b5 lib/sshv2.c --- a/lib/sshv2.c Fri Oct 18 02:53:52 2002 +0000 +++ b/lib/sshv2.c Wed Oct 30 02:53:21 2002 +0000 @@ -499,7 +499,6 @@ gint32 len) { char buf[34000]; - ssize_t wrote; gint32 clen; if (len > 33995) @@ -525,25 +524,9 @@ sshv2_log_command (request, gftp_logging_send, type, buf + 5, len); - wrote = fwrite (buf, len + 5, 1, request->sockfd_write); - if (ferror (request->sockfd_write)) - { - request->logging_function (gftp_logging_error, request->user_data, - _("Error: Could not write to socket: %s\n"), - g_strerror (errno)); - gftp_disconnect (request); - return (-1); - } + if (gftp_fwrite (request, buf, len + 5, request->sockfd_write) < 0) + return (-2); - fflush (request->sockfd_write); - if (ferror (request->sockfd_write)) - { - request->logging_function (gftp_logging_error, request->user_data, - _("Error: Could not write to socket: %s\n"), - g_strerror (errno)); - gftp_disconnect (request); - return (-1); - } return 0; } diff -r 66c064fd05bc -r 4bcfaf6307b5 src/gtk/delete_dialog.c --- a/src/gtk/delete_dialog.c Fri Oct 18 02:53:52 2002 +0000 +++ b/src/gtk/delete_dialog.c Wed Oct 30 02:53:21 2002 +0000 @@ -84,7 +84,11 @@ while (transfer->fromreq->stopable) { GDK_THREADS_LEAVE (); +#if GTK_MAJOR_VERSION == 1 && GTK_MINOR_VERSION == 2 g_main_iteration (TRUE); +#else + g_main_context_iteration (NULL, TRUE); +#endif } gtk_widget_set_sensitive (stop_btn, 0); @@ -152,7 +156,11 @@ while (transfer->fromreq->stopable) { GDK_THREADS_LEAVE (); +#if GTK_MAJOR_VERSION == 1 && GTK_MINOR_VERSION == 2 g_main_iteration (TRUE); +#else + g_main_context_iteration (NULL, TRUE); +#endif } gtk_widget_set_sensitive (stop_btn, 0); diff -r 66c064fd05bc -r 4bcfaf6307b5 src/gtk/menu-items.c --- a/src/gtk/menu-items.c Fri Oct 18 02:53:52 2002 +0000 +++ b/src/gtk/menu-items.c Wed Oct 30 02:53:21 2002 +0000 @@ -630,7 +630,7 @@ GtkTextIter iter, iter2; #endif - tempstr = g_strconcat (tmp_directory, "/gftp-view.XXXXXXXXXX", NULL); + tempstr = g_strconcat (g_get_tmp_dir (), "/gftp-view.XXXXXXXXXX", NULL); if ((fd = mkstemp (tempstr)) < 0) { ftp_log (gftp_logging_misc, NULL, diff -r 66c064fd05bc -r 4bcfaf6307b5 src/gtk/misc-gtk.c --- a/src/gtk/misc-gtk.c Fri Oct 18 02:53:52 2002 +0000 +++ b/src/gtk/misc-gtk.c Wed Oct 30 02:53:21 2002 +0000 @@ -44,7 +44,12 @@ while (ret) { GDK_THREADS_LEAVE (); +#if GTK_MAJOR_VERSION == 1 && GTK_MINOR_VERSION == 2 ret = g_main_iteration (FALSE); +#else + ret = g_main_context_iteration (NULL, FALSE); +#endif + } } @@ -420,8 +425,8 @@ gdk_pixmap_unref (graphic->pixmap); gdk_bitmap_unref (graphic->bitmap); #else - gdk_drawable_unref (graphic->pixmap); - gdk_drawable_unref (graphic->bitmap); + g_object_unref (graphic->pixmap); + g_object_unref (graphic->bitmap); #endif g_hash_table_remove (graphic_hash_table, filename); @@ -1137,7 +1142,11 @@ while (wdata->request->stopable) { GDK_THREADS_LEAVE (); +#if GTK_MAJOR_VERSION == 1 && GTK_MINOR_VERSION == 2 g_main_iteration (TRUE); +#else + g_main_context_iteration (NULL, TRUE); +#endif } pthread_join (wdata->tid, &ret); diff -r 66c064fd05bc -r 4bcfaf6307b5 src/gtk/transfer.c --- a/src/gtk/transfer.c Fri Oct 18 02:53:52 2002 +0000 +++ b/src/gtk/transfer.c Wed Oct 30 02:53:21 2002 +0000 @@ -91,7 +91,11 @@ while (wdata->request->stopable) { GDK_THREADS_LEAVE (); +#if GTK_MAJOR_VERSION == 1 && GTK_MINOR_VERSION == 2 g_main_iteration (TRUE); +#else + g_main_context_iteration (NULL, TRUE); +#endif } teardown_wakeup_main_thread (wdata->request, handler); @@ -263,7 +267,11 @@ while (request->stopable) { GDK_THREADS_LEAVE (); +#if GTK_MAJOR_VERSION == 1 && GTK_MINOR_VERSION == 2 g_main_iteration (TRUE); +#else + g_main_context_iteration (NULL, TRUE); +#endif } if (GFTP_GET_PASSWORD (request) == NULL || @@ -286,7 +294,11 @@ while (request->stopable) { GDK_THREADS_LEAVE (); +#if GTK_MAJOR_VERSION == 1 && GTK_MINOR_VERSION == 2 g_main_iteration (TRUE); +#else + g_main_context_iteration (NULL, TRUE); +#endif } pthread_join (wdata->tid, &ret); teardown_wakeup_main_thread (wdata->request, handler); @@ -451,7 +463,11 @@ while (transfer->fromreq->stopable) { GDK_THREADS_LEAVE (); +#if GTK_MAJOR_VERSION == 1 && GTK_MINOR_VERSION == 2 g_main_iteration (TRUE); +#else + g_main_context_iteration (NULL, TRUE); +#endif } gtk_timeout_remove (timeout_num); @@ -2175,6 +2191,7 @@ if (socketpair (AF_UNIX, SOCK_STREAM, 0, request->wakeup_main_thread) == 0) { + /* FIXME - depreciated in GDK 2.0 */ handler = gdk_input_add (request->wakeup_main_thread[0], GDK_INPUT_READ, wakeup_main_thread, request); } @@ -2193,6 +2210,7 @@ { if (request->wakeup_main_thread[0] > 0 && request->wakeup_main_thread[1] > 0) { + /* FIXME - depreciated in GDK 2.0 */ gdk_input_remove (handler); close (request->wakeup_main_thread[0]); close (request->wakeup_main_thread[1]); diff -r 66c064fd05bc -r 4bcfaf6307b5 src/gtk/view_dialog.c --- a/src/gtk/view_dialog.c Fri Oct 18 02:53:52 2002 +0000 +++ b/src/gtk/view_dialog.c Wed Oct 30 02:53:21 2002 +0000 @@ -64,7 +64,7 @@ new_fle = copy_fdata (curfle); if (new_fle->destfile) g_free (new_fle->destfile); - new_fle->destfile = g_strconcat (tmp_directory, "/gftp-view.XXXXXX", NULL); + new_fle->destfile = g_strconcat (g_get_tmp_dir (), "/gftp-view.XXXXXX", NULL); if ((fd = mkstemp (new_fle->destfile)) < 0) { ftp_log (gftp_logging_misc, NULL, @@ -133,7 +133,7 @@ new_fle = copy_fdata (curfle); if (new_fle->destfile) g_free (new_fle->destfile); - new_fle->destfile = g_strconcat (tmp_directory, "/gftp-view.XXXXXX", + new_fle->destfile = g_strconcat (g_get_tmp_dir (), "/gftp-view.XXXXXX", NULL); if ((fd = mkstemp (new_fle->destfile)) < 0) {