evolution r35734 - in trunk/calendar: . gui



Author: mcrha
Date: Wed Jul  9 08:02:01 2008
New Revision: 35734
URL: http://svn.gnome.org/viewvc/evolution?rev=35734&view=rev

Log:
2008-07-09  Milan Crha  <mcrha redhat com>

	** Fix for bug #524130

	* gui/e-cal-component-preview.c: (write_html):
	* gui/e-cal-component-memo-preview.c: (write_html): Pass description
	text through 'camel_text_to_html' to have links clickable in a preview.



Modified:
   trunk/calendar/ChangeLog
   trunk/calendar/gui/e-cal-component-memo-preview.c
   trunk/calendar/gui/e-cal-component-preview.c

Modified: trunk/calendar/gui/e-cal-component-memo-preview.c
==============================================================================
--- trunk/calendar/gui/e-cal-component-memo-preview.c	(original)
+++ trunk/calendar/gui/e-cal-component-memo-preview.c	Wed Jul  9 08:02:01 2008
@@ -40,6 +40,7 @@
 #include "calendar-config.h"
 #include "e-cal-component-memo-preview.h"
 #include "e-cal-component-preview.h"
+#include <camel/camel-mime-filter-tohtml.h>
 
 struct _ECalComponentMemoPreviewPrivate {
 	GtkWidget *html;
@@ -201,27 +202,15 @@
 		gtk_html_stream_printf (stream, "<TD><PRE>");
 
 		for (node = l; node != NULL; node = node->next) {
-			gint i, j, len;
-			GString *string;
+			char *html;
 
 			text = * (ECalComponentText *) node->data;
-			len = (text.value ? strlen (text.value) : 0);
-			string = g_string_sized_new (len + 1);
+			html = camel_text_to_html (text.value ? text.value : "", CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS | CAMEL_MIME_FILTER_TOHTML_CONVERT_ADDRESSES, 0);
 
-			for (i = 0, j=0; i < len; i++, j++) {
-				if (text.value[i] == '\n'){
-					string = g_string_append_len (string, "<BR>", 4);
-				}
-				else if (text.value[i] == '<')
-					string = g_string_append_len (string, "&lt;", 4);
-				else if (text.value[i] == '>')
-					string = g_string_append_len (string, "&gt;", 4);
-				else
-					string = g_string_append_c (string, text.value[i]);
-			}
+			if (html)
+				gtk_html_stream_printf (stream, "%s", html);
 
-			gtk_html_stream_printf (stream,"%s",  string->str);
-			g_string_free (string, TRUE);
+			g_free (html);
 		}
 
 		gtk_html_stream_printf (stream, "</PRE></TD></TR>");

Modified: trunk/calendar/gui/e-cal-component-preview.c
==============================================================================
--- trunk/calendar/gui/e-cal-component-preview.c	(original)
+++ trunk/calendar/gui/e-cal-component-preview.c	Wed Jul  9 08:02:01 2008
@@ -39,6 +39,7 @@
 #include <e-util/e-categories-config.h>
 #include "calendar-config.h"
 #include "e-cal-component-preview.h"
+#include <camel/camel-mime-filter-tohtml.h>
 
 struct _ECalComponentPreviewPrivate {
 	GtkWidget *html;
@@ -292,24 +293,15 @@
 		gtk_html_stream_printf (stream, "<TD><PRE>");
 
 		for (node = l; node != NULL; node = node->next) {
-			gint i, len;
-			GString *string = g_string_new (NULL);;
+			char *html;
 
 			text = * (ECalComponentText *) node->data;
-			len =  text.value ? strlen (text.value) : 0;
-			for (i = 0; i <len ; i++) {
-				if (text.value[i] == '\n')
-					string = g_string_append_len (string, "<BR>", 4);
-				else if (text.value[i] == '<')
-					string = g_string_append_len (string, "&lt;", 4);
-				else if (text.value[i] == '>')
-					string = g_string_append_len (string, "&gt;", 4);
-				else
-					string = g_string_append_c (string, text.value[i]);
-			}
+			html = camel_text_to_html (text.value ? text.value : "", CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS | CAMEL_MIME_FILTER_TOHTML_CONVERT_ADDRESSES, 0);
+
+			if (html)
+				gtk_html_stream_printf (stream, "%s", html);
 
-			gtk_html_stream_printf (stream, "%s", string->str);
-			g_string_free (string, TRUE);
+			g_free (html);
 		}
 
 		gtk_html_stream_printf (stream, "</PRE></TD></TR>");



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