evolution r35391 - in branches/gnome-2-22: mail widgets/misc



Author: sragavan
Date: Mon Apr 21 05:06:46 2008
New Revision: 35391
URL: http://svn.gnome.org/viewvc/evolution?rev=35391&view=rev

Log:
2008-04-20  Srinivasa Ragavan  <sragavan novell com>

	** Fix for bug #334444

	* em-format-html-display.c: (efhd_attachment_button),
	(efhd_update_bar), (efhd_message_update_bar),
	(efhd_message_add_bar): Add the attachments and draw the bar.
	* em-format-html.c: (efh_format_exec):
2008-04-20  Srinivasa Ragavan  <sragavan novell com>
	
	** Fix for bug #334444

	* e-attachment-bar.c: (e_attachment_bar_add_attachment_silent),
	(e_attachment_bar_refresh):
	* e-attachment-bar.h:




Modified:
   branches/gnome-2-22/mail/ChangeLog
   branches/gnome-2-22/mail/em-format-html-display.c
   branches/gnome-2-22/mail/em-format-html.c
   branches/gnome-2-22/widgets/misc/ChangeLog
   branches/gnome-2-22/widgets/misc/e-attachment-bar.c
   branches/gnome-2-22/widgets/misc/e-attachment-bar.h

Modified: branches/gnome-2-22/mail/em-format-html-display.c
==============================================================================
--- branches/gnome-2-22/mail/em-format-html-display.c	(original)
+++ branches/gnome-2-22/mail/em-format-html-display.c	Mon Apr 21 05:06:46 2008
@@ -148,6 +148,7 @@
 	GtkWidget *attachment_area;
 	gboolean  show_bar;
 	GHashTable *files;
+	gboolean updated;
 };
 
 static int efhd_html_button_press_event (GtkWidget *widget, GdkEventButton *event, EMFormatHTMLDisplay *efh);
@@ -157,6 +158,7 @@
 static void efhd_attachment_frame(EMFormat *emf, CamelStream *stream, EMFormatPURI *puri);
 static gboolean efhd_attachment_image(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject *pobject);
 static void efhd_message_add_bar(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const EMFormatHandler *info);
+static void efhd_message_update_bar(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const EMFormatHandler *info);
 static void efhd_attachment_bar_refresh (EMFormatHTMLDisplay *efhd);
 
 struct _attach_puri {
@@ -1327,6 +1329,8 @@
 
 	{ "x-evolution/message/prefix", (EMFormatFunc)efhd_message_prefix },
 	{ "x-evolution/message/post-header", (EMFormatFunc)efhd_message_add_bar },
+	{ "x-evolution/message/post-header-closure", (EMFormatFunc)efhd_message_update_bar },
+
 };
 
 static void
@@ -1879,7 +1883,7 @@
 		new->encrypt = info->encrypt;
 
 		/* Add the attachment to the bar.*/
-		e_attachment_bar_add_attachment(E_ATTACHMENT_BAR(efhd->priv->attachment_bar), new);
+		e_attachment_bar_add_attachment_silent (E_ATTACHMENT_BAR(efhd->priv->attachment_bar), new);
 		efhd_attachment_bar_refresh(efhd);
 	}
 
@@ -2352,6 +2356,16 @@
 }
 
 static gboolean
+efhd_update_bar(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject *pobject)
+{
+	EMFormatHTMLDisplay *efhd = (EMFormatHTMLDisplay *)efh;
+	struct _EMFormatHTMLDisplayPrivate *priv = efhd->priv;
+
+	e_attachment_bar_refresh (priv->attachment_bar);
+
+	return TRUE;
+}
+static gboolean
 efhd_add_bar(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject *pobject)
 {
 	EMFormatHTMLDisplay *efhd = (EMFormatHTMLDisplay *)efh;
@@ -2423,6 +2437,21 @@
 
 	return TRUE;
 }
