[evolution] Construct attachment bars for correct message part ids



commit 9a6f182c0d598d84f6c5b2f3c7725729931655f5
Author: Milan Crha <mcrha redhat com>
Date:   Fri Mar 4 13:56:49 2011 +0100

    Construct attachment bars for correct message part ids

 mail/em-format-html-display.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c
index 85aba9d..9d4ff55 100644
--- a/mail/em-format-html-display.c
+++ b/mail/em-format-html-display.c
@@ -992,12 +992,15 @@ efhd_add_bar (EMFormatHTML *efh,
 	if (!EM_IS_FORMAT_HTML_DISPLAY (efh))
 		return FALSE;
 
+	g_return_val_if_fail (pobject != NULL && pobject->classid != NULL, FALSE);
+	g_return_val_if_fail (g_str_has_prefix (pobject->classid, "attachment-bar:"), FALSE);
+
 	priv = EM_FORMAT_HTML_DISPLAY (efh)->priv;
 
 	widget = e_mail_attachment_bar_new ();
 	gtk_container_add (GTK_CONTAINER (eb), widget);
 
-	g_hash_table_insert (priv->attachment_views, g_strdup (EM_FORMAT (efh)->current_message_part_id), widget);
+	g_hash_table_insert (priv->attachment_views, g_strdup (strchr (pobject->classid, ':') + 1), widget);
 	g_object_weak_ref (G_OBJECT (widget), efhd_attachment_view_gone_cb, efh);
 	gtk_widget_hide (widget);
 
@@ -1014,7 +1017,9 @@ efhd_message_add_bar (EMFormat *emf,
                       CamelMimePart *part,
                       const EMFormatHandler *info)
 {
-	const gchar *classid = "attachment-bar";
+	gchar *classid;
+
+	classid = g_strdup_printf ("attachment-bar:%s", emf->current_message_part_id);
 
 	/* XXX Apparently this installs the callback for -all-
 	 *     EMFormatHTML subclasses, not just this subclass.
@@ -1027,6 +1032,8 @@ efhd_message_add_bar (EMFormat *emf,
 
 	camel_stream_printf (
 		stream, "<td><object classid=\"%s\"></object></td>", classid);
+
+	g_free (classid);
 }
 
 static void



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