[anjal] Fix issues around downloading attachments and saving them.



commit c0faa31fa61bec2f6bdf738192ebd6ab875538ae
Author: Srinivasa Ragavan <sragavan gnome org>
Date:   Fri Jan 22 12:39:54 2010 +0530

    Fix issues around downloading attachments and saving them.

 src/em-format-mail-display.c |   21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/src/em-format-mail-display.c b/src/em-format-mail-display.c
index c07e19f..a6c3601 100644
--- a/src/em-format-mail-display.c
+++ b/src/em-format-mail-display.c
@@ -1554,6 +1554,8 @@ efmd_attachment_save_handle_error (EAttachment *attachment,
 		return;
 	}
 
+	gtk_widget_hide_all (box);
+
 	/* Ignore cancellations. */
 	if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
 		return;
@@ -1607,17 +1609,24 @@ emfd_save_attachment (GtkButton *button, EAttachment *attachment)
 		/* Translators: Default attachment filename. */
 		name = _("attachment.dat");
 
-	if (download_dir)
-		path = g_build_filename (g_get_home_dir(), download_dir, name, NULL);
-	else 
+	if (download_dir) {
+		if (*download_dir == '/')
+			path = g_build_filename (download_dir, name, NULL);
+		else
+			path = g_build_filename (g_get_home_dir(), download_dir, name, NULL);
+	} else 
 		path = g_build_filename (g_get_home_dir(), name, NULL);
 	while (g_file_test(path, G_FILE_TEST_EXISTS)) {
 		char *tname = g_strdup_printf("%s_%d", name, i++);
 		g_free(path);
 
-		if (download_dir)
-			path = g_build_filename (g_get_home_dir(), download_dir, tname, NULL);
-		else 
+		if (download_dir) {
+			if (*download_dir == '/') /* Absolute path */
+				path = g_build_filename (download_dir, tname, NULL);
+			else
+				path = g_build_filename (g_get_home_dir(), download_dir, tname, NULL);
+
+		} else 
 			path = g_build_filename (g_get_home_dir(), tname, NULL);
 		g_free(tname);
 	}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]