aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2004-03-03 16:11:19 +0800
committerMichael Zucci <zucchi@src.gnome.org>2004-03-03 16:11:19 +0800
commit7dfbad5dce6da74e6c83b7b8196952f114e04a56 (patch)
tree993974121db7dd0539ad38ab5bf33a6e36eb0bdb
parentcc11303dc2a9775eeb742feedff5c2bfea224fc3 (diff)
downloadgsoc2013-evolution-7dfbad5dce6da74e6c83b7b8196952f114e04a56.tar
gsoc2013-evolution-7dfbad5dce6da74e6c83b7b8196952f114e04a56.tar.gz
gsoc2013-evolution-7dfbad5dce6da74e6c83b7b8196952f114e04a56.tar.bz2
gsoc2013-evolution-7dfbad5dce6da74e6c83b7b8196952f114e04a56.tar.lz
gsoc2013-evolution-7dfbad5dce6da74e6c83b7b8196952f114e04a56.tar.xz
gsoc2013-evolution-7dfbad5dce6da74e6c83b7b8196952f114e04a56.tar.zst
gsoc2013-evolution-7dfbad5dce6da74e6c83b7b8196952f114e04a56.zip
** See bug #54924.
2004-03-03 Not Zed <NotZed@Ximian.com> ** 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
-rw-r--r--mail/ChangeLog6
-rw-r--r--mail/em-utils.c30
2 files changed, 28 insertions, 8 deletions
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 <NotZed@Ximian.com>
+ ** 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;