[evolution] I#876 - Calendar: Display multi-lingual properties in current locale
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] I#876 - Calendar: Display multi-lingual properties in current locale
- Date: Wed, 8 Jun 2022 17:01:01 +0000 (UTC)
commit 2de495a0a3a0d3ce8584edd4f66413bf0fd428da
Author: Milan Crha <mcrha redhat com>
Date: Wed Jun 8 18:59:00 2022 +0200
I#876 - Calendar: Display multi-lingual properties in current locale
Closes https://gitlab.gnome.org/GNOME/evolution/-/issues/876
src/calendar/gui/comp-util.c | 8 ++-
src/calendar/gui/e-cal-component-preview.c | 83 ++++++++++++++--------
src/calendar/gui/e-cal-dialogs.c | 2 +-
src/calendar/gui/e-cal-model.c | 22 ++++--
src/calendar/gui/e-calendar-view.c | 6 +-
src/calendar/gui/e-day-view.c | 11 ++-
src/calendar/gui/e-to-do-pane.c | 6 +-
src/calendar/gui/e-year-view.c | 5 +-
src/calendar/gui/ea-cal-view-event.c | 6 +-
src/calendar/gui/itip-utils.c | 18 ++---
src/calendar/gui/print.c | 60 +++++++++++-----
src/calendar/importers/icalendar-importer.c | 30 +++++---
.../composer-to-meeting/e-meeting-to-composer.c | 6 +-
src/modules/itip-formatter/itip-view.c | 42 +++++++----
src/plugins/mail-to-task/mail-to-task.c | 8 ++-
15 files changed, 212 insertions(+), 101 deletions(-)
---
diff --git a/src/calendar/gui/comp-util.c b/src/calendar/gui/comp-util.c
index bee1120bf8..d0630d744e 100644
--- a/src/calendar/gui/comp-util.c
+++ b/src/calendar/gui/comp-util.c
@@ -888,7 +888,7 @@ comp_util_suggest_filename (ICalComponent *icomp,
if (!icomp)
return g_strconcat (default_name, ".ics", NULL);
- prop = i_cal_component_get_first_property (icomp, I_CAL_SUMMARY_PROPERTY);
+ prop = e_cal_util_component_find_property_for_locale (icomp, I_CAL_SUMMARY_PROPERTY, NULL);
if (prop)
summary = i_cal_property_get_summary (prop);
@@ -2204,6 +2204,7 @@ cal_comp_util_dup_tooltip (ECalComponent *comp,
ECalComponentOrganizer *organizer;
ECalComponentDateTime *dtstart, *dtend;
ICalComponent *icalcomp;
+ ICalProperty *prop;
ICalTimezone *zone;
GString *tooltip;
const gchar *description;
@@ -2385,7 +2386,8 @@ cal_comp_util_dup_tooltip (ECalComponent *comp,
g_clear_pointer (&tmp, g_free);
}
- description = i_cal_component_get_description (icalcomp);
+ prop = e_cal_util_component_find_property_for_locale (icalcomp, I_CAL_DESCRIPTION_PROPERTY, NULL);
+ description = prop ? i_cal_property_get_description (prop) : NULL;
if (description && *description && g_utf8_validate (description, -1, NULL) &&
!g_str_equal (description, "\r") &&
!g_str_equal (description, "\n") &&
@@ -2411,6 +2413,8 @@ cal_comp_util_dup_tooltip (ECalComponent *comp,
g_clear_pointer (&tmp, g_free);
}
+ g_clear_object (&prop);
+
return g_string_free (tooltip, FALSE);
}
diff --git a/src/calendar/gui/e-cal-component-preview.c b/src/calendar/gui/e-cal-component-preview.c
index 1b5ed7269f..8987abbe74 100644
--- a/src/calendar/gui/e-cal-component-preview.c
+++ b/src/calendar/gui/e-cal-component-preview.c
@@ -32,6 +32,7 @@
#include "calendar-config.h"
#include "comp-util.h"
+#include "e-calendar-view.h"
#include "itip-utils.h"
#include "e-cal-component-preview.h"
@@ -230,18 +231,18 @@ cal_component_preview_write_html (ECalComponentPreview *preview,
default_zone = preview->priv->timezone;
/* write document header */
- text = e_cal_component_get_summary (comp);
+ str = e_calendar_view_dup_component_summary (e_cal_component_get_icalcomponent (comp));
g_string_append (buffer, HTML_HEADER);
g_string_append (buffer, "<body class=\"-e-web-view-background-color -e-web-view-text-color
calpreview\">");
- markup = g_markup_escape_text (text && e_cal_component_text_get_value (text) ?
e_cal_component_text_get_value (text) : _("Untitled"), -1);
- if (text && e_cal_component_text_get_value (text))
+ markup = g_markup_escape_text (str ? str : _("Untitled"), -1);
+ if (str)
g_string_append_printf (buffer, "<h2>%s</h2>", markup);
else
g_string_append_printf (buffer, "<h2><i>%s</i></h2>", markup);
- e_cal_component_text_free (text);
g_free (markup);
+ g_free (str);
g_string_append (buffer, "<table border=\"0\" cellspacing=\"5\">");
@@ -538,42 +539,68 @@ cal_component_preview_write_html (ECalComponentPreview *preview,
/* Write description as the last, using full width */
- list = e_cal_component_get_descriptions (comp);
- if (list) {
- GSList *node;
- gboolean has_header = FALSE;
+ if (e_cal_component_get_vtype (comp) == E_CAL_COMPONENT_JOURNAL) {
+ list = e_cal_component_get_descriptions (comp);
+ if (list) {
+ GSList *node;
+ gboolean has_header = FALSE;
- for (node = list; node != NULL; node = node->next) {
- gchar *html;
+ for (node = list; node != NULL; node = node->next) {
+ gchar *html;
- text = node->data;
- if (!text || !e_cal_component_text_get_value (text))
- continue;
+ text = node->data;
+ if (!text || !e_cal_component_text_get_value (text))
+ continue;
+
+ html = camel_text_to_html (
+ e_cal_component_text_get_value (text),
+ CAMEL_MIME_FILTER_TOHTML_CONVERT_NL |
+ CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES |
+ CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS |
+ CAMEL_MIME_FILTER_TOHTML_CONVERT_ADDRESSES, 0);
- html = camel_text_to_html (
- e_cal_component_text_get_value (text),
- CAMEL_MIME_FILTER_TOHTML_CONVERT_NL |
- CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES |
- CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS |
- CAMEL_MIME_FILTER_TOHTML_CONVERT_ADDRESSES, 0);
+ if (html) {
+ if (!has_header) {
+ has_header = TRUE;
- if (html) {
- if (!has_header) {
- has_header = TRUE;
+ g_string_append (buffer, "<tr><td colspan=\"2\"
class=\"description\">");
+ }
- g_string_append (buffer, "<tr><td colspan=\"2\"
class=\"description\">");
+ g_string_append_printf (buffer, "%s", html);
}
- g_string_append_printf (buffer, "%s", html);
+ g_free (html);
}
- g_free (html);
+ if (has_header)
+ g_string_append (buffer, "</td></tr>");
+
+ g_slist_free_full (list, e_cal_component_text_free);
}
+ } else {
+ text = e_cal_component_dup_description_for_locale (comp, NULL);
+ if (text) {
+ if (e_cal_component_text_get_value (text)) {
+ gchar *html;
- if (has_header)
- g_string_append (buffer, "</td></tr>");
+ html = camel_text_to_html (
+ e_cal_component_text_get_value (text),
+ CAMEL_MIME_FILTER_TOHTML_CONVERT_NL |
+ CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES |
+ CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS |
+ CAMEL_MIME_FILTER_TOHTML_CONVERT_ADDRESSES, 0);
+
+ if (html) {
+ g_string_append (buffer, "<tr><td colspan=\"2\"
class=\"description\">");
+ g_string_append_printf (buffer, "%s", html);
+ g_string_append (buffer, "</td></tr>");
+ }
+
+ g_free (html);
+ }
- g_slist_free_full (list, e_cal_component_text_free);
+ e_cal_component_text_free (text);
+ }
}
g_string_append (buffer, "</table>");
diff --git a/src/calendar/gui/e-cal-dialogs.c b/src/calendar/gui/e-cal-dialogs.c
index 7df5b929bb..08a5f11f40 100644
--- a/src/calendar/gui/e-cal-dialogs.c
+++ b/src/calendar/gui/e-cal-dialogs.c
@@ -394,7 +394,7 @@ e_cal_dialogs_delete_component (ECalComponent *comp,
if (!consider_as_untitled) {
ECalComponentText *summary;
- summary = e_cal_component_get_summary (comp);
+ summary = e_cal_component_dup_summary_for_locale (comp, NULL);
if (summary) {
arg0 = g_strdup (e_cal_component_text_get_value (summary));
e_cal_component_text_free (summary);
diff --git a/src/calendar/gui/e-cal-model.c b/src/calendar/gui/e-cal-model.c
index c392cf3fdf..8389a62043 100644
--- a/src/calendar/gui/e-cal-model.c
+++ b/src/calendar/gui/e-cal-model.c
@@ -323,12 +323,20 @@ get_description (ECalModelComponent *comp_data)
ICalProperty *prop;
GString *str = NULL;
- for (prop = i_cal_component_get_first_property (comp_data->icalcomp, I_CAL_DESCRIPTION_PROPERTY);
- prop;
- g_object_unref (prop), prop = i_cal_component_get_next_property (comp_data->icalcomp,
I_CAL_DESCRIPTION_PROPERTY)) {
- if (!str)
- str = g_string_new (NULL);
- g_string_append (str, i_cal_property_get_description (prop));
+ if (i_cal_component_isa (comp_data->icalcomp) == I_CAL_VJOURNAL_COMPONENT) {
+ for (prop = i_cal_component_get_first_property (comp_data->icalcomp,
I_CAL_DESCRIPTION_PROPERTY);
+ prop;
+ g_object_unref (prop), prop = i_cal_component_get_next_property (comp_data->icalcomp,
I_CAL_DESCRIPTION_PROPERTY)) {
+ if (!str)
+ str = g_string_new (NULL);
+ g_string_append (str, i_cal_property_get_description (prop));
+ }
+ } else {
+ prop = e_cal_util_component_find_property_for_locale (comp_data->icalcomp,
I_CAL_DESCRIPTION_PROPERTY, NULL);
+ if (prop) {
+ str = g_string_new (i_cal_property_get_description (prop));
+ g_clear_object (&prop);
+ }
}
return str ? g_string_free (str, FALSE) : g_strdup ("");
@@ -391,7 +399,7 @@ get_summary (ECalModelComponent *comp_data)
ICalProperty *prop;
gchar *res = NULL;
- prop = i_cal_component_get_first_property (comp_data->icalcomp, I_CAL_SUMMARY_PROPERTY);
+ prop = e_cal_util_component_find_property_for_locale (comp_data->icalcomp, I_CAL_SUMMARY_PROPERTY,
NULL);
if (prop)
res = g_strdup (i_cal_property_get_summary (prop));
diff --git a/src/calendar/gui/e-calendar-view.c b/src/calendar/gui/e-calendar-view.c
index 529e6306b4..a30ed96534 100644
--- a/src/calendar/gui/e-calendar-view.c
+++ b/src/calendar/gui/e-calendar-view.c
@@ -1824,11 +1824,13 @@ gchar *
e_calendar_view_dup_component_summary (ICalComponent *icomp)
{
const gchar *summary;
+ ICalProperty *prop;
gchar *res = NULL;
g_return_val_if_fail (icomp != NULL, NULL);
- summary = i_cal_component_get_summary (icomp);
+ prop = e_cal_util_component_find_property_for_locale (icomp, I_CAL_SUMMARY_PROPERTY, NULL);
+ summary = prop ? i_cal_property_get_summary (prop) : NULL;
if (icomp_contains_category (icomp, _("Birthday")) ||
icomp_contains_category (icomp, _("Anniversary"))) {
@@ -1861,6 +1863,8 @@ e_calendar_view_dup_component_summary (ICalComponent *icomp)
if (!res)
res = g_strdup (summary ? summary : "");
+ g_clear_object (&prop);
+
e_cal_model_until_sanitize_text_value (res, -1);
return res;
diff --git a/src/calendar/gui/e-day-view.c b/src/calendar/gui/e-day-view.c
index d838a0ba38..3db9c16d6a 100644
--- a/src/calendar/gui/e-day-view.c
+++ b/src/calendar/gui/e-day-view.c
@@ -3483,6 +3483,7 @@ e_day_view_update_event_label (EDayView *day_view,
ESourceRegistry *registry;
ECalModel *model;
gboolean free_text = FALSE, editing_event = FALSE, short_event = FALSE;
+ ICalProperty *prop;
const gchar *summary;
gchar *text;
gint time_divisions;
@@ -3497,7 +3498,8 @@ e_day_view_update_event_label (EDayView *day_view,
if (!event->canvas_item || !is_comp_data_valid (event))
return;
- summary = i_cal_component_get_summary (event->comp_data->icalcomp);
+ prop = e_cal_util_component_find_property_for_locale (event->comp_data->icalcomp,
I_CAL_SUMMARY_PROPERTY, NULL);
+ summary = prop ? i_cal_property_get_summary (prop) : NULL;
text = summary ? (gchar *) summary : (gchar *) "";
if (day_view->editing_event_day == day
@@ -3524,11 +3526,13 @@ e_day_view_update_event_label (EDayView *day_view,
if (!editing_event) {
if (!short_event) {
+ ICalProperty *prop_description;
const gchar *description, *location;
gint days_shown;
days_shown = e_day_view_get_days_shown (day_view);
- description = i_cal_component_get_description (event->comp_data->icalcomp);
+ prop_description = e_cal_util_component_find_property_for_locale
(event->comp_data->icalcomp, I_CAL_DESCRIPTION_PROPERTY, NULL);
+ description = prop_description ? i_cal_property_get_description (prop_description) :
NULL;
location = i_cal_component_get_location (event->comp_data->icalcomp);
if (description && *description) {
@@ -3542,6 +3546,8 @@ e_day_view_update_event_label (EDayView *day_view,
text = g_strdup_printf (" \n%s", text);
free_text = TRUE;
+
+ g_clear_object (&prop_description);
}
}
@@ -3557,6 +3563,7 @@ e_day_view_update_event_label (EDayView *day_view,
if (free_text)
g_free (text);
+ g_clear_object (&prop);
}
static void
diff --git a/src/calendar/gui/e-to-do-pane.c b/src/calendar/gui/e-to-do-pane.c
index 5a71381e2f..47887e6161 100644
--- a/src/calendar/gui/e-to-do-pane.c
+++ b/src/calendar/gui/e-to-do-pane.c
@@ -348,6 +348,7 @@ etdp_get_component_data (EToDoPane *to_do_pane,
const gchar *prefix, *location, *description, *uid_str, *rid_str;
gboolean task_has_due_date = TRUE, is_cancelled = FALSE; /* ignored for events, thus like being set */
ICalPropertyStatus status;
+ ICalProperty *prop;
gchar *comp_summary;
GString *tooltip;
@@ -579,7 +580,8 @@ etdp_get_component_data (EToDoPane *to_do_pane,
e_cal_component_id_free (id);
- description = i_cal_component_get_description (icomp);
+ prop = e_cal_util_component_find_property_for_locale (icomp, I_CAL_DESCRIPTION_PROPERTY, NULL);
+ description = prop ? i_cal_property_get_description (prop) : NULL;
if (description && *description && g_utf8_validate (description, -1, NULL)) {
gchar *tmp = NULL;
glong len;
@@ -602,6 +604,8 @@ etdp_get_component_data (EToDoPane *to_do_pane,
g_free (tmp);
}
+ g_clear_object (&prop);
+
*out_date_mark = etdp_create_date_mark (itt);
*out_tooltip = g_string_free (tooltip, FALSE);
diff --git a/src/calendar/gui/e-year-view.c b/src/calendar/gui/e-year-view.c
index 5b076767fb..38b3faa43d 100644
--- a/src/calendar/gui/e-year-view.c
+++ b/src/calendar/gui/e-year-view.c
@@ -456,6 +456,7 @@ year_view_add_to_list_store (EYearView *self,
GtkTreeIter iter;
GdkRGBA bgcolor, fgcolor;
ICalTimezone *default_zone;
+ ICalProperty *prop;
gboolean bgcolor_set = FALSE, fgcolor_set = FALSE;
gchar *summary, *tooltip, *sort_key;
@@ -464,9 +465,11 @@ year_view_add_to_list_store (EYearView *self,
default_zone = e_cal_data_model_get_timezone (self->priv->data_model);
summary = cal_comp_util_describe (cd->comp, cd->client, default_zone, year_view_get_describe_flags
(self));
tooltip = cal_comp_util_dup_tooltip (cd->comp, cd->client, self->priv->registry, default_zone);
+ prop = e_cal_util_component_find_property_for_locale (e_cal_component_get_icalcomponent (cd->comp),
I_CAL_SUMMARY_PROPERTY, NULL);
sort_key = g_strdup_printf ("%08u%06u-%s-%s-%s", cd->date_mark, cd->time_mark,
- i_cal_component_get_summary (e_cal_component_get_icalcomponent (cd->comp)),
+ prop ? i_cal_property_get_summary (prop) : "",
cd->uid ? cd->uid : "", cd->rid ? cd->rid : "");
+ g_clear_object (&prop);
gtk_list_store_append (self->priv->list_store, &iter);
gtk_list_store_set (self->priv->list_store, &iter,
diff --git a/src/calendar/gui/ea-cal-view-event.c b/src/calendar/gui/ea-cal-view-event.c
index ce3cab3c9f..c2b026f448 100644
--- a/src/calendar/gui/ea-cal-view-event.c
+++ b/src/calendar/gui/ea-cal-view-event.c
@@ -225,6 +225,8 @@ ea_cal_view_event_get_name (AtkObject *accessible)
alarm_string = recur_string = meeting_string = "";
if (event && event->comp_data) {
+ ICalProperty *prop;
+
if (e_cal_util_component_has_alarms (event->comp_data->icalcomp))
alarm_string = _("It has reminders.");
@@ -234,9 +236,11 @@ ea_cal_view_event_get_name (AtkObject *accessible)
if (e_cal_util_component_has_organizer (event->comp_data->icalcomp))
meeting_string = _("It is a meeting.");
- summary = i_cal_component_get_summary (event->comp_data->icalcomp);
+ prop = e_cal_util_component_find_property_for_locale (event->comp_data->icalcomp,
I_CAL_SUMMARY_PROPERTY, NULL);
+ summary = prop ? i_cal_property_get_summary (prop) : NULL;
if (summary)
summary_string = g_strdup_printf (_("Calendar Event: Summary is %s."), summary);
+ g_clear_object (&prop);
}
if (!summary_string)
diff --git a/src/calendar/gui/itip-utils.c b/src/calendar/gui/itip-utils.c
index d110623eee..1a989fac4d 100644
--- a/src/calendar/gui/itip-utils.c
+++ b/src/calendar/gui/itip-utils.c
@@ -1253,7 +1253,7 @@ comp_subject (ESourceRegistry *registry,
gchar *sender;
ECalComponentAttendee *a = NULL;
- caltext = e_cal_component_get_summary (comp);
+ caltext = e_cal_component_dup_summary_for_locale (comp, NULL);
if (caltext && e_cal_component_text_get_value (caltext)) {
description = e_cal_component_text_get_value (caltext);
} else {
@@ -2785,7 +2785,6 @@ reply_to_calendar_comp (ESourceRegistry *registry,
gchar *location;
gchar *time = NULL;
gchar *html_description = NULL;
- GSList *text_list;
ECalComponentOrganizer *organizer;
ECalComponentText *text;
ECalComponentDateTime *dtstart;
@@ -2793,17 +2792,12 @@ reply_to_calendar_comp (ESourceRegistry *registry,
time_t start;
const gchar *organizer_email;
- text_list = e_cal_component_get_descriptions (comp);
-
- if (text_list) {
- text = text_list->data;
- if (text && e_cal_component_text_get_value (text))
- description = g_strdup (e_cal_component_text_get_value (text));
- }
-
- g_slist_free_full (text_list, e_cal_component_text_free);
+ text = e_cal_component_dup_description_for_locale (comp, NULL);
+ if (text && e_cal_component_text_get_value (text))
+ description = g_strdup (e_cal_component_text_get_value (text));
+ e_cal_component_text_free (text);
- text = e_cal_component_get_summary (comp);
+ text = e_cal_component_dup_summary_for_locale (comp, NULL);
if (text && e_cal_component_text_get_value (text))
subject = g_strdup (e_cal_component_text_get_value (text));
e_cal_component_text_free (text);
diff --git a/src/calendar/gui/print.c b/src/calendar/gui/print.c
index 3f574a5ce1..4479fbc7ab 100644
--- a/src/calendar/gui/print.c
+++ b/src/calendar/gui/print.c
@@ -2461,7 +2461,7 @@ print_todo_details (GtkPrintContext *context,
if (!comp)
continue;
- summary = e_cal_component_get_summary (comp);
+ summary = e_cal_component_dup_summary_for_locale (comp, NULL);
if (!summary || !e_cal_component_text_get_value (summary)) {
e_cal_component_text_free (summary);
g_object_unref (comp);
@@ -3612,7 +3612,7 @@ print_comp_draw_real (GtkPrintOperation *operation,
/* Summary */
font = get_font_for_size (18, PANGO_WEIGHT_BOLD);
- text = e_cal_component_get_summary (comp);
+ text = e_cal_component_dup_summary_for_locale (comp, NULL);
summary_string = g_strdup_printf (_("Summary: %s"), (text && e_cal_component_text_get_value (text)) ?
e_cal_component_text_get_value (text) : "");
top = bound_text (
context, font, summary_string, -1, 0.0, top, width,
@@ -3797,27 +3797,51 @@ print_comp_draw_real (GtkPrintOperation *operation,
top += 16;
/* Description */
- desc = e_cal_component_get_descriptions (comp);
- for (elem = desc; elem; elem = g_slist_next (elem)) {
- ECalComponentText *ptext = elem->data;
- const gchar *line, *next_line;
+ if (e_cal_component_get_vtype (comp) == E_CAL_COMPONENT_JOURNAL) {
+ desc = e_cal_component_get_descriptions (comp);
+ for (elem = desc; elem; elem = g_slist_next (elem)) {
+ ECalComponentText *ptext = elem->data;
+ const gchar *line, *next_line;
- for (line = e_cal_component_text_get_value (ptext); line != NULL; line = next_line) {
- next_line = strchr (line, '\n');
+ for (line = e_cal_component_text_get_value (ptext); line != NULL; line = next_line) {
+ next_line = strchr (line, '\n');
- top = bound_text (
- context, font, line,
- next_line ? next_line - line : -1,
- 0.0, top + 3, width, height, TRUE, NULL,
- &page_start, &pages);
-
- if (next_line) {
- next_line++;
- if (!*next_line)
- next_line = NULL;
+ top = bound_text (
+ context, font, line,
+ next_line ? next_line - line : -1,
+ 0.0, top + 3, width, height, TRUE, NULL,
+ &page_start, &pages);
+
+ if (next_line) {
+ next_line++;
+ if (!*next_line)
+ next_line = NULL;
+ }
}
}
+ } else {
+ text = e_cal_component_dup_description_for_locale (comp, NULL);
+ if (text) {
+ const gchar *line, *next_line;
+
+ for (line = e_cal_component_text_get_value (text); line != NULL; line = next_line) {
+ next_line = strchr (line, '\n');
+
+ top = bound_text (
+ context, font, line,
+ next_line ? next_line - line : -1,
+ 0.0, top + 3, width, height, TRUE, NULL,
+ &page_start, &pages);
+
+ if (next_line) {
+ next_line++;
+ if (!*next_line)
+ next_line = NULL;
+ }
+ }
+ }
+ e_cal_component_text_free (text);
}
g_slist_free_full (desc, e_cal_component_text_free);
diff --git a/src/calendar/importers/icalendar-importer.c b/src/calendar/importers/icalendar-importer.c
index 54a2083907..68b771c67f 100644
--- a/src/calendar/importers/icalendar-importer.c
+++ b/src/calendar/importers/icalendar-importer.c
@@ -1403,7 +1403,7 @@ preview_comp (EWebViewPreview *preview,
/* Translators: Appointment's classification section name */
e_web_view_preview_add_section (preview, C_("iCalImp", "Classification"), str);
- text = e_cal_component_get_summary (comp);
+ text = e_cal_component_dup_summary_for_locale (comp, NULL);
if (text && (e_cal_component_text_get_value (text) || e_cal_component_text_get_altrep (text)))
/* Translators: Appointment's summary */
e_web_view_preview_add_section (preview, C_("iCalImp", "Summary"),
@@ -1545,17 +1545,27 @@ preview_comp (EWebViewPreview *preview,
g_slist_free_full (attendees, e_cal_component_attendee_free);
}
- slist = e_cal_component_get_descriptions (comp);
- for (l = slist; l; l = l->next) {
- ECalComponentText *txt = l->data;
- const gchar *value;
+ if (e_cal_component_get_vtype (comp) == E_CAL_COMPONENT_JOURNAL) {
+ slist = e_cal_component_get_descriptions (comp);
- value = txt ? e_cal_component_text_get_value (txt) : NULL;
+ for (l = slist; l; l = l->next) {
+ ECalComponentText *txt = l->data;
+ const gchar *value;
- e_web_view_preview_add_section (preview, l != slist ? NULL : C_("iCalImp", "Description"),
value ? value : "");
- }
+ value = txt ? e_cal_component_text_get_value (txt) : NULL;
+
+ e_web_view_preview_add_section (preview, l != slist ? NULL : C_("iCalImp",
"Description"), value ? value : "");
+ }
- g_slist_free_full (slist, e_cal_component_text_free);
+ g_slist_free_full (slist, e_cal_component_text_free);
+ } else {
+ text = e_cal_component_dup_description_for_locale (comp, NULL);
+ if (text) {
+ const gchar *value = e_cal_component_text_get_value (text);
+ e_web_view_preview_add_section (preview, C_("iCalImp", "Description"), value ? value
: "");
+ }
+ e_cal_component_text_free (text);
+ }
}
static void
@@ -1662,7 +1672,7 @@ ical_get_preview (ICalComponent *icomp)
if (!comp)
continue;
- summary = e_cal_component_get_summary (comp);
+ summary = e_cal_component_dup_summary_for_locale (comp, NULL);
if (summary) {
const gchar *value, *altrep;
diff --git a/src/modules/composer-to-meeting/e-meeting-to-composer.c
b/src/modules/composer-to-meeting/e-meeting-to-composer.c
index 955e3e8022..a8fdf076bf 100644
--- a/src/modules/composer-to-meeting/e-meeting-to-composer.c
+++ b/src/modules/composer-to-meeting/e-meeting-to-composer.c
@@ -180,9 +180,11 @@ meeting_to_composer_composer_created_cb (GObject *source_object,
e_comp_editor_set_updating (comp_editor, did_updating);
/* Subject */
- text = i_cal_component_get_summary (icomp);
+ prop = e_cal_util_component_find_property_for_locale (icomp, I_CAL_SUMMARY_PROPERTY, NULL);
+ text = prop ? i_cal_property_get_summary (prop) : NULL;
if (text && *text)
e_composer_header_table_set_subject (header_table, text);
+ g_clear_object (&prop);
/* From */
prop = i_cal_component_get_first_property (icomp, I_CAL_ORGANIZER_PROPERTY);
@@ -292,7 +294,7 @@ meeting_to_composer_composer_created_cb (GObject *source_object,
g_ptr_array_free (cc_recips, TRUE);
/* Body */
- prop = i_cal_component_get_first_property (icomp, I_CAL_DESCRIPTION_PROPERTY);
+ prop = e_cal_util_component_find_property_for_locale (icomp, I_CAL_DESCRIPTION_PROPERTY, NULL);
if (prop) {
text = i_cal_property_get_description (prop);
diff --git a/src/modules/itip-formatter/itip-view.c b/src/modules/itip-formatter/itip-view.c
index 03e7298c85..b014e1993e 100644
--- a/src/modules/itip-formatter/itip-view.c
+++ b/src/modules/itip-formatter/itip-view.c
@@ -4124,6 +4124,11 @@ find_cal_update_ui (FormatItipFindData *fd,
ncomps = g_slist_length (icomps);
if (ncomps == 1 && icomps->data) {
ICalComponent *icomp = icomps->data;
+ ICalProperty *prop;
+ const gchar *summary;
+
+ prop = e_cal_util_component_find_property_for_locale (icomp, I_CAL_SUMMARY_PROPERTY,
NULL);
+ summary = prop ? i_cal_property_get_summary (prop) : "";
switch (e_cal_client_get_source_type (cal_client)) {
case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
@@ -4131,24 +4136,26 @@ find_cal_update_ui (FormatItipFindData *fd,
itip_view_add_upper_info_item_printf (
view, ITIP_VIEW_INFO_ITEM_TYPE_WARNING,
_("An appointment “%s” in the calendar “%s” conflicts with this
meeting"),
- i_cal_component_get_summary (icomp),
+ summary,
source_display_name);
break;
case E_CAL_CLIENT_SOURCE_TYPE_TASKS:
itip_view_add_upper_info_item_printf (
view, ITIP_VIEW_INFO_ITEM_TYPE_WARNING,
_("A task “%s” in the task list “%s” conflicts with this task"),
- i_cal_component_get_summary (icomp),
+ summary,
source_display_name);
break;
case E_CAL_CLIENT_SOURCE_TYPE_MEMOS:
itip_view_add_upper_info_item_printf (
view, ITIP_VIEW_INFO_ITEM_TYPE_WARNING,
_("A memo “%s” in the memo list “%s” conflicts with this memo"),
- i_cal_component_get_summary (icomp),
+ summary,
source_display_name);
break;
}
+
+ g_clear_object (&prop);
} else {
switch (e_cal_client_get_source_type (cal_client)) {
case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
@@ -6784,7 +6791,7 @@ itip_view_init_view (ItipView *view)
}
}
- text = e_cal_component_get_summary (view->priv->comp);
+ text = e_cal_component_dup_summary_for_locale (view->priv->comp, NULL);
itip_view_set_summary (view, text && e_cal_component_text_get_value (text) ?
e_cal_component_text_get_value (text) : C_("cal-itip", "None"));
e_cal_component_text_free (text);
@@ -6928,20 +6935,27 @@ itip_view_init_view (ItipView *view)
}
if (!gstring) {
- list = e_cal_component_get_descriptions (view->priv->comp);
- for (l = list; l; l = l->next) {
- text = l->data;
+ if (e_cal_component_get_vtype (view->priv->comp) == E_CAL_COMPONENT_JOURNAL) {
+ list = e_cal_component_get_descriptions (view->priv->comp);
+ for (l = list; l; l = l->next) {
+ text = l->data;
- if (!text)
- continue;
+ if (!text)
+ continue;
- if (!gstring && e_cal_component_text_get_value (text))
+ if (!gstring && e_cal_component_text_get_value (text))
+ gstring = g_string_new (e_cal_component_text_get_value (text));
+ else if (e_cal_component_text_get_value (text))
+ g_string_append_printf (gstring, "\n\n%s",
e_cal_component_text_get_value (text));
+ }
+
+ g_slist_free_full (list, e_cal_component_text_free);
+ } else {
+ text = e_cal_component_dup_description_for_locale (view->priv->comp, NULL);
+ if (text && e_cal_component_text_get_value (text))
gstring = g_string_new (e_cal_component_text_get_value (text));
- else if (e_cal_component_text_get_value (text))
- g_string_append_printf (gstring, "\n\n%s", e_cal_component_text_get_value
(text));
+ e_cal_component_text_free (text);
}
-
- g_slist_free_full (list, e_cal_component_text_free);
}
if (gstring) {
diff --git a/src/plugins/mail-to-task/mail-to-task.c b/src/plugins/mail-to-task/mail-to-task.c
index fdb01ce7d8..48f15e77ed 100644
--- a/src/plugins/mail-to-task/mail-to-task.c
+++ b/src/plugins/mail-to-task/mail-to-task.c
@@ -753,9 +753,15 @@ do_manage_comp_idle (struct _manage_comp *mc)
const gchar *ask = get_question_edit_old (source_type);
if (ask) {
- gchar *msg = g_strdup_printf (ask, i_cal_component_get_summary (mc->stored_comp) ?
i_cal_component_get_summary (mc->stored_comp) : _("[No Summary]"));
+ ICalProperty *prop;
+ const gchar *summary;
+ gchar *msg;
gint chosen;
+ prop = e_cal_util_component_find_property_for_locale (mc->stored_comp,
I_CAL_SUMMARY_PROPERTY, NULL);
+ summary = prop ? i_cal_property_get_summary (prop) : NULL;
+ msg = g_strdup_printf (ask, summary && *summary ? summary : _("[No Summary]"));
+ g_clear_object (&prop);
chosen = do_ask (msg, TRUE);
if (chosen == GTK_RESPONSE_YES) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]