[anjal] Fix the XDG download directory.



commit 327e5e450c90dbf2d4385c10b2cbd823cfe78a70
Author: Srinivasa Ragavan <sragavan novell com>
Date:   Fri Jul 17 19:25:16 2009 +0530

    Fix the XDG download directory.

 src/em-format-mail-display.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/src/em-format-mail-display.c b/src/em-format-mail-display.c
index 1883bdd..ff924af 100644
--- a/src/em-format-mail-display.c
+++ b/src/em-format-mail-display.c
@@ -1504,6 +1504,7 @@ emfd_save_attachment (GtkButton *button, EAttachment *attachment)
 	const gchar *name = NULL;
 	GFile *dest;
 	int i = 1;
+	const char *download_dir = g_get_user_special_dir(G_USER_DIRECTORY_DOWNLOAD);
 
 	file_info = e_attachment_get_file_info (attachment);
 	if (file_info != NULL)
@@ -1511,15 +1512,22 @@ emfd_save_attachment (GtkButton *button, EAttachment *attachment)
 	if (name == NULL)
 		/* Translators: Default attachment filename. */
 		name = _("attachment.dat");
-	
-	path = g_build_filename (g_get_home_dir(), "Downloads", name, NULL);
+
+	if (download_dir)
+		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);
-		path = g_build_filename (g_get_home_dir(), "Downloads", tname, NULL);
+
+		if (download_dir)
+			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);
 	}
-	
+
 	dest = g_file_new_for_path (path);
 	e_attachment_save_async (
 		attachment, dest, (GAsyncReadyCallback)



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