[evolution/gnome-3-36] itip-formatter: Eventually linkify Location field
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/gnome-3-36] itip-formatter: Eventually linkify Location field
- Date: Tue, 21 Apr 2020 12:21:38 +0000 (UTC)
commit 97729bc2973fdaf96c285ce296610fc4bd5fb657
Author: Milan Crha <mcrha redhat com>
Date: Tue Apr 21 14:20:16 2020 +0200
itip-formatter: Eventually linkify Location field
In case the Location field contains a URL, it can be made
click-able in the invitation mail, to make it easier to access.
src/modules/itip-formatter/itip-view.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
---
diff --git a/src/modules/itip-formatter/itip-view.c b/src/modules/itip-formatter/itip-view.c
index 67aef5f019..21c3d44b75 100644
--- a/src/modules/itip-formatter/itip-view.c
+++ b/src/modules/itip-formatter/itip-view.c
@@ -646,6 +646,24 @@ set_journal_sender_text (ItipView *view)
return sender;
}
+static const gchar *
+htmlize_text (const gchar *id,
+ const gchar *text,
+ gchar **out_tmp)
+{
+ if (text && *text) {
+ if (g_strcmp0 (id, TABLE_ROW_LOCATION) == 0) {
+ *out_tmp = camel_text_to_html (text, CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS |
CAMEL_MIME_FILTER_TOHTML_CONVERT_ADDRESSES, 0);
+ } else {
+ *out_tmp = g_markup_escape_text (text, -1);
+ }
+
+ text = *out_tmp;
+ }
+
+ return text;
+}
+
static void
enable_button (ItipView *view,
const gchar *button_id,
@@ -735,10 +753,16 @@ set_area_text (ItipView *view,
web_view = itip_view_ref_web_view (view);
if (web_view) {
+ gchar *tmp = NULL;
+
+ text = htmlize_text (id, text, &tmp);
+
e_web_view_jsc_run_script (WEBKIT_WEB_VIEW (web_view), e_web_view_get_cancellable (web_view),
"EvoItip.SetAreaText(%s, %s, %s);",
view->priv->part_id, id, text);
+
g_object_unref (web_view);
+ g_free (tmp);
}
}
@@ -1019,6 +1043,10 @@ append_text_table_row (GString *buffer,
const gchar *label,
const gchar *value)
{
+ gchar *tmp = NULL;
+
+ value = htmlize_text (id, value, &tmp);
+
if (label && *label) {
g_string_append_printf (
@@ -1036,6 +1064,8 @@ append_text_table_row (GString *buffer,
id, g_strcmp0 (id, TABLE_ROW_SUMMARY) == 0 ? "" : " hidden=\"\"", value ? value : "");
}
+
+ g_free (tmp);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]