From 7dfbad5dce6da74e6c83b7b8196952f114e04a56 Mon Sep 17 00:00:00 2001 From: Not Zed Date: Wed, 3 Mar 2004 08:11:19 +0000 Subject: ** See bug #54924. 2004-03-03 Not Zed ** See bug #54924. * em-utils.c (em_utils_selection_set_urilist): Try to get the drop filename from the message subject, or folder name. (em_utils_empty_trash): kill warning. svn path=/trunk/; revision=24946 --- mail/ChangeLog | 6 ++++++ mail/em-utils.c | 30 ++++++++++++++++++++++-------- 2 files changed, 28 insertions(+), 8 deletions(-) (limited to 'mail') diff --git a/mail/ChangeLog b/mail/ChangeLog index 451dfa9afe..b17ff590d4 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,5 +1,11 @@ 2004-03-03 Not Zed + ** See bug #54924. + + * em-utils.c (em_utils_selection_set_urilist): Try to get the drop + filename from the message subject, or folder name. + (em_utils_empty_trash): kill warning. + ** See bug #54121. * mail-component.c (impl_requestCreateItem) diff --git a/mail/em-utils.c b/mail/em-utils.c index 24622329f1..306bd0474c 100644 --- a/mail/em-utils.c +++ b/mail/em-utils.c @@ -2029,19 +2029,34 @@ em_utils_selection_set_urilist(GtkSelectionData *data, CamelFolder *folder, GPtr { const char *tmpdir; CamelStream *fstream; - char *uri, *p; + char *uri, *p, *file = NULL; int fd; + CamelMessageInfo *info; tmpdir = e_mkdtemp("drag-n-drop-XXXXXX"); if (tmpdir == NULL) return; - /* FIXME: this used to save a single message with the subject - as the filename but it was unsafe, and makes this messier, - the pain */ - - p = uri = g_alloca (strlen (tmpdir) + 16); - p += sprintf (uri, "file:///%s/mbox", tmpdir); + /* Try to get the drop filename from the message or folder */ + if (uids->len == 1) { + info = camel_folder_get_message_info(folder, uids->pdata[0]); + if (info) { + file = g_strdup(camel_message_info_subject(info)); + camel_folder_free_message_info(folder, info); + } + } + + /* TODO: Handle conflicts? */ + if (file == NULL) { + /* Drop filename for messages from a mailbox */ + file = g_strdup_printf(_("Messages from %s"), folder->name); + } + + e_filename_make_safe(file); + + p = uri = g_alloca (strlen (tmpdir) + strlen(file) + 16); + p += sprintf (uri, "file:///%s/%s", tmpdir, file); + g_free(file); fd = open(uri + 7, O_WRONLY | O_CREAT | O_EXCL, 0666); if (fd == -1) @@ -2434,7 +2449,6 @@ em_utils_expunge_folder (GtkWidget *parent, CamelFolder *folder) void em_utils_empty_trash (GtkWidget *parent) { - extern CamelSession *session; CamelProvider *provider; EAccountList *accounts; EAccount *account; -- cgit v1.2.3