[evolution] I#254 - Handle components with no Summary in the To Do bar and Week view
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] I#254 - Handle components with no Summary in the To Do bar and Week view
- Date: Tue, 4 Dec 2018 13:51:13 +0000 (UTC)
commit 9a917242120b6feac7622baa1fac34bbe5427f0f
Author: Milan Crha <mcrha redhat com>
Date: Tue Dec 4 14:49:59 2018 +0100
I#254 - Handle components with no Summary in the To Do bar and Week view
Closes https://gitlab.gnome.org/GNOME/evolution/issues/254
src/calendar/gui/e-to-do-pane.c | 26 +++++++++++++++++++++-----
src/calendar/gui/e-week-view.c | 15 ++++++++++++---
2 files changed, 33 insertions(+), 8 deletions(-)
---
diff --git a/src/calendar/gui/e-to-do-pane.c b/src/calendar/gui/e-to-do-pane.c
index 4384dcd141..fdf55c9e68 100644
--- a/src/calendar/gui/e-to-do-pane.c
+++ b/src/calendar/gui/e-to-do-pane.c
@@ -298,6 +298,22 @@ etdp_format_date_time (ECalClient *client,
return e_datetime_format_format_tm ("calendar", "table", itt.is_date ? DTFormatKindDate :
DTFormatKindDateTime, &tm);
}
+static const gchar *
+etdp_get_component_summary (icalcomponent *icalcomp)
+{
+ const gchar *summary;
+
+ if (!icalcomp)
+ return "";
+
+ summary = icalcomponent_get_summary (icalcomp);
+
+ if (!summary || !*summary)
+ summary = "";
+
+ return summary;
+}
+
static gboolean
etdp_get_component_data (EToDoPane *to_do_pane,
ECalClient *client,
@@ -339,7 +355,7 @@ etdp_get_component_data (EToDoPane *to_do_pane,
tooltip = g_string_sized_new (512);
- etdp_append_to_string_escaped (tooltip, "<b>%s</b>", icalcomponent_get_summary (icalcomp), NULL);
+ etdp_append_to_string_escaped (tooltip, "<b>%s</b>", etdp_get_component_summary (icalcomp), NULL);
if (location) {
g_string_append (tooltip, "\n");
@@ -460,7 +476,7 @@ etdp_get_component_data (EToDoPane *to_do_pane,
if (time_str) {
*out_summary = g_markup_printf_escaped ("<span size=\"xx-small\">%s</span> %s%s%s%s",
- time_str, icalcomponent_get_summary (icalcomp), location ? " (" : "",
+ time_str, etdp_get_component_summary (icalcomp), location ? " (" : "",
location ? location : "", location ? ")" : "");
}
@@ -468,7 +484,7 @@ etdp_get_component_data (EToDoPane *to_do_pane,
}
if (!*out_summary) {
- *out_summary = g_markup_printf_escaped ("%s%s%s%s", icalcomponent_get_summary (icalcomp),
+ *out_summary = g_markup_printf_escaped ("%s%s%s%s", etdp_get_component_summary (icalcomp),
location ? " (" : "", location ? location : "", location ? ")" : "");
}
@@ -496,12 +512,12 @@ etdp_get_component_data (EToDoPane *to_do_pane,
if (icaltime_is_null_time (itt)) {
/* Sort those without Start date after those with it */
*out_sort_key = g_strdup_printf ("%s-Z-%s-%s-%s",
- prefix, icalcomponent_get_summary (icalcomp),
+ prefix, etdp_get_component_summary (icalcomp),
(id && id->uid) ? id->uid : "", (id && id->rid) ? id->rid : "");
} else {
*out_sort_key = g_strdup_printf ("%s-%04d%02d%02d%02d%02d%02d-%s-%s-%s",
prefix, itt.year, itt.month, itt.day, itt.hour, itt.minute, itt.second,
- icalcomponent_get_summary (icalcomp),
+ etdp_get_component_summary (icalcomp),
(id && id->uid) ? id->uid : "", (id && id->rid) ? id->rid : "");
}
} else {
diff --git a/src/calendar/gui/e-week-view.c b/src/calendar/gui/e-week-view.c
index ad1ae1b57c..40fad7aade 100644
--- a/src/calendar/gui/e-week-view.c
+++ b/src/calendar/gui/e-week-view.c
@@ -3701,7 +3701,7 @@ get_comp_summary (ECalClient *client,
location = icalcomponent_get_location (icalcomp);
if (location && *location) {
*free_text = TRUE;
- summary = g_strdup_printf ("%s (%s)", my_summary, location);
+ summary = g_strdup_printf ("%s (%s)", my_summary ? my_summary : "", location);
if (my_free_text)
g_free ((gchar *) my_summary);
@@ -4054,6 +4054,7 @@ e_week_view_start_editing_event (EWeekView *week_view,
ETextEventProcessor *event_processor = NULL;
ETextEventProcessorCommand command;
ECalModelComponent *comp_data;
+ const gchar *summary;
/* If we are already editing the event, just return. */
if (event_num == week_view->editing_event_num
@@ -4095,9 +4096,13 @@ e_week_view_start_editing_event (EWeekView *week_view,
return FALSE;
}
+ summary = icalcomponent_get_summary (event->comp_data->icalcomp);
+ if (!summary)
+ summary = "";
+
gnome_canvas_item_set (
span->text_item,
- "text", initial_text ? initial_text : icalcomponent_get_summary (event->comp_data->icalcomp),
+ "text", initial_text ? initial_text : summary,
NULL);
/* Save the comp_data value because we use that as our invariant */
@@ -4656,12 +4661,16 @@ e_week_view_on_editing_started (EWeekView *week_view,
if (is_comp_data_valid (event) &&
is_array_index_in_bounds (week_view->spans, event->spans_index + span_num)) {
+ const gchar *summary;
+
span = &g_array_index (week_view->spans, EWeekViewEventSpan,
event->spans_index + span_num);
+ summary = icalcomponent_get_summary (event->comp_data->icalcomp);
+
gnome_canvas_item_set (
span->text_item,
- "text", icalcomponent_get_summary (event->comp_data->icalcomp),
+ "text", summary ? summary : "",
NULL);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]