[evolution-patches] (Mailer) Fix for bug 312545
- From: Srinivasa Ragavan <sragavan novell com>
- To: Evolution Patches List <evolution-patches lists ximian com>
- Subject: [evolution-patches] (Mailer) Fix for bug 312545
- Date: Fri, 05 Aug 2005 11:53:21 +0530
Hi,
This basically uses the existing file_name variable of EAttachment
structure and sets the file name to that instead to the part. While
showing the file name it uses DESC / file_name / mime filename.
This fixes the specified bug.
Thanks
Srini.
Index: em-format-html-display.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-format-html-display.c,v
retrieving revision 1.71
diff -u -p -r1.71 em-format-html-display.c
--- em-format-html-display.c 5 Aug 2005 05:59:50 -0000 1.71
+++ em-format-html-display.c 5 Aug 2005 06:07:32 -0000
@@ -1436,7 +1436,7 @@ efhd_attachment_button(EMFormatHTML *efh
if (!file) {
file = "attachment.dat";
- camel_mime_part_set_filename(new->body, file);
+ new->file_name = g_strdup(file);
}
tmp = g_hash_table_lookup (efhd->priv->files, file);
@@ -1454,9 +1454,10 @@ efhd_attachment_button(EMFormatHTML *efh
g_free (tmp_file);
g_hash_table_insert (efhd->priv->files, g_strdup(file), GUINT_TO_POINTER(count));
- camel_mime_part_set_filename(new->body, new_file);
+ if (new->file_name)
+ g_free (new->file_name);
+ new->file_name = new_file;
- g_free(new_file);
} else {
g_hash_table_insert (efhd->priv->files, g_strdup(file), GUINT_TO_POINTER(1));
}
Index: e-attachment-bar.c
===================================================================
RCS file: /cvs/gnome/evolution/widgets/misc/e-attachment-bar.c,v
retrieving revision 1.4
diff -u -p -r1.4 e-attachment-bar.c
--- e-attachment-bar.c 29 Jul 2005 04:39:25 -0000 1.4
+++ e-attachment-bar.c 5 Aug 2005 06:07:45 -0000
@@ -329,8 +329,12 @@ update (EAttachmentBar *bar)
}
desc = camel_mime_part_get_description (attachment->body);
- if (!desc || *desc == '\0')
- desc = camel_mime_part_get_filename (attachment->body);
+ if (!desc || *desc == '\0') {
+ if (attachment->file_name)
+ desc = attachment->file_name;
+ else
+ desc = camel_mime_part_get_filename (attachment->body);
+ }
if (!desc)
desc = _("attachment");
Index: e-attachment.c
===================================================================
RCS file: /cvs/gnome/evolution/widgets/misc/e-attachment.c,v
retrieving revision 1.3
diff -u -p -r1.3 e-attachment.c
--- e-attachment.c 29 Jul 2005 04:05:17 -0000 1.3
+++ e-attachment.c 5 Aug 2005 06:07:45 -0000
@@ -74,12 +74,13 @@ finalise(GObject *object)
} else {
if (attachment->handle)
gnome_vfs_async_cancel(attachment->handle);
- if (attachment->file_name)
- g_free (attachment->file_name);
if (attachment->description)
g_free (attachment->description);
}
+ if (attachment->file_name)
+ g_free (attachment->file_name);
+
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@@ -264,7 +265,6 @@ e_attachment_new (const char *file_name,
camel_mime_part_set_disposition (part, disposition);
filename = g_path_get_basename (file_name);
camel_mime_part_set_filename (part, filename);
- g_free (filename);
#if 0
/* Note: Outlook 2002 is broken with respect to Content-Ids on
@@ -284,6 +284,7 @@ e_attachment_new (const char *file_name,
new->guessed_type = TRUE;
new->handle = NULL;
new->is_available_local = TRUE;
+ new->file_name = filename;
uri = g_strdup_printf("file://%s\r\n", file_name);
g_object_set_data_full((GObject *)new, "e-drag-uri", uri, g_free);
@@ -487,7 +488,7 @@ e_attachment_build_remote_file (const ch
attachment->guessed_type = TRUE;
if (attachment->file_name) {
g_free (attachment->file_name);
- attachment->file_name = NULL;
+ attachment->file_name = g_strdup (filename);
}
uri = g_strdup_printf("file://%s\r\n", file_name);
g_object_set_data_full((GObject *)attachment, "e-drag-uri", uri, g_free);
@@ -515,6 +516,7 @@ e_attachment_new_from_mime_part (CamelMi
new->guessed_type = FALSE;
new->is_available_local = TRUE;
new->size = 0;
+ new->file_name = g_strdup (camel_mime_part_get_filename(part));
return new;
}
@@ -596,6 +598,9 @@ ok_cb (GtkWidget *widget, gpointer data)
str = gtk_entry_get_text (dialog_data->file_name_entry);
if (attachment->is_available_local) {
camel_mime_part_set_filename (attachment->body, str);
+ if (attachment->file_name)
+ g_free (attachment->file_name);
+ attachment->file_name = g_strdup (str);
} else {
if (attachment->file_name)
g_free (attachment->file_name);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]