aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mail/ChangeLog5
-rw-r--r--mail/em-format-html-display.c7
-rw-r--r--widgets/misc/ChangeLog8
-rw-r--r--widgets/misc/e-attachment-bar.c8
-rw-r--r--widgets/misc/e-attachment.c28
5 files changed, 33 insertions, 23 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 1210d6a781..c2010278f7 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,8 @@
+2005-08-16 Srinivasa Ragavan <sragavan@novell.com>
+
+ * em-format-html-display.c (efhd_attachment_button): Sets the filename
+ in the attachment structure instead of the part
+
2005-08-15 Christian Kellner <gicmo@gnome.org>
* mail-send-recv.c: (get_folders): Honour the check_all
diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c
index 6221294998..e0a309d90f 100644
--- a/mail/em-format-html-display.c
+++ b/mail/em-format-html-display.c
@@ -1436,7 +1436,7 @@ efhd_attachment_button(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObje
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,8 @@ efhd_attachment_button(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObje
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);
-
- g_free(new_file);
+ g_free (new->file_name);
+ new->file_name = new_file;
} else {
g_hash_table_insert (efhd->priv->files, g_strdup(file), GUINT_TO_POINTER(1));
}
diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog
index 44c79382d2..b98d79c8e3 100644
--- a/widgets/misc/ChangeLog
+++ b/widgets/misc/ChangeLog
@@ -1,3 +1,11 @@
+2005-08-16 Srinivasa Ragavan <sragavan@novell.com>
+
+ * e-attachment.c (finalise) (e_attachment_new) (e_attachment_build_remote_file)
+ (e_attachment_new_from_mime_part) (ok_cb): Maintain the filename of the
+ attachment in the structure and free it in finalize.
+ * e-attachment-bar.c (update): For display consider the filename from the
+ structure before from the part.
+
2005-08-03 Not Zed <NotZed@Ximian.com>
* e-filter-bar.c (build_items): revert dobey's last patch here, it
diff --git a/widgets/misc/e-attachment-bar.c b/widgets/misc/e-attachment-bar.c
index c268724759..76d84a7d8d 100644
--- a/widgets/misc/e-attachment-bar.c
+++ b/widgets/misc/e-attachment-bar.c
@@ -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");
diff --git a/widgets/misc/e-attachment.c b/widgets/misc/e-attachment.c
index 8dc2a089af..a5082cc6c2 100644
--- a/widgets/misc/e-attachment.c
+++ b/widgets/misc/e-attachment.c
@@ -74,12 +74,11 @@ 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);
+ g_free (attachment->description);
}
+ g_free (attachment->file_name);
+
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@@ -264,7 +263,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 +282,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);
@@ -485,10 +484,8 @@ e_attachment_build_remote_file (const char *file_name,
attachment->body = part;
attachment->size = statbuf.st_size;
attachment->guessed_type = TRUE;
- if (attachment->file_name) {
- g_free (attachment->file_name);
- attachment->file_name = NULL;
- }
+ g_free (attachment->file_name);
+ 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 +512,7 @@ e_attachment_new_from_mime_part (CamelMimePart *part)
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;
}
@@ -594,20 +592,16 @@ ok_cb (GtkWidget *widget, gpointer data)
attachment = dialog_data->attachment;
str = gtk_entry_get_text (dialog_data->file_name_entry);
- if (attachment->is_available_local) {
+ if (attachment->is_available_local)
camel_mime_part_set_filename (attachment->body, str);
- } else {
- if (attachment->file_name)
- g_free (attachment->file_name);
- attachment->file_name = g_strdup (str);
- }
+ g_free (attachment->file_name);
+ attachment->file_name = g_strdup (str);
str = gtk_entry_get_text (dialog_data->description_entry);
if (attachment->is_available_local) {
camel_mime_part_set_description (attachment->body, str);
} else {
- if (attachment->description)
- g_free (attachment->description);
+ g_free (attachment->description);
attachment->description = g_strdup (str);
}