[evolution-patches] 314440, attachment content not being displayed



The code which checks if the content being sent to a gtkhml can be
grokked by it was checking the wrong object.  This should fix it.

http://bugzilla.gnome.org/show_bug.cgi?id=314440

-- 
adfa(evolution-2.4:20087): gtkhtml-WARNING **: cannot find icon:
'stock_insert-url' in gnome 
Index: mail/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.3703
diff -u -p -r1.3703 ChangeLog
--- mail/ChangeLog	24 Aug 2005 04:22:55 -0000	1.3703
+++ mail/ChangeLog	25 Aug 2005 04:30:31 -0000
@@ -1,3 +1,15 @@
+2005-08-25  Not Zed  <NotZed Ximian com>
+
+	** See bug #314440.
+
+	* em-format-html.c (efh_url_requested): check the content object's
+	mime type, not the container, when seeing if the data should be
+	written.
+	(efh_write_text_html): add some debug.
+
+	* em-format-html-display.c (efhd_html_button_press_event): fix
+	debug.
+
 2005-08-22  Srinivasa Ragavan <sragavan novell com>
 
 	* em-format-html-display.c (efhd_bar_resize): Dont call update.
Index: mail/em-format-html-display.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-format-html-display.c,v
retrieving revision 1.77
diff -u -p -r1.77 em-format-html-display.c
--- mail/em-format-html-display.c	24 Aug 2005 04:22:55 -0000	1.77
+++ mail/em-format-html-display.c	25 Aug 2005 04:30:32 -0000
@@ -613,26 +613,25 @@ efhd_iframe_created(GtkHTML *html, GtkHT
 static int
 efhd_html_button_press_event (GtkWidget *widget, GdkEventButton *event, EMFormatHTMLDisplay *efhd)
 {
-	char *url;
+	char *uri;
 	gboolean res = FALSE;
 	EMFormatPURI *puri = NULL;
 
 	if (event->button != 3)
 		return FALSE;
 
-	url = gtk_html_get_url_at (GTK_HTML (widget), event->x, event->y);
+	uri = gtk_html_get_url_at (GTK_HTML (widget), event->x, event->y);
 
 	d(printf("popup button pressed\n"));
 
-	if (url) {
-		puri = em_format_find_puri((EMFormat *)efhd, url);
-
+	if (uri) {
+		puri = em_format_find_puri((EMFormat *)efhd, uri);
 		d(printf("poup event, uri = '%s' part = '%p'\n", uri, puri?puri->part:NULL));
 	}
 
-	g_signal_emit((GtkObject *)efhd, efhd_signals[EFHD_POPUP_EVENT], 0, event, url, puri?puri->part:NULL, &res);
+	g_signal_emit((GtkObject *)efhd, efhd_signals[EFHD_POPUP_EVENT], 0, event, uri, puri?puri->part:NULL, &res);
 
-	g_free(url);
+	g_free(uri);
 
 	return res;
 }
Index: mail/em-format-html.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-format-html.c,v
retrieving revision 1.82
diff -u -p -r1.82 em-format-html.c
--- mail/em-format-html.c	19 Aug 2005 05:38:22 -0000	1.82
+++ mail/em-format-html.c	25 Aug 2005 04:30:32 -0000
@@ -529,7 +529,8 @@ efh_url_requested(GtkHTML *html, const c
 
 	puri = em_format_find_visible_puri((EMFormat *)efh, url);
 	if (puri) {
-		CamelContentType *ct = ((CamelDataWrapper *)puri->part)->mime_type;
+		CamelDataWrapper *dw = camel_medium_get_content_object((CamelMedium *)puri->part);
+		CamelContentType *ct = dw?dw->mime_type:NULL;
 
 		/* GtkHTML only handles text and images.
 		   application/octet-stream parts are the only ones
@@ -546,6 +547,7 @@ efh_url_requested(GtkHTML *html, const c
 			d(printf(" adding puri job\n"));
 			job = em_format_html_job_new(efh, emfh_getpuri, puri);
 		} else {
+			d(printf(" part is unknown type '%s', not using\n", ct?camel_content_type_format(ct):"<unset>"));
 			gtk_html_stream_close(handle, GTK_HTML_STREAM_ERROR);
 		}
 	} else if (g_ascii_strncasecmp(url, "http:", 5) == 0 || g_ascii_strncasecmp(url, "https:", 6) == 0) {
@@ -793,6 +795,19 @@ efh_text_enriched(EMFormatHTML *efh, Cam
 static void
 efh_write_text_html(EMFormat *emf, CamelStream *stream, EMFormatPURI *puri)
 {
+#if d(!)0
+	CamelStream *out;
+	int fd;
+	CamelDataWrapper *dw;
+
+	fd = dup(STDOUT_FILENO);
+	out = camel_stream_fs_new_with_fd(fd);
+	printf("writing text content to frame '%s'\n", puri->cid);
+	dw = camel_medium_get_content_object(puri->part);
+	if (dw)
+		camel_data_wrapper_write_to_stream(dw, out);
+	camel_object_unref(out);
+#endif
 	em_format_format_text(emf, stream, camel_medium_get_content_object((CamelMedium *)puri->part));
 }
 


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