aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorSrinivasa Ragavan <sragavan@src.gnome.org>2006-02-21 00:01:01 +0800
committerSrinivasa Ragavan <sragavan@src.gnome.org>2006-02-21 00:01:01 +0800
commitbc081447ebfff72bd9310306f40f286415f319c9 (patch)
tree2697dff521b5a182cf245f80ac4971fce81ee809 /mail
parent3c48cf5fc086d2f2b5ad0f56f6f58f2b83280fb7 (diff)
downloadgsoc2013-evolution-bc081447ebfff72bd9310306f40f286415f319c9.tar.gz
gsoc2013-evolution-bc081447ebfff72bd9310306f40f286415f319c9.tar.zst
gsoc2013-evolution-bc081447ebfff72bd9310306f40f286415f319c9.zip
Fix for bug 322160.
svn path=/trunk/; revision=31548
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog10
-rw-r--r--mail/em-utils.c12
-rw-r--r--mail/mail-ops.c15
-rw-r--r--mail/mail-ops.h2
4 files changed, 27 insertions, 12 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 5ece1f8e2c..2982dbef9b 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,4 +1,12 @@
-2006-02-20 Parthasarathi Susarla <sparthasarathi@novell.com>
+2006-02-20 Srinivasa Ragavan <sragavan@novell.com>
+
+ ** Fixes bug #322160 and committed for PRSuman.
+
+ * em-utils.c: Added code to pass a variable to overwrite/ro mode.
+ * mail-ops.[ch]: Added code to take care of overwrite and set the file
+ mode.
+
+t2006-02-20 Parthasarathi Susarla <sparthasarathi@novell.com>
** Fixes bug 33139
diff --git a/mail/em-utils.c b/mail/em-utils.c
index 194073ee19..cc0302fe59 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -433,7 +433,7 @@ emu_save_part_response(GtkWidget *filesel, int response, CamelMimePart *part)
emu_update_save_path(path, FALSE);
/* FIXME: popup error if it fails? */
- mail_save_part(part, path, NULL, NULL);
+ mail_save_part(part, path, NULL, NULL, FALSE);
}
gtk_widget_destroy((GtkWidget *)filesel);
@@ -508,7 +508,7 @@ emu_save_parts_response (GtkWidget *filesel, int response, GSList *parts)
file_path = g_build_filename (path, file_name, NULL);
if (!g_file_test(file_path, (G_FILE_TEST_EXISTS)) || e_error_run(NULL, E_ERROR_ASK_FILE_EXISTS_OVERWRITE, file_name, NULL) == GTK_RESPONSE_OK)
- mail_save_part(part, file_path, NULL, NULL);
+ mail_save_part(part, file_path, NULL, NULL, FALSE);
else
g_warning ("Could not save %s. File already exists", file_path);
@@ -576,7 +576,7 @@ em_utils_save_part_to_file(GtkWidget *parent, const char *filename, CamelMimePar
}
/* FIXME: This doesn't handle default charsets */
- mail_msg_wait(mail_save_part(part, filename, emu_save_part_done, &done));
+ mail_msg_wait(mail_save_part(part, filename, emu_save_part_done, &done, FALSE));
return done;
}
@@ -1281,10 +1281,10 @@ em_utils_temp_save_part(GtkWidget *parent, CamelMimePart *part)
path = g_build_filename(tmpdir, filename, NULL);
g_free(tmpdir);
g_free(mfilename);
-
+
/* FIXME: This doesn't handle default charsets */
- mail_msg_wait(mail_save_part(part, path, emu_save_part_done, &done));
-
+ mail_msg_wait(mail_save_part(part, path, emu_save_part_done, &done, TRUE));
+
if (!done) {
/* mail_save_part should popup an error box automagically */
g_free(path);
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index 119c203571..23dc550e0a 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -2083,6 +2083,7 @@ struct _save_part_msg {
char *path;
void (*done)(CamelMimePart *part, char *path, int saved, void *data);
void *data;
+ gboolean readonly;
};
static char *save_part_desc(struct _mail_msg *mm, int done)
@@ -2097,7 +2098,14 @@ save_part_save (struct _mail_msg *mm)
CamelDataWrapper *content;
CamelStream *stream;
- if (!(stream = camel_stream_fs_new_with_name (m->path, O_WRONLY | O_CREAT | O_TRUNC, 0666))) {
+ if(!m->readonly){
+ if (!(stream = camel_stream_fs_new_with_name (m->path, O_WRONLY | O_CREAT | O_TRUNC, 0666))) {
+ camel_exception_setv (&mm->ex, CAMEL_EXCEPTION_SYSTEM,
+ _("Cannot create output file: %s:\n %s"),
+ m->path, g_strerror (errno));
+ return;
+ }
+ } else if (!(stream = camel_stream_fs_new_with_name (m->path, O_WRONLY | O_CREAT | O_TRUNC, 0444))) {
camel_exception_setv (&mm->ex, CAMEL_EXCEPTION_SYSTEM,
_("Cannot create output file: %s:\n %s"),
m->path, g_strerror (errno));
@@ -2128,7 +2136,6 @@ static void
save_part_free (struct _mail_msg *mm)
{
struct _save_part_msg *m = (struct _save_part_msg *)mm;
-
camel_object_unref (m->part);
g_free (m->path);
}
@@ -2142,17 +2149,17 @@ static struct _mail_msg_op save_part_op = {
int
mail_save_part (CamelMimePart *part, const char *path,
- void (*done)(CamelMimePart *part, char *path, int saved, void *data), void *data)
+ void (*done)(CamelMimePart *part, char *path, int saved, void *data), void *data, gboolean readonly)
{
struct _save_part_msg *m;
int id;
-
m = mail_msg_new (&save_part_op, NULL, sizeof (*m));
m->part = part;
camel_object_ref (part);
m->path = g_strdup (path);
m->data = data;
m->done = done;
+ m->readonly = readonly;
id = m->msg.seq;
e_thread_put (mail_thread_new, (EMsg *)m);
diff --git a/mail/mail-ops.h b/mail/mail-ops.h
index 075aa748c5..31ece7a527 100644
--- a/mail/mail-ops.h
+++ b/mail/mail-ops.h
@@ -123,7 +123,7 @@ int mail_save_messages (CamelFolder *folder, GPtrArray *uids, const char *path,
int mail_save_part (CamelMimePart *part, const char *path,
void (*done)(CamelMimePart *part, char *path, int saved, void *data),
- void *data);
+ void *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 char *destination,