+static void
+efhd_message_update_bar(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const EMFormatHandler *info)
+{
+	EMFormatHTMLDisplay *efhd = (EMFormatHTMLDisplay *) emf;
+	const char *classid = "attachment-bar-refresh";
+
+	if (efhd->nobar || efhd->priv->updated )
+		return;
+
+	efhd->priv->files = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+	efhd->priv->updated = TRUE;
+	em_format_html_add_pobject((EMFormatHTML *)emf, sizeof(EMFormatHTMLPObject), classid, part, efhd_update_bar);
+	camel_stream_printf(stream, "<td><object classid=\"%s\"></object></td>", classid);
+
+}
 
 static void
 efhd_message_add_bar(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const EMFormatHandler *info)
@@ -2434,6 +2463,7 @@
 		return;
 
 	efhd->priv->files = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+	efhd->priv->updated = FALSE;
 
 	em_format_html_add_pobject((EMFormatHTML *)emf, sizeof(EMFormatHTMLPObject), classid, part, efhd_add_bar);
 	camel_stream_printf(stream, "<td><object classid=\"%s\"></object></td>", classid);

Modified: branches/gnome-2-22/mail/em-format-html.c
==============================================================================
--- branches/gnome-2-22/mail/em-format-html.c	(original)
+++ branches/gnome-2-22/mail/em-format-html.c	Mon Apr 21 05:06:46 2008
@@ -1258,6 +1258,10 @@
 		handle = em_format_find_handler((EMFormat *)m->format, "x-evolution/message/rfc822");
 		if (handle)
 			handle->handler((EMFormat *)m->format, (CamelStream *)m->estream, (CamelMimePart *)m->message, handle);
+		handle = em_format_find_handler((EMFormat *)m->format, "x-evolution/message/post-header-closure");
+		if (handle)
+			handle->handler((EMFormat *)m->format, (CamelStream *)m->estream, (CamelMimePart *)m->message, handle);
+
 	}
 
 	camel_stream_flush((CamelStream *)m->estream);

Modified: branches/gnome-2-22/widgets/misc/e-attachment-bar.c
==============================================================================
--- branches/gnome-2-22/widgets/misc/e-attachment-bar.c	(original)
+++ branches/gnome-2-22/widgets/misc/e-attachment-bar.c	Mon Apr 21 05:06:46 2008
@@ -1177,6 +1177,27 @@
 	add_common (bar, attachment);
 }
 
+void
+e_attachment_bar_add_attachment_silent (EAttachmentBar *bar, EAttachment *attachment)
+{
+	g_return_if_fail (E_IS_ATTACHMENT_BAR (bar));
+	g_return_if_fail (attachment != NULL);
+
+	g_ptr_array_add (bar->priv->attachments, attachment);
+	g_object_weak_ref ((GObject *) attachment, (GWeakNotify) attachment_destroy, bar);
+	g_signal_connect (attachment, "changed", G_CALLBACK (attachment_changed_cb), bar);
+
+
+	g_signal_emit (bar, signals[CHANGED], 0);
+}
+
+void
+e_attachment_bar_refresh (EAttachmentBar *bar)
+{
+	update (bar);
+
+}
+
 int
 e_attachment_bar_get_download_count (EAttachmentBar *bar)
 {

Modified: branches/gnome-2-22/widgets/misc/e-attachment-bar.h
==============================================================================
--- branches/gnome-2-22/widgets/misc/e-attachment-bar.h	(original)
+++ branches/gnome-2-22/widgets/misc/e-attachment-bar.h	Mon Apr 21 05:06:46 2008
@@ -83,6 +83,8 @@
 void e_attachment_bar_set_width(EAttachmentBar *bar, int bar_width);
 GSList * e_attachment_bar_get_all_attachments (EAttachmentBar *bar);
 void e_attachment_bar_create_attachment_cache (EAttachment *attachment);
+void e_attachment_bar_add_attachment_silent (EAttachmentBar *bar, EAttachment *attachment);
+void e_attachment_bar_refresh (EAttachmentBar *bar);
 
 #ifdef __cplusplus
 }



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