aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-09-30 20:16:30 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-10-01 01:55:38 +0800
commit75b078e99793350fa2f54ca80b72213d1bfbb17f (patch)
tree1327ffa3b9e87538e6302aeff6f64e28e6935d98 /mail
parentdb5afff530e35d643f23b8d4e35c930e26e58804 (diff)
downloadgsoc2013-evolution-75b078e99793350fa2f54ca80b72213d1bfbb17f.tar
gsoc2013-evolution-75b078e99793350fa2f54ca80b72213d1bfbb17f.tar.gz
gsoc2013-evolution-75b078e99793350fa2f54ca80b72213d1bfbb17f.tar.bz2
gsoc2013-evolution-75b078e99793350fa2f54ca80b72213d1bfbb17f.tar.lz
gsoc2013-evolution-75b078e99793350fa2f54ca80b72213d1bfbb17f.tar.xz
gsoc2013-evolution-75b078e99793350fa2f54ca80b72213d1bfbb17f.tar.zst
gsoc2013-evolution-75b078e99793350fa2f54ca80b72213d1bfbb17f.zip
Kill em_utils_temp_save_part().
Rewrite the last usage of it in itip-formatter.c to use EAttachments instead. This also allowed me to kill mail_save_part() in mail-ops.c. I may need to reevaluate the EAttachment API at some point for all these fringe EAttachment uses we're accumulating. Having to asynchronously "load" an EAttachment whose content is already in memory kinda sucks.
Diffstat (limited to 'mail')
-rw-r--r--mail/em-utils.c64
-rw-r--r--mail/em-utils.h2
-rw-r--r--mail/mail-ops.c107
-rw-r--r--mail/mail-ops.h4
4 files changed, 0 insertions, 177 deletions
diff --git a/mail/em-utils.c b/mail/em-utils.c
index c7b7020b4b..971d74f892 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -84,8 +84,6 @@ extern const gchar *shell_builtin_backend;
/* Used in em_util_ask_open_many() */
#define TOO_MANY 10
-static void emu_save_part_done (CamelMimePart *part, gchar *name, gint done, gpointer data);
-
#define d(x)
gboolean
@@ -943,68 +941,6 @@ em_utils_selection_get_urilist (GtkSelectionData *selection_data,
g_strfreev (uris);
}
-static void
-emu_save_part_done (CamelMimePart *part, gchar *name, gint done, gpointer data)
-{
- ((gint *)data)[0] = done;
-}
-
-/**
- * em_utils_temp_save_part:
- * @parent:
- * @part:
- * @mode: readonly or not.
- *
- * Save a part's content to a temporary file, and return the
- * filename.
- *
- * Return value: NULL if anything failed.
- **/
-gchar *
-em_utils_temp_save_part (GtkWidget *parent, CamelMimePart *part, gboolean mode)
-{
- const gchar *filename;
- gchar *tmpdir, *path, *utf8_mfilename = NULL, *mfilename = NULL;
- gint done;
- GtkWidget *w;
-
- tmpdir = e_mkdtemp("evolution-tmp-XXXXXX");
- if (tmpdir == NULL) {
- w = e_alert_dialog_new_for_args ((GtkWindow *)parent, "mail:no-create-tmp-path", g_strerror(errno), NULL);
- em_utils_show_error_silent (w);
- return NULL;
- }
-
- filename = camel_mime_part_get_filename (part);
- if (filename == NULL) {
- /* This is the default filename used for temporary file creation */
- filename = _("Unknown");
- } else {
- utf8_mfilename = g_strdup (filename);
- e_filename_make_safe (utf8_mfilename);
- mfilename = g_filename_from_utf8 ((const gchar *) utf8_mfilename, -1, NULL, NULL, NULL);
- g_free (utf8_mfilename);
- filename = (const gchar *) mfilename;
- }
-
- path = g_build_filename (tmpdir, filename, NULL);
- g_free (tmpdir);
- g_free (mfilename);
-
- /* FIXME: This doesn't handle default charsets */
- if (mode)
- mail_msg_wait (mail_save_part (part, path, emu_save_part_done, &done, TRUE));
- else
- mail_msg_wait (mail_save_part (part, path, emu_save_part_done, &done, FALSE));
- if (!done) {
- /* mail_save_part should popup an error box automagically */
- g_free (path);
- path = NULL;
- }
-
- return path;
-}
-
/** em_utils_folder_is_templates:
* @folder: folder
* @uri: uri for this folder, if known
diff --git a/mail/em-utils.h b/mail/em-utils.h
index 0e9ef9f41a..36318ffdf4 100644
--- a/mail/em-utils.h
+++ b/mail/em-utils.h
@@ -61,8 +61,6 @@ void em_utils_selection_get_uidlist (GtkSelectionData *data, CamelFolder *dest,
void em_utils_selection_set_urilist (GtkSelectionData *data, CamelFolder *folder, GPtrArray *uids);
void em_utils_selection_get_urilist (GtkSelectionData *data, CamelFolder *folder);
-gchar *em_utils_temp_save_part (GtkWidget *parent, CamelMimePart *part, gboolean mode);
-
gboolean em_utils_folder_is_drafts (CamelFolder *folder, const gchar *uri);
gboolean em_utils_folder_is_templates (CamelFolder *folder, const gchar *uri);
gboolean em_utils_folder_is_sent (CamelFolder *folder, const gchar *uri);
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index 1146f8d126..4fd6ab207e 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -2303,113 +2303,6 @@ mail_save_messages (CamelFolder *folder, GPtrArray *uids, const gchar *path,
return id;
}
-/* ** SAVE PART ******************************************************* */
-
-struct _save_part_msg {
- MailMsg base;
-
- CamelMimePart *part;
- gchar *path;
- void (*done)(CamelMimePart *part, gchar *path, gint saved, gpointer data);
- gpointer data;
- gboolean readonly;
-};
-
-static gchar *
-save_part_desc (struct _save_part_msg *m)
-{
- return g_strdup(_("Saving attachment"));
-}
-
-static void
-save_part_exec (struct _save_part_msg *m)
-{
- CamelDataWrapper *content;
- CamelStream *stream;
- gchar *path;
-
- if (strstr (m->path, "://"))
- path = m->path;
- else
- path = g_filename_to_uri (m->path, NULL, NULL);
-
- if (!m->readonly) {
- if (!(stream = camel_stream_vfs_new_with_uri (path, CAMEL_STREAM_VFS_CREATE))) {
- g_set_error (
- &m->base.error, G_FILE_ERROR,
- g_file_error_from_errno (errno),
- _("Cannot create output file: %s:\n %s"),
- path, g_strerror (errno));
- if (path != m->path)
- g_free (path);
- return;
- }
- } else if (!(stream = camel_stream_vfs_new_with_uri (path, CAMEL_STREAM_VFS_CREATE))) {
- g_set_error (
- &m->base.error, G_FILE_ERROR,
- g_file_error_from_errno (errno),
- _("Cannot create output file: %s:\n %s"),
- path, g_strerror (errno));
- if (path != m->path)
- g_free (path);
- return;
- }
-
- if (path != m->path)
- g_free (path);
-
- content = camel_medium_get_content (CAMEL_MEDIUM (m->part));
-
- if (camel_data_wrapper_decode_to_stream_sync (
- content, stream, m->base.cancellable, &m->base.error) == -1
- || camel_stream_flush (stream, m->base.cancellable, &m->base.error) == -1)
- g_prefix_error (&m->base.error, _("Could not write data: "));
-
- g_object_unref (stream);
-}
-
-static void
-save_part_done (struct _save_part_msg *m)
-{
- if (m->done)
- m->done (m->part, m->path, m->base.error == NULL, m->data);
-}
-
-static void
-save_part_free (struct _save_part_msg *m)
-{
- g_object_unref (m->part);
- g_free (m->path);
-}
-
-static MailMsgInfo save_part_info = {
- sizeof (struct _save_part_msg),
- (MailMsgDescFunc) save_part_desc,
- (MailMsgExecFunc) save_part_exec,
- (MailMsgDoneFunc) save_part_done,
- (MailMsgFreeFunc) save_part_free
-};
-
-gint
-mail_save_part (CamelMimePart *part, const gchar *path,
- void (*done)(CamelMimePart *part, gchar *path, gint saved, gpointer data), gpointer data, gboolean readonly)
-{
- struct _save_part_msg *m;
- gint id;
- m = mail_msg_new (&save_part_info);
- m->part = part;
- g_object_ref (part);
- m->path = g_strdup (path);
- m->data = data;
- m->done = done;
- m->readonly = readonly;
-
- id = m->base.seq;
- mail_msg_unordered_push (m);
-
- return id;
-}
-
/* ** PREPARE OFFLINE ***************************************************** */
struct _prep_offline_msg {
diff --git a/mail/mail-ops.h b/mail/mail-ops.h
index a0af5ff097..4bea1b03df 100644
--- a/mail/mail-ops.h
+++ b/mail/mail-ops.h
@@ -120,10 +120,6 @@ gint mail_save_messages (CamelFolder *folder, GPtrArray *uids, const gchar *path
void (*done) (CamelFolder *folder, GPtrArray *uids, gchar *path, gpointer data),
gpointer data);
-gint mail_save_part (CamelMimePart *part, const gchar *path,
- void (*done)(CamelMimePart *part, gchar *path, gint saved, gpointer data),
- gpointer data, gboolean readonly);
-
/* yeah so this is messy, but it does a lot, maybe i can consolidate all user_data's to be the one */
void mail_send_queue (CamelFolder *queue,
const gchar *destination,