From e44e7a1bbd75a4b24dd55c26f44b53859b0e29a2 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Wed, 9 Jul 2008 08:02:01 +0000 Subject: ** Fix for bug #524130 2008-07-09 Milan Crha ** 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. svn path=/trunk/; revision=35734 --- calendar/ChangeLog | 8 ++++++++ calendar/gui/e-cal-component-memo-preview.c | 23 ++++++----------------- calendar/gui/e-cal-component-preview.c | 22 +++++++--------------- 3 files changed, 21 insertions(+), 32 deletions(-) (limited to 'calendar') diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 82dc32ab48..b763d3fb21 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,11 @@ +2008-07-09 Milan Crha + + ** 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. + 2008-07-04 Milan Crha ** Fix for bug #368038 diff --git a/calendar/gui/e-cal-component-memo-preview.c b/calendar/gui/e-cal-component-memo-preview.c index 27761983c5..5f65001d25 100644 --- a/calendar/gui/e-cal-component-memo-preview.c +++ b/calendar/gui/e-cal-component-memo-preview.c @@ -40,6 +40,7 @@ #include "calendar-config.h" #include "e-cal-component-memo-preview.h" #include "e-cal-component-preview.h" +#include struct _ECalComponentMemoPreviewPrivate { GtkWidget *html; @@ -201,27 +202,15 @@ write_html (GtkHTMLStream *stream, ECal *ecal, ECalComponent *comp, icaltimezone gtk_html_stream_printf (stream, "
");
 
 		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, "
", 4); - } - else if (text.value[i] == '<') - string = g_string_append_len (string, "<", 4); - else if (text.value[i] == '>') - string = g_string_append_len (string, ">", 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, "
"); diff --git a/calendar/gui/e-cal-component-preview.c b/calendar/gui/e-cal-component-preview.c index 899ee901d2..05b84bef30 100644 --- a/calendar/gui/e-cal-component-preview.c +++ b/calendar/gui/e-cal-component-preview.c @@ -39,6 +39,7 @@ #include #include "calendar-config.h" #include "e-cal-component-preview.h" +#include struct _ECalComponentPreviewPrivate { GtkWidget *html; @@ -292,24 +293,15 @@ write_html (GtkHTMLStream *stream, ECal *ecal, ECalComponent *comp, icaltimezone gtk_html_stream_printf (stream, "
");
 
 		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 ", 4);
-				else if (text.value[i] == '<')
-					string = g_string_append_len (string, "<", 4);
-				else if (text.value[i] == '>')
-					string = g_string_append_len (string, ">", 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, "
"); -- cgit