aboutsummaryrefslogtreecommitdiffstats
path: root/mail/em-utils.c
diff options
context:
space:
mode:
authorSrinivasa Ragavan <sragavan@novell.com>2005-10-18 16:31:39 +0800
committerSrinivasa Ragavan <sragavan@src.gnome.org>2005-10-18 16:31:39 +0800
commitce7790405d57206d48f7ceedf2b40c84cb4d5a68 (patch)
tree6dd3adca8e1eb94f20b799d4bd384b32434832dd /mail/em-utils.c
parente751338e4953544b113b19ed0ea8eeebfb0b111d (diff)
downloadgsoc2013-evolution-ce7790405d57206d48f7ceedf2b40c84cb4d5a68.tar.gz
gsoc2013-evolution-ce7790405d57206d48f7ceedf2b40c84cb4d5a68.tar.zst
gsoc2013-evolution-ce7790405d57206d48f7ceedf2b40c84cb4d5a68.zip
Fixed mark junk, keybinding to focus search widget.
2005-10-18 Srinivasa Ragavan <sragavan@novell.com> * Fixed mark junk, keybinding to focus search widget. svn path=/trunk/; revision=30520
Diffstat (limited to 'mail/em-utils.c')
-rw-r--r--mail/em-utils.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/mail/em-utils.c b/mail/em-utils.c
index f43f63f689..434b0205d9 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -64,6 +64,7 @@
#include "em-composer-utils.h"
#include "em-format-quote.h"
#include "em-account-editor.h"
+#include "e-attachment.h"
static void emu_save_part_done (CamelMimePart *part, char *name, int done, void *data);
@@ -117,6 +118,44 @@ em_utils_prompt_user(GtkWindow *parent, const char *promptkey, const char *tag,
return button == GTK_RESPONSE_YES;
}
+
+char *
+em_utils_temp_save_attachments (GSList *attachments)
+{
+ char *path = NULL;
+ GSList *selected;
+
+ path = e_mkdtemp("evolution-attachments-XXXXXX");
+
+ for ( selected = attachments; selected != NULL; selected = selected->next) {
+ const char *file_name;
+ char *safe_name = NULL;
+ char *file_path;
+ CamelMimePart *part = (CamelMimePart *)((EAttachment *)selected->data)->body;
+
+ file_name = camel_mime_part_get_filename(part);
+ if (file_name == NULL) {
+ file_name = _("attachment");
+ } else {
+ safe_name = g_strdup(file_name);
+ e_filename_make_safe(safe_name);
+ file_name = safe_name;
+ }
+
+ file_path = g_build_filename (path, file_name, NULL);
+
+ if (!g_file_test(file_path, (G_FILE_TEST_EXISTS)))
+ mail_save_part(part, file_path, NULL, NULL);
+ else
+ g_warning ("Could not save %s. File already exists", file_path);
+
+ g_free (file_path);
+ g_free (safe_name);
+ }
+
+ return path;
+}
+
/**
* em_utils_uids_copy:
* @uids: array of uids