[evolution/kill-bonobo] Fix a couple more attachment issues.



commit c2119e513bc7482fc0150287af8502a5ff67191a
Author: Matthew Barnes <mbarnes redhat com>
Date:   Fri Apr 24 10:58:35 2009 -0400

    Fix a couple more attachment issues.
    
    Propagate attachment property changes to the CamelMimePart and emit a
    "notify::file-info" signal to refresh the row in the attachment model.
    Also, only fall back to showing the attachment's file name if its
    description is -empty- (not just NULL).
---
 widgets/misc/e-attachment-dialog.c |   14 ++++++++++++++
 widgets/misc/e-attachment.c        |    3 ++-
 2 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/widgets/misc/e-attachment-dialog.c b/widgets/misc/e-attachment-dialog.c
index dd39a25..e8c599a 100644
--- a/widgets/misc/e-attachment-dialog.c
+++ b/widgets/misc/e-attachment-dialog.c
@@ -212,6 +212,7 @@ attachment_dialog_response (GtkDialog *dialog,
 	EAttachment *attachment;
 	GtkToggleButton *button;
 	GFileInfo *file_info;
+	CamelMimePart *mime_part;
 	const gchar *attribute;
 	const gchar *text;
 	gboolean active;
@@ -226,18 +227,31 @@ attachment_dialog_response (GtkDialog *dialog,
 	file_info = e_attachment_get_file_info (attachment);
 	g_return_if_fail (G_IS_FILE_INFO (file_info));
 
+	mime_part = e_attachment_get_mime_part (attachment);
+
 	attribute = G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME;
 	text = gtk_entry_get_text (GTK_ENTRY (priv->display_name_entry));
 	g_file_info_set_attribute_string (file_info, attribute, text);
 
+	if (mime_part != NULL)
+		camel_mime_part_set_filename (mime_part, text);
+
 	attribute = G_FILE_ATTRIBUTE_STANDARD_DESCRIPTION;
 	text = gtk_entry_get_text (GTK_ENTRY (priv->description_entry));
 	g_file_info_set_attribute_string (file_info, attribute, text);
 
+	if (mime_part != NULL)
+		camel_mime_part_set_description (mime_part, text);
+
 	button = GTK_TOGGLE_BUTTON (priv->disposition_checkbox);
 	active = gtk_toggle_button_get_active (button);
 	text = active ? "inline" : "attachment";
 	e_attachment_set_disposition (attachment, text);
+
+	if (mime_part != NULL)
+		camel_mime_part_set_disposition (mime_part, text);
+
+	g_object_notify (G_OBJECT (attachment), "file-info");
 }
 
 static void
diff --git a/widgets/misc/e-attachment.c b/widgets/misc/e-attachment.c
index ee5446e..537a347 100644
--- a/widgets/misc/e-attachment.c
+++ b/widgets/misc/e-attachment.c
@@ -168,7 +168,8 @@ attachment_update_file_info_columns (EAttachment *attachment)
 	display_size = g_format_size_for_display (size);
 
 	description = e_attachment_get_description (attachment);
-	description = (description != NULL) ? description : display_name;
+	if (description == NULL || *description == '\0')
+		description = display_name;
 
 	if (size > 0)
 		caption = g_strdup_printf (



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]