aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorSrinivasa Ragavan <sragavan@novell.com>2005-08-16 11:47:55 +0800
committerSrinivasa Ragavan <sragavan@src.gnome.org>2005-08-16 11:47:55 +0800
commiteb491088f8aabcc369f09fd95c46a5794c575d6f (patch)
tree88e9981291487703a9915644d07dcb7bfba95669 /widgets
parente77ae6c0f59b94265a3487eacea32abb1c312ab0 (diff)
downloadgsoc2013-evolution-eb491088f8aabcc369f09fd95c46a5794c575d6f.tar
gsoc2013-evolution-eb491088f8aabcc369f09fd95c46a5794c575d6f.tar.gz
gsoc2013-evolution-eb491088f8aabcc369f09fd95c46a5794c575d6f.tar.bz2
gsoc2013-evolution-eb491088f8aabcc369f09fd95c46a5794c575d6f.tar.lz
gsoc2013-evolution-eb491088f8aabcc369f09fd95c46a5794c575d6f.tar.xz
gsoc2013-evolution-eb491088f8aabcc369f09fd95c46a5794c575d6f.tar.zst
gsoc2013-evolution-eb491088f8aabcc369f09fd95c46a5794c575d6f.zip
Fix for bug #312545
2005-08-16 Srinivasa Ragavan <sragavan@novell.com> * mail/em-format-html-display.c: * widgets/misc/e-attachment*.c: Fix for bug #312545 svn path=/trunk/; revision=30126
Diffstat (limited to 'widgets')
-rw-r--r--widgets/misc/ChangeLog8
-rw-r--r--widgets/misc/e-attachment-bar.c8
-rw-r--r--widgets/misc/e-attachment.c28
3 files changed, 25 insertions, 19 deletions
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);
}