"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/calendar/gui/e-to-do-pane.c" between
evolution-3.32.4.tar.xz and evolution-3.34.0.tar.xz

About: Evolution is a personal information management application that provides integrated mail, calendaring and address book functionality (GNOME desktop).

e-to-do-pane.c  (evolution-3.32.4.tar.xz):e-to-do-pane.c  (evolution-3.34.0.tar.xz)
skipping to change at line 174 skipping to change at line 174
static void static void
etdp_free_component_refs (gpointer ptr) etdp_free_component_refs (gpointer ptr)
{ {
GSList *roots = ptr; GSList *roots = ptr;
g_slist_free_full (roots, (GDestroyNotify) gtk_tree_row_reference_free); g_slist_free_full (roots, (GDestroyNotify) gtk_tree_row_reference_free);
} }
static guint static guint
etdp_create_date_mark (const struct icaltimetype *itt) etdp_create_date_mark (/* const */ ICalTime *itt)
{ {
if (!itt) if (!itt)
return 0; return 0;
return itt->year * 10000 + itt->month * 100 + itt->day; return i_cal_time_get_year (itt) * 10000 +
i_cal_time_get_month (itt) * 100 +
i_cal_time_get_day (itt);
} }
static void static void
etdp_itt_to_zone (struct icaltimetype *itt, etdp_itt_to_zone (ICalTime *itt,
const gchar *itt_tzid, const gchar *itt_tzid,
ECalClient *client, ECalClient *client,
icaltimezone *default_zone) ICalTimezone *default_zone)
{ {
icaltimezone *zone = NULL; ICalTimezone *zone = NULL;
g_return_if_fail (itt != NULL); g_return_if_fail (itt != NULL);
if (itt_tzid) { if (itt_tzid) {
e_cal_client_get_timezone_sync (client, itt_tzid, &zone, NULL, NU if (!e_cal_client_get_timezone_sync (client, itt_tzid, &zone, NUL
LL); L, NULL))
} else if (icaltime_is_utc (*itt)) { zone = NULL;
zone = icaltimezone_get_utc_timezone (); } else if (i_cal_time_is_utc (itt)) {
zone = i_cal_timezone_get_utc_timezone ();
} }
if (zone) if (zone)
icaltimezone_convert_time (itt, zone, default_zone); i_cal_time_convert_timezone (itt, zone, default_zone);
} }
static gchar * static gchar *
etdp_date_time_to_string (const ECalComponentDateTime *dt, etdp_date_time_to_string (const ECalComponentDateTime *dt,
ECalClient *client, ECalClient *client,
icaltimezone *default_zone, ICalTimezone *default_zone,
guint today_date_mark, guint today_date_mark,
gboolean is_task, gboolean is_task,
gboolean use_24hour_format, gboolean use_24hour_format,
struct icaltimetype *out_itt) ICalTime **out_itt)
{ {
gboolean is_overdue; gboolean is_overdue;
gchar *res; gchar *res;
g_return_val_if_fail (dt != NULL, NULL); g_return_val_if_fail (dt != NULL, NULL);
g_return_val_if_fail (dt->value != NULL, NULL); g_return_val_if_fail (e_cal_component_datetime_get_value (dt) != NULL, NU LL);
g_return_val_if_fail (out_itt != NULL, NULL); g_return_val_if_fail (out_itt != NULL, NULL);
*out_itt = *dt->value; *out_itt = i_cal_time_clone (e_cal_component_datetime_get_value (dt));
etdp_itt_to_zone (out_itt, dt->tzid, client, default_zone); etdp_itt_to_zone (*out_itt, e_cal_component_datetime_get_tzid (dt), clien t, default_zone);
is_overdue = is_task && etdp_create_date_mark (out_itt) < today_date_mark ; is_overdue = is_task && etdp_create_date_mark (*out_itt) < today_date_mar k;
if (out_itt->is_date && !is_overdue) if (i_cal_time_is_date (*out_itt) && !is_overdue)
return NULL; return NULL;
if (is_overdue) { if (is_overdue) {
struct tm tm; struct tm tm;
tm = icaltimetype_to_tm (out_itt); tm = e_cal_util_icaltime_to_tm (*out_itt);
res = e_datetime_format_format_tm ("calendar", "table", out_itt-> is_date ? DTFormatKindDate : DTFormatKindDateTime, &tm); res = e_datetime_format_format_tm ("calendar", "table", i_cal_tim e_is_date (*out_itt) ? DTFormatKindDate : DTFormatKindDateTime, &tm);
} else { } else {
if (use_24hour_format) { if (use_24hour_format) {
res = g_strdup_printf ("%d:%02d", out_itt->hour, out_itt- >minute); res = g_strdup_printf ("%d:%02d", i_cal_time_get_hour (*o ut_itt), i_cal_time_get_minute (*out_itt));
} else { } else {
gint hour = out_itt->hour; gint hour = i_cal_time_get_hour (*out_itt);
const gchar *suffix; const gchar *suffix;
if (hour < 12) { if (hour < 12) {
/* String to use in 12-hour time format for times in the morning. */ /* String to use in 12-hour time format for times in the morning. */
suffix = _("am"); suffix = _("am");
} else { } else {
hour -= 12; hour -= 12;
/* String to use in 12-hour time format for times in the afternoon. */ /* String to use in 12-hour time format for times in the afternoon. */
suffix = _("pm"); suffix = _("pm");
} }
if (hour == 0) if (hour == 0)
hour = 12; hour = 12;
if (!out_itt->minute) if (!i_cal_time_get_minute (*out_itt))
res = g_strdup_printf ("%d %s", hour, suffix); res = g_strdup_printf ("%d %s", hour, suffix);
else else
res = g_strdup_printf ("%d:%02d %s", hour, out_it t->minute, suffix); res = g_strdup_printf ("%d:%02d %s", hour, i_cal_ time_get_minute (*out_itt), suffix);
} }
} }
return res; return res;
} }
static void static void
etdp_append_to_string_escaped (GString *str, etdp_append_to_string_escaped (GString *str,
const gchar *format, const gchar *format,
const gchar *value1, const gchar *value1,
skipping to change at line 283 skipping to change at line 286
if (!value1 || !*value1) if (!value1 || !*value1)
return; return;
escaped = g_markup_printf_escaped (format, value1, value2); escaped = g_markup_printf_escaped (format, value1, value2);
g_string_append (str, escaped); g_string_append (str, escaped);
g_free (escaped); g_free (escaped);
} }
static gchar * static gchar *
etdp_format_date_time (ECalClient *client, etdp_format_date_time (ECalClient *client,
icaltimezone *default_zone, ICalTimezone *default_zone,
const struct icaltimetype *in_itt, const ICalTime *in_itt,
const gchar *tzid) const gchar *tzid)
{ {
struct icaltimetype itt; ICalTime *itt;
struct tm tm; struct tm tm;
gchar *res;
if (!in_itt) if (!in_itt)
return NULL; return NULL;
itt = *in_itt; itt = i_cal_time_clone ((ICalTime *) in_itt);
etdp_itt_to_zone (itt, tzid, client, default_zone);
etdp_itt_to_zone (&itt, tzid, client, default_zone); tm = e_cal_util_icaltime_to_tm (itt);
tm = icaltimetype_to_tm (&itt); res = e_datetime_format_format_tm ("calendar", "table", i_cal_time_is_dat e (itt) ? DTFormatKindDate : DTFormatKindDateTime, &tm);
return e_datetime_format_format_tm ("calendar", "table", itt.is_date ? DT g_clear_object (&itt);
FormatKindDate : DTFormatKindDateTime, &tm);
return res;
} }
static const gchar * static gchar *
etdp_get_component_summary (icalcomponent *icalcomp) etdp_dup_component_summary (ICalComponent *icomp)
{ {
const gchar *summary; gchar *summary;
if (!icalcomp) if (!icomp)
return ""; return g_strdup ("");
summary = icalcomponent_get_summary (icalcomp); summary = e_calendar_view_dup_component_summary (icomp);
if (!summary || !*summary) if (!summary)
summary = ""; summary = g_strdup ("");
return summary; return summary;
} }
static gboolean static gboolean
etdp_get_component_data (EToDoPane *to_do_pane, etdp_get_component_data (EToDoPane *to_do_pane,
ECalClient *client, ECalClient *client,
ECalComponent *comp, ECalComponent *comp,
icaltimezone *default_zone, ICalTimezone *default_zone,
guint today_date_mark, guint today_date_mark,
gchar **out_summary, gchar **out_summary,
gchar **out_summary_no_time,
gchar **out_tooltip, gchar **out_tooltip,
gboolean *out_is_task, gboolean *out_is_task,
gboolean *out_is_completed, gboolean *out_is_completed,
gchar **out_sort_key, gchar **out_sort_key,
guint *out_date_mark) guint *out_date_mark)
{ {
icalcomponent *icalcomp; ICalComponent *icomp;
ECalComponentDateTime dt = { 0 }; ECalComponentDateTime *dt;
ECalComponentId *id; ECalComponentId *id;
struct icaltimetype itt = icaltime_null_time (); ICalTime *itt = NULL;
const gchar *prefix, *location, *description; const gchar *prefix, *location, *description, *uid_str, *rid_str;
gboolean task_has_due_date = TRUE, is_cancelled = FALSE; /* ignored for e vents, thus like being set */ gboolean task_has_due_date = TRUE, is_cancelled = FALSE; /* ignored for e vents, thus like being set */
icalproperty_status status = ICAL_STATUS_NONE; ICalPropertyStatus status;
gchar *comp_summary;
GString *tooltip; GString *tooltip;
g_return_val_if_fail (E_IS_TO_DO_PANE (to_do_pane), FALSE); g_return_val_if_fail (E_IS_TO_DO_PANE (to_do_pane), FALSE);
g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE); g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE);
g_return_val_if_fail (E_IS_CAL_COMPONENT (comp), FALSE); g_return_val_if_fail (E_IS_CAL_COMPONENT (comp), FALSE);
g_return_val_if_fail (out_summary, FALSE); g_return_val_if_fail (out_summary, FALSE);
g_return_val_if_fail (out_summary_no_time, FALSE);
g_return_val_if_fail (out_tooltip, FALSE); g_return_val_if_fail (out_tooltip, FALSE);
g_return_val_if_fail (out_is_task, FALSE); g_return_val_if_fail (out_is_task, FALSE);
g_return_val_if_fail (out_is_completed, FALSE); g_return_val_if_fail (out_is_completed, FALSE);
g_return_val_if_fail (out_sort_key, FALSE); g_return_val_if_fail (out_sort_key, FALSE);
g_return_val_if_fail (out_date_mark, FALSE); g_return_val_if_fail (out_date_mark, FALSE);
icalcomp = e_cal_component_get_icalcomponent (comp); icomp = e_cal_component_get_icalcomponent (comp);
g_return_val_if_fail (icalcomp != NULL, FALSE); g_return_val_if_fail (icomp != NULL, FALSE);
location = icalcomponent_get_location (icalcomp); location = i_cal_component_get_location (icomp);
if (location && !*location) if (location && !*location)
location = NULL; location = NULL;
tooltip = g_string_sized_new (512); tooltip = g_string_sized_new (512);
etdp_append_to_string_escaped (tooltip, "<b>%s</b>", etdp_get_component_s comp_summary = etdp_dup_component_summary (icomp);
ummary (icalcomp), NULL);
etdp_append_to_string_escaped (tooltip, "<b>%s</b>", comp_summary, NULL);
if (location) { if (location) {
g_string_append (tooltip, "\n"); g_string_append_c (tooltip, '\n');
/* Translators: It will display "Location: LocationOfTheAppointme nt" */ /* Translators: It will display "Location: LocationOfTheAppointme nt" */
etdp_append_to_string_escaped (tooltip, _("Location: %s"), locati on, NULL); etdp_append_to_string_escaped (tooltip, _("Location: %s"), locati on, NULL);
} }
*out_is_task = e_cal_component_get_vtype (comp) == E_CAL_COMPONENT_TODO; *out_is_task = e_cal_component_get_vtype (comp) == E_CAL_COMPONENT_TODO;
*out_is_completed = FALSE; *out_is_completed = FALSE;
e_cal_component_get_status (comp, &status); status = e_cal_component_get_status (comp);
is_cancelled = status == ICAL_STATUS_CANCELLED; is_cancelled = status == I_CAL_STATUS_CANCELLED;
if (*out_is_task) { if (*out_is_task) {
ECalComponentDateTime dtstart = { 0 }; ECalComponentDateTime *dtstart;
struct icaltimetype *completed = NULL; ICalTime *completed;
/* Tasks after events */ /* Tasks after events */
prefix = "1"; prefix = "1";
e_cal_component_get_dtstart (comp, &dtstart); dtstart = e_cal_component_get_dtstart (comp);
e_cal_component_get_due (comp, &dt); dt = e_cal_component_get_due (comp);
e_cal_component_get_completed (comp, &completed); completed = e_cal_component_get_completed (comp);
if (dtstart.value) { if (dtstart && e_cal_component_datetime_get_value (dtstart)) {
gchar *tmp; gchar *tmp;
tmp = etdp_format_date_time (client, default_zone, dtstar tmp = etdp_format_date_time (client, default_zone,
t.value, dtstart.tzid); e_cal_component_datetime_get_value (dtstart),
e_cal_component_datetime_get_tzid (dtstart));
g_string_append (tooltip, "\n"); g_string_append_c (tooltip, '\n');
/* Translators: It will display "Start: StartDateAndTime" */ /* Translators: It will display "Start: StartDateAndTime" */
etdp_append_to_string_escaped (tooltip, _("Start: %s"), t mp, NULL); etdp_append_to_string_escaped (tooltip, _("Start: %s"), t mp, NULL);
g_free (tmp); g_free (tmp);
if (!dt.value) { if (!dt || !e_cal_component_datetime_get_value (dt)) {
/* Fill the itt structure in case the task has no Due date */ /* Fill the itt structure in case the task has no Due date */
itt = *dtstart.value; itt = i_cal_time_clone (e_cal_component_datetime_
etdp_itt_to_zone (&itt, dtstart.tzid, client, def get_value (dtstart));
ault_zone); etdp_itt_to_zone (itt, e_cal_component_datetime_g
et_tzid (dtstart), client, default_zone);
} }
e_cal_component_free_datetime (&dtstart);
} }
if (dt.value) { e_cal_component_datetime_free (dtstart);
if (dt && e_cal_component_datetime_get_value (dt)) {
gchar *tmp; gchar *tmp;
tmp = etdp_format_date_time (client, default_zone, dt.val tmp = etdp_format_date_time (client, default_zone,
ue, dt.tzid); e_cal_component_datetime_get_value (dt),
e_cal_component_datetime_get_tzid (dt));
g_string_append (tooltip, "\n"); g_string_append_c (tooltip, '\n');
/* Translators: It will display "Due: DueDateAndTime" */ /* Translators: It will display "Due: DueDateAndTime" */
etdp_append_to_string_escaped (tooltip, _("Due: %s"), tmp , NULL); etdp_append_to_string_escaped (tooltip, _("Due: %s"), tmp , NULL);
g_free (tmp); g_free (tmp);
} else { } else {
task_has_due_date = FALSE; task_has_due_date = FALSE;
} }
if (completed) { if (completed) {
gchar *tmp; gchar *tmp;
tmp = etdp_format_date_time (client, default_zone, comple ted, NULL); tmp = etdp_format_date_time (client, default_zone, comple ted, NULL);
g_string_append (tooltip, "\n"); g_string_append_c (tooltip, '\n');
/* Translators: It will display "Completed: DateAndTimeWh enCompleted" */ /* Translators: It will display "Completed: DateAndTimeWh enCompleted" */
etdp_append_to_string_escaped (tooltip, _("Completed: %s" ), tmp, NULL); etdp_append_to_string_escaped (tooltip, _("Completed: %s" ), tmp, NULL);
g_free (tmp); g_free (tmp);
*out_is_completed = TRUE; *out_is_completed = TRUE;
e_cal_component_free_icaltimetype (completed);
} else { } else {
*out_is_completed = *out_is_completed || status == ICAL_S TATUS_COMPLETED; *out_is_completed = *out_is_completed || status == I_CAL_ STATUS_COMPLETED;
} }
g_clear_object (&completed);
} else { } else {
/* Events first */ /* Events first */
prefix = "0"; prefix = "0";
e_cal_component_get_dtstart (comp, &dt); dt = e_cal_component_get_dtstart (comp);
if (dt.value) { if (dt && e_cal_component_datetime_get_value (dt)) {
ECalComponentDateTime dtend = { 0 }; ECalComponentDateTime *dtend;
struct icaltimetype ittstart, ittend; ICalTime *ittstart, *ittend;
gchar *strstart, *strduration; gchar *strstart, *strduration;
e_cal_component_get_dtend (comp, &dtend); dtend = e_cal_component_get_dtend (comp);
ittstart = *dt.value; ittstart = i_cal_time_clone (e_cal_component_datetime_get
if (dtend.value) _value (dt));
ittend = *dtend.value; if (dtend && e_cal_component_datetime_get_value (dtend))
ittend = i_cal_time_clone (e_cal_component_dateti
me_get_value (dtend));
else else
ittend = ittstart; ittend = i_cal_time_clone (ittstart);
etdp_itt_to_zone (&ittstart, dt.tzid, client, default_zon etdp_itt_to_zone (ittstart, e_cal_component_datetime_get_
e); tzid (dt), client, default_zone);
etdp_itt_to_zone (&ittend, dtend.value ? dtend.tzid : dt. etdp_itt_to_zone (ittend, (dtend && e_cal_component_datet
tzid, client, default_zone); ime_get_value (dtend)) ?
e_cal_component_datetime_get_tzid (dtend) : e_cal
_component_datetime_get_tzid (dt), client, default_zone);
strstart = etdp_format_date_time (client, default_zone, & strstart = etdp_format_date_time (client, default_zone, i
ittstart, NULL); ttstart, NULL);
strduration = calculate_time (icaltime_as_timet (ittstart strduration = calculate_time (i_cal_time_as_timet (ittsta
), icaltime_as_timet (ittend)); rt), i_cal_time_as_timet (ittend));
g_string_append (tooltip, "\n"); g_string_append_c (tooltip, '\n');
/* Translators: It will display "Time: StartDateAndTime ( Duration)" */ /* Translators: It will display "Time: StartDateAndTime ( Duration)" */
etdp_append_to_string_escaped (tooltip, _("Time: %s %s"), strstart, strduration); etdp_append_to_string_escaped (tooltip, _("Time: %s %s"), strstart, strduration);
g_free (strduration); g_free (strduration);
g_free (strstart); g_free (strstart);
e_cal_component_free_datetime (&dtend); e_cal_component_datetime_free (dtend);
g_clear_object (&ittstart);
g_clear_object (&ittend);
} }
} }
*out_summary = NULL; *out_summary = NULL;
*out_summary_no_time = g_markup_printf_escaped ("%s%s%s%s", comp_summary,
location ? " (" : "", location ? location : "", location ? ")" :
"");
if (dt.value) { if (dt && e_cal_component_datetime_get_value (dt)) {
gchar *time_str; gchar *time_str;
time_str = etdp_date_time_to_string (&dt, client, default_zone, t g_clear_object (&itt);
oday_date_mark, *out_is_task,
time_str = etdp_date_time_to_string (dt, client, default_zone, to
day_date_mark, *out_is_task,
to_do_pane->priv->use_24hour_format, &itt); to_do_pane->priv->use_24hour_format, &itt);
if (time_str) { if (time_str) {
*out_summary = g_markup_printf_escaped ("<span size=\"xx- small\">%s</span> %s%s%s%s", *out_summary = g_markup_printf_escaped ("<span size=\"xx- small\">%s</span> %s%s%s%s",
time_str, etdp_get_component_summary (icalcomp), location ? " (" : "", time_str, comp_summary, location ? " (" : "",
location ? location : "", location ? ")" : ""); location ? location : "", location ? ")" : "");
} }
g_free (time_str); g_free (time_str);
} }
if (!*out_summary) { if (!*out_summary)
*out_summary = g_markup_printf_escaped ("%s%s%s%s", etdp_get_comp *out_summary = g_strdup (*out_summary_no_time);
onent_summary (icalcomp),
location ? " (" : "", location ? location : "", location
? ")" : "");
}
if (*out_is_completed || is_cancelled) { if (*out_is_completed || is_cancelled) {
gchar *tmp = *out_summary; gchar *tmp;
/* With leading space, to have proper row height in GtkTreeView * / /* With leading space, to have proper row height in GtkTreeView * /
tmp = *out_summary;
*out_summary = g_strdup_printf (" <s>%s</s>", *out_summary); *out_summary = g_strdup_printf (" <s>%s</s>", *out_summary);
g_free (tmp);
tmp = *out_summary_no_time;
*out_summary_no_time = g_strdup_printf (" <s>%s</s>", *out_summar
y_no_time);
g_free (tmp); g_free (tmp);
} else { } else {
gchar *tmp = *out_summary; gchar *tmp;
/* With leading space, to have proper row height in GtkTreeView * / /* With leading space, to have proper row height in GtkTreeView * /
tmp = *out_summary;
*out_summary = g_strconcat (" ", *out_summary, NULL); *out_summary = g_strconcat (" ", *out_summary, NULL);
g_free (tmp);
tmp = *out_summary_no_time;
*out_summary_no_time = g_strconcat (" ", *out_summary_no_time, NU
LL);
g_free (tmp); g_free (tmp);
} }
e_cal_component_free_datetime (&dt); e_cal_component_datetime_free (dt);
id = e_cal_component_get_id (comp); id = e_cal_component_get_id (comp);
uid_str = (id && e_cal_component_id_get_uid (id)) ? e_cal_component_id_ge
t_uid (id) : "";
rid_str = (id && e_cal_component_id_get_rid (id)) ? e_cal_component_id_ge
t_rid (id) : "";
if (!task_has_due_date) { if (!task_has_due_date) {
if (icaltime_is_null_time (itt)) { if (!itt || i_cal_time_is_null_time (itt)) {
/* Sort those without Start date after those with it */ /* Sort those without Start date after those with it */
*out_sort_key = g_strdup_printf ("%s-Z-%s-%s-%s", *out_sort_key = g_strdup_printf ("%s-Z-%s-%s-%s",
prefix, etdp_get_component_summary (icalcomp), prefix, comp_summary,
(id && id->uid) ? id->uid : "", (id && id->rid) ? uid_str, rid_str);
id->rid : "");
} else { } else {
*out_sort_key = g_strdup_printf ("%s-%04d%02d%02d%02d%02d %02d-%s-%s-%s", *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, i prefix,
tt.minute, itt.second, i_cal_time_get_year (itt),
etdp_get_component_summary (icalcomp), i_cal_time_get_month (itt),
(id && id->uid) ? id->uid : "", (id && id->rid) ? i_cal_time_get_day (itt),
id->rid : ""); i_cal_time_get_hour (itt),
i_cal_time_get_minute (itt),
i_cal_time_get_second (itt),
comp_summary, uid_str, rid_str);
} }
} else { } else {
*out_sort_key = g_strdup_printf ("%s-%04d%02d%02d%02d%02d%02d-%s- %s", *out_sort_key = g_strdup_printf ("%s-%04d%02d%02d%02d%02d%02d-%s- %s",
prefix, itt.year, itt.month, itt.day, itt.hour, itt.minut prefix,
e, itt.second, itt ? i_cal_time_get_year (itt) : 0,
(id && id->uid) ? id->uid : "", (id && id->rid) ? id->rid itt ? i_cal_time_get_month (itt) : 0,
: ""); itt ? i_cal_time_get_day (itt) : 0,
itt ? i_cal_time_get_hour (itt) : 0,
itt ? i_cal_time_get_minute (itt) : 0,
itt ? i_cal_time_get_second (itt) : 0,
uid_str, rid_str);
} }
if (id) e_cal_component_id_free (id);
e_cal_component_free_id (id);
description = icalcomponent_get_description (icalcomp); description = i_cal_component_get_description (icomp);
if (description && *description && g_utf8_validate (description, -1, NULL )) { if (description && *description && g_utf8_validate (description, -1, NULL )) {
gchar *tmp = NULL; gchar *tmp = NULL;
glong len; glong len;
len = g_utf8_strlen (description, -1); len = g_utf8_strlen (description, -1);
if (len > MAX_TOOLTIP_DESCRIPTION_LEN) { if (len > MAX_TOOLTIP_DESCRIPTION_LEN) {
GString *str; GString *str;
const gchar *end; const gchar *end;
end = g_utf8_offset_to_pointer (description, MAX_TOOLTIP_ DESCRIPTION_LEN); end = g_utf8_offset_to_pointer (description, MAX_TOOLTIP_ DESCRIPTION_LEN);
skipping to change at line 556 skipping to change at line 601
tmp = g_string_free (str, FALSE); tmp = g_string_free (str, FALSE);
} }
g_string_append (tooltip, "\n\n"); g_string_append (tooltip, "\n\n");
etdp_append_to_string_escaped (tooltip, "%s", tmp ? tmp : descrip tion, NULL); etdp_append_to_string_escaped (tooltip, "%s", tmp ? tmp : descrip tion, NULL);
g_free (tmp); g_free (tmp);
} }
*out_date_mark = etdp_create_date_mark (&itt); *out_date_mark = etdp_create_date_mark (itt);
*out_tooltip = g_string_free (tooltip, FALSE); *out_tooltip = g_string_free (tooltip, FALSE);
g_clear_object (&itt);
g_free (comp_summary);
return TRUE; return TRUE;
} }
static GdkRGBA static GdkRGBA
etdp_get_fgcolor_for_bgcolor (const GdkRGBA *bgcolor) etdp_get_fgcolor_for_bgcolor (const GdkRGBA *bgcolor)
{ {
GdkRGBA fgcolor = { 1.0, 1.0, 1.0, 1.0 }; GdkRGBA fgcolor = { 1.0, 1.0, 1.0, 1.0 };
if (bgcolor) if (bgcolor)
fgcolor = e_utils_get_text_color_for_background (bgcolor); fgcolor = e_utils_get_text_color_for_background (bgcolor);
return fgcolor; return fgcolor;
} }
static GSList * /* GtkTreePath * */ static GSList * /* GtkTreePath * */
etdp_get_component_root_paths (EToDoPane *to_do_pane, etdp_get_component_root_paths (EToDoPane *to_do_pane,
ECalClient *client, ECalClient *client,
ECalComponent *comp, ECalComponent *comp,
icaltimezone *default_zone) ICalTimezone *default_zone)
{ {
ECalComponentDateTime dt; ECalComponentDateTime *dt;
struct icaltimetype itt; ICalTime *itt;
GtkTreePath *first_root_path = NULL; GtkTreePath *first_root_path = NULL;
GtkTreeModel *model; GtkTreeModel *model;
GSList *roots = NULL; GSList *roots = NULL;
guint start_date_mark, end_date_mark, prev_date_mark = 0; guint start_date_mark, end_date_mark, prev_date_mark = 0;
gint ii; gint ii;
g_return_val_if_fail (E_IS_TO_DO_PANE (to_do_pane), NULL); g_return_val_if_fail (E_IS_TO_DO_PANE (to_do_pane), NULL);
g_return_val_if_fail (E_IS_CAL_CLIENT (client), NULL); g_return_val_if_fail (E_IS_CAL_CLIENT (client), NULL);
g_return_val_if_fail (E_IS_CAL_COMPONENT (comp), NULL); g_return_val_if_fail (E_IS_CAL_COMPONENT (comp), NULL);
if (e_cal_component_get_vtype (comp) == E_CAL_COMPONENT_TODO) { if (e_cal_component_get_vtype (comp) == E_CAL_COMPONENT_TODO) {
e_cal_component_get_due (comp, &dt); dt = e_cal_component_get_due (comp);
if (dt.value) { if (dt && e_cal_component_datetime_get_value (dt)) {
itt = *dt.value; itt = e_cal_component_datetime_get_value (dt);
etdp_itt_to_zone (&itt, dt.tzid, client, default_zone); etdp_itt_to_zone (itt, e_cal_component_datetime_get_tzid
start_date_mark = etdp_create_date_mark (&itt); (dt), client, default_zone);
start_date_mark = etdp_create_date_mark (itt);
} else { } else {
start_date_mark = 0; start_date_mark = 0;
} }
end_date_mark = start_date_mark; end_date_mark = start_date_mark;
e_cal_component_free_datetime (&dt); e_cal_component_datetime_free (dt);
} else { } else {
e_cal_component_get_dtstart (comp, &dt); dt = e_cal_component_get_dtstart (comp);
if (dt.value) { if (dt && e_cal_component_datetime_get_value (dt)) {
itt = *dt.value; itt = e_cal_component_datetime_get_value (dt);
etdp_itt_to_zone (&itt, dt.tzid, client, default_zone); etdp_itt_to_zone (itt, e_cal_component_datetime_get_tzid
start_date_mark = etdp_create_date_mark (&itt); (dt), client, default_zone);
start_date_mark = etdp_create_date_mark (itt);
} else { } else {
start_date_mark = 0; start_date_mark = 0;
} }
e_cal_component_free_datetime (&dt); e_cal_component_datetime_free (dt);
dt = e_cal_component_get_dtend (comp);
e_cal_component_get_dtend (comp, &dt); if (dt && e_cal_component_datetime_get_value (dt)) {
itt = e_cal_component_datetime_get_value (dt);
etdp_itt_to_zone (itt, e_cal_component_datetime_get_tzid
(dt), client, default_zone);
/* The end time is excluded */
if (i_cal_time_is_date (itt))
i_cal_time_adjust (itt, -1, 0, 0, 0);
else
i_cal_time_adjust (itt, 0, 0, 0, -1);
if (dt.value) { end_date_mark = etdp_create_date_mark (itt);
itt = *dt.value;
etdp_itt_to_zone (&itt, dt.tzid, client, default_zone); /* Multiday event, the end_date_mark is excluded, thus ad
end_date_mark = etdp_create_date_mark (&itt); d one more day */
if (end_date_mark > start_date_mark)
end_date_mark++;
else if (end_date_mark < start_date_mark)
end_date_mark = start_date_mark;
} else { } else {
end_date_mark = start_date_mark; end_date_mark = start_date_mark;
} }
e_cal_component_free_datetime (&dt); e_cal_component_datetime_free (dt);
} }
model = GTK_TREE_MODEL (to_do_pane->priv->tree_store); model = GTK_TREE_MODEL (to_do_pane->priv->tree_store);
if (start_date_mark == 0 && e_cal_component_get_vtype (comp) == E_CAL_COM PONENT_TODO) { if (start_date_mark == 0 && e_cal_component_get_vtype (comp) == E_CAL_COM PONENT_TODO) {
if (!to_do_pane->priv->show_no_duedate_tasks) if (!to_do_pane->priv->show_no_duedate_tasks)
return NULL; return NULL;
if (gtk_tree_row_reference_valid (to_do_pane->priv->roots[N_ROOTS - 1])) { if (gtk_tree_row_reference_valid (to_do_pane->priv->roots[N_ROOTS - 1])) {
GtkTreePath *root_path; GtkTreePath *root_path;
skipping to change at line 787 skipping to change at line 848
etdp_get_comp_colors (EToDoPane *to_do_pane, etdp_get_comp_colors (EToDoPane *to_do_pane,
ECalClient *client, ECalClient *client,
ECalComponent *comp, ECalComponent *comp,
GdkRGBA *out_bgcolor, GdkRGBA *out_bgcolor,
gboolean *out_bgcolor_set, gboolean *out_bgcolor_set,
GdkRGBA *out_fgcolor, GdkRGBA *out_fgcolor,
gboolean *out_fgcolor_set, gboolean *out_fgcolor_set,
time_t *out_nearest_due) time_t *out_nearest_due)
{ {
GdkRGBA *bgcolor = NULL, fgcolor; GdkRGBA *bgcolor = NULL, fgcolor;
#ifdef HAVE_ICAL_COLOR_PROPERTY
GdkRGBA stack_bgcolor; GdkRGBA stack_bgcolor;
icalproperty *prop; ICalProperty *prop;
#endif
g_return_if_fail (E_IS_TO_DO_PANE (to_do_pane)); g_return_if_fail (E_IS_TO_DO_PANE (to_do_pane));
g_return_if_fail (out_bgcolor); g_return_if_fail (out_bgcolor);
g_return_if_fail (out_bgcolor_set); g_return_if_fail (out_bgcolor_set);
g_return_if_fail (out_fgcolor); g_return_if_fail (out_fgcolor);
g_return_if_fail (out_fgcolor_set); g_return_if_fail (out_fgcolor_set);
*out_bgcolor_set = FALSE; *out_bgcolor_set = FALSE;
*out_fgcolor_set = FALSE; *out_fgcolor_set = FALSE;
g_return_if_fail (E_IS_CAL_CLIENT (client)); g_return_if_fail (E_IS_CAL_CLIENT (client));
g_return_if_fail (E_IS_CAL_COMPONENT (comp)); g_return_if_fail (E_IS_CAL_COMPONENT (comp));
#ifdef HAVE_ICAL_COLOR_PROPERTY prop = i_cal_component_get_first_property (e_cal_component_get_icalcompon
prop = icalcomponent_get_first_property (e_cal_component_get_icalcomponen ent (comp), I_CAL_COLOR_PROPERTY);
t (comp), ICAL_COLOR_PROPERTY);
if (prop) { if (prop) {
const gchar *color_spec; const gchar *color_spec;
color_spec = icalproperty_get_color (prop); color_spec = i_cal_property_get_color (prop);
if (color_spec && gdk_rgba_parse (&stack_bgcolor, color_spec)) { if (color_spec && gdk_rgba_parse (&stack_bgcolor, color_spec)) {
bgcolor = &stack_bgcolor; bgcolor = &stack_bgcolor;
} }
g_clear_object (&prop);
} }
#endif
if (!bgcolor) if (!bgcolor)
bgcolor = g_hash_table_lookup (to_do_pane->priv->client_colors, e _client_get_source (E_CLIENT (client))); bgcolor = g_hash_table_lookup (to_do_pane->priv->client_colors, e _client_get_source (E_CLIENT (client)));
if (e_cal_component_get_vtype (comp) == E_CAL_COMPONENT_TODO && if (e_cal_component_get_vtype (comp) == E_CAL_COMPONENT_TODO &&
to_do_pane->priv->highlight_overdue && to_do_pane->priv->highlight_overdue &&
to_do_pane->priv->overdue_color) { to_do_pane->priv->overdue_color) {
ECalComponentDateTime dt = { 0 }; ECalComponentDateTime *dt;
e_cal_component_get_due (comp, &dt); dt = e_cal_component_get_due (comp);
if (dt.value) { if (dt && e_cal_component_datetime_get_value (dt)) {
icaltimezone *default_zone; ICalTimezone *default_zone;
struct icaltimetype itt, now; ICalTime *itt, *now;
gboolean is_date;
default_zone = e_cal_data_model_get_timezone (to_do_pane- >priv->events_data_model); default_zone = e_cal_data_model_get_timezone (to_do_pane- >priv->events_data_model);
itt = *dt.value; itt = e_cal_component_datetime_get_value (dt);
etdp_itt_to_zone (&itt, dt.tzid, client, default_zone); is_date = i_cal_time_is_date (itt);
etdp_itt_to_zone (itt, e_cal_component_datetime_get_tzid
(dt), client, default_zone);
now = icaltime_current_time_with_zone (default_zone); now = i_cal_time_new_current_with_zone (default_zone);
if ((dt.value->is_date && icaltime_compare_date_only (itt if ((is_date && i_cal_time_compare_date_only (itt, now) <
, now) < 0) || 0) ||
(!dt.value->is_date && icaltime_compare (itt, now) <= (!is_date && i_cal_time_compare (itt, now) <= 0)) {
0)) {
bgcolor = to_do_pane->priv->overdue_color; bgcolor = to_do_pane->priv->overdue_color;
} else if (out_nearest_due) { } else if (out_nearest_due) {
time_t due_tt; time_t due_tt;
due_tt = icaltime_as_timet_with_zone (itt, defaul t_zone); due_tt = i_cal_time_as_timet_with_zone (itt, defa ult_zone);
if (*out_nearest_due == (time_t) -1 || if (*out_nearest_due == (time_t) -1 ||
*out_nearest_due > due_tt) *out_nearest_due > due_tt)
*out_nearest_due = due_tt; *out_nearest_due = due_tt;
} }
g_clear_object (&now);
} }
e_cal_component_free_datetime (&dt); e_cal_component_datetime_free (dt);
} }
fgcolor = etdp_get_fgcolor_for_bgcolor (bgcolor); fgcolor = etdp_get_fgcolor_for_bgcolor (bgcolor);
*out_bgcolor_set = bgcolor != NULL; *out_bgcolor_set = bgcolor != NULL;
if (bgcolor) if (bgcolor)
*out_bgcolor = *bgcolor; *out_bgcolor = *bgcolor;
*out_fgcolor_set = *out_bgcolor_set; *out_fgcolor_set = *out_bgcolor_set;
*out_fgcolor = fgcolor; *out_fgcolor = fgcolor;
skipping to change at line 899 skipping to change at line 962
g_hash_table_remove (to_do_pane->priv->component_refs, ident); g_hash_table_remove (to_do_pane->priv->component_refs, ident);
} }
static void static void
etdp_add_component (EToDoPane *to_do_pane, etdp_add_component (EToDoPane *to_do_pane,
ECalClient *client, ECalClient *client,
ECalComponent *comp) ECalComponent *comp)
{ {
ECalComponentId *id; ECalComponentId *id;
ComponentIdent *ident; ComponentIdent *ident;
icaltimezone *default_zone; ICalTimezone *default_zone;
GSList *new_root_paths, *new_references, *link; GSList *new_root_paths, *new_references, *link;
GtkTreeModel *model; GtkTreeModel *model;
GtkTreeIter iter = { 0 }; GtkTreeIter iter = { 0 };
GdkRGBA bgcolor, fgcolor; GdkRGBA bgcolor, fgcolor;
gboolean bgcolor_set = FALSE, fgcolor_set = FALSE; gboolean bgcolor_set = FALSE, fgcolor_set = FALSE;
gchar *summary = NULL, *tooltip = NULL, *sort_key = NULL; gchar *summary = NULL, *summary_no_time = NULL, *tooltip = NULL, *sort_ke
gboolean is_task = FALSE, is_completed = FALSE; y = NULL;
gboolean is_task = FALSE, is_completed = FALSE, use_summary_no_time;
const gchar *icon_name; const gchar *icon_name;
guint date_mark = 0; guint date_mark = 0;
g_return_if_fail (E_IS_TO_DO_PANE (to_do_pane)); g_return_if_fail (E_IS_TO_DO_PANE (to_do_pane));
g_return_if_fail (E_IS_CAL_CLIENT (client)); g_return_if_fail (E_IS_CAL_CLIENT (client));
g_return_if_fail (E_IS_CAL_COMPONENT (comp)); g_return_if_fail (E_IS_CAL_COMPONENT (comp));
id = e_cal_component_get_id (comp); id = e_cal_component_get_id (comp);
g_return_if_fail (id != NULL); g_return_if_fail (id != NULL);
default_zone = e_cal_data_model_get_timezone (to_do_pane->priv->events_da ta_model); default_zone = e_cal_data_model_get_timezone (to_do_pane->priv->events_da ta_model);
if (!etdp_get_component_data (to_do_pane, client, comp, default_zone, to_ do_pane->priv->last_today, if (!etdp_get_component_data (to_do_pane, client, comp, default_zone, to_ do_pane->priv->last_today,
&summary, &tooltip, &is_task, &is_completed, &sort_key, &date_mar &summary, &summary_no_time, &tooltip, &is_task, &is_completed, &s
k)) { ort_key, &date_mark)) {
e_cal_component_free_id (id); e_cal_component_id_free (id);
return; return;
} }
model = GTK_TREE_MODEL (to_do_pane->priv->tree_store); model = GTK_TREE_MODEL (to_do_pane->priv->tree_store);
ident = component_ident_new (client, id->uid, id->rid); ident = component_ident_new (client, e_cal_component_id_get_uid (id), e_c al_component_id_get_rid (id));
new_root_paths = etdp_get_component_root_paths (to_do_pane, client, comp, default_zone); new_root_paths = etdp_get_component_root_paths (to_do_pane, client, comp, default_zone);
/* This can happen with "Show Tasks without Due date", which returns /* This can happen with "Show Tasks without Due date", which returns
basically all tasks, even with Due date in the future, out of basically all tasks, even with Due date in the future, out of
the interval used by the To Do bar. */ the interval used by the To Do bar. */
if (!new_root_paths) { if (!new_root_paths) {
etdp_remove_ident (to_do_pane, ident); etdp_remove_ident (to_do_pane, ident);
goto exit; goto exit;
} }
skipping to change at line 956 skipping to change at line 1019
ESourceRegistry *registry; ESourceRegistry *registry;
icon_name = "stock_task-assigned"; icon_name = "stock_task-assigned";
registry = e_source_registry_watcher_get_registry (to_do_ pane->priv->watcher); registry = e_source_registry_watcher_get_registry (to_do_ pane->priv->watcher);
if (itip_organizer_is_user (registry, comp, client)) { if (itip_organizer_is_user (registry, comp, client)) {
icon_name = "stock_task-assigned-to"; icon_name = "stock_task-assigned-to";
} else { } else {
GSList *attendees = NULL, *link; GSList *attendees = NULL, *link;
e_cal_component_get_attendee_list (comp, &attende es); attendees = e_cal_component_get_attendees (comp);
for (link = attendees; link; link = g_slist_next (link)) { for (link = attendees; link; link = g_slist_next (link)) {
ECalComponentAttendee *ca = link->data; ECalComponentAttendee *ca = link->data;
const gchar *text; const gchar *text;
text = itip_strip_mailto (ca->value); text = itip_strip_mailto (e_cal_component _attendee_get_value (ca));
if (itip_address_is_user (registry, text) ) { if (itip_address_is_user (registry, text) ) {
if (ca->delto != NULL) if (e_cal_component_attendee_get_ delegatedto (ca))
icon_name = "stock_task-a ssigned-to"; icon_name = "stock_task-a ssigned-to";
break; break;
} }
} }
e_cal_component_free_attendee_list (attendees); g_slist_free_full (attendees, e_cal_component_att endee_free);
} }
} else } else
icon_name = "stock_people"; icon_name = "stock_people";
} else { } else {
if (is_task) if (is_task)
icon_name = "stock_task"; icon_name = "stock_task";
else else
icon_name = "appointment-new"; icon_name = "appointment-new";
} }
etdp_get_comp_colors (to_do_pane, client, comp, &bgcolor, &bgcolor_set, & fgcolor, &fgcolor_set, etdp_get_comp_colors (to_do_pane, client, comp, &bgcolor, &bgcolor_set, & fgcolor, &fgcolor_set,
&to_do_pane->priv->nearest_due); &to_do_pane->priv->nearest_due);
use_summary_no_time = !is_task && to_do_pane->priv->last_today > date_mar
k;
for (link = new_references; link; link = g_slist_next (link)) { for (link = new_references; link; link = g_slist_next (link)) {
GtkTreeRowReference *reference = link->data; GtkTreeRowReference *reference = link->data;
if (gtk_tree_row_reference_valid (reference)) { if (gtk_tree_row_reference_valid (reference)) {
GtkTreePath *path; GtkTreePath *path;
path = gtk_tree_row_reference_get_path (reference); path = gtk_tree_row_reference_get_path (reference);
if (path && gtk_tree_model_get_iter (model, &iter, path)) { if (path && gtk_tree_model_get_iter (model, &iter, path)) {
gtk_tree_store_set (to_do_pane->priv->tree_store, &iter, gtk_tree_store_set (to_do_pane->priv->tree_store, &iter,
COLUMN_BGCOLOR, bgcolor_set ? &bgcolor : NULL, COLUMN_BGCOLOR, bgcolor_set ? &bgcolor : NULL,
COLUMN_FGCOLOR, fgcolor_set ? &fgcolor : NULL, COLUMN_FGCOLOR, fgcolor_set ? &fgcolor : NULL,
COLUMN_HAS_ICON_NAME, TRUE, COLUMN_HAS_ICON_NAME, TRUE,
COLUMN_ICON_NAME, icon_name, COLUMN_ICON_NAME, icon_name,
COLUMN_SUMMARY, summary, COLUMN_SUMMARY, (is_task || !use_summary_ no_time) ? summary : summary_no_time,
COLUMN_TOOLTIP, tooltip, COLUMN_TOOLTIP, tooltip,
COLUMN_SORTKEY, sort_key, COLUMN_SORTKEY, sort_key,
COLUMN_DATE_MARK, date_mark, COLUMN_DATE_MARK, date_mark,
COLUMN_CAL_CLIENT, client, COLUMN_CAL_CLIENT, client,
COLUMN_CAL_COMPONENT, comp, COLUMN_CAL_COMPONENT, comp,
-1); -1);
/* If an event is split between multiple days, th
en the next day should be without the start time */
if (!is_task && !use_summary_no_time)
use_summary_no_time = TRUE;
} }
gtk_tree_path_free (path); gtk_tree_path_free (path);
} }
} }
g_hash_table_insert (to_do_pane->priv->component_refs, component_ident_co py (ident), new_references); g_hash_table_insert (to_do_pane->priv->component_refs, component_ident_co py (ident), new_references);
exit: exit:
component_ident_free (ident); component_ident_free (ident);
e_cal_component_free_id (id); e_cal_component_id_free (id);
g_free (summary_no_time);
g_free (summary); g_free (summary);
g_free (tooltip); g_free (tooltip);
g_free (sort_key); g_free (sort_key);
} }
static void static void
etdp_got_client_cb (GObject *source_object, etdp_got_client_cb (GObject *source_object,
GAsyncResult *result, GAsyncResult *result,
gpointer user_data) gpointer user_data)
{ {
skipping to change at line 1398 skipping to change at line 1468
iter = next; iter = next;
} }
to_do_pane->priv->nearest_due = nearest_due; to_do_pane->priv->nearest_due = nearest_due;
} }
static void static void
etdp_check_time_changed (EToDoPane *to_do_pane, etdp_check_time_changed (EToDoPane *to_do_pane,
gboolean force_update) gboolean force_update)
{ {
icaltimetype itt; ICalTime *itt;
icaltimezone *zone; ICalTimezone *zone;
guint new_today; guint new_today;
g_return_if_fail (E_IS_TO_DO_PANE (to_do_pane)); g_return_if_fail (E_IS_TO_DO_PANE (to_do_pane));
zone = e_cal_data_model_get_timezone (to_do_pane->priv->events_data_model ); zone = e_cal_data_model_get_timezone (to_do_pane->priv->events_data_model );
itt = icaltime_current_time_with_zone (zone); itt = i_cal_time_new_current_with_zone (zone);
new_today = etdp_create_date_mark (&itt); new_today = etdp_create_date_mark (itt);
if (force_update || new_today != to_do_pane->priv->last_today) { if (force_update || new_today != to_do_pane->priv->last_today) {
gchar *tasks_filter; gchar *tasks_filter;
time_t tt_begin, tt_end; time_t tt_begin, tt_end;
gchar *iso_begin_all, *iso_begin, *iso_end; gchar *iso_begin_all, *iso_begin, *iso_end;
gint ii; gint ii;
to_do_pane->priv->last_today = new_today; to_do_pane->priv->last_today = new_today;
tt_begin = icaltime_as_timet_with_zone (itt, zone); tt_begin = i_cal_time_as_timet_with_zone (itt, zone);
tt_begin = time_day_begin_with_zone (tt_begin, zone); tt_begin = time_day_begin_with_zone (tt_begin, zone);
tt_end = time_add_week_with_zone (tt_begin, 1, zone) + (3600 * 24 ) - 1; tt_end = time_add_week_with_zone (tt_begin, 1, zone) + (3600 * 24 ) - 1;
iso_begin_all = isodate_from_time_t (0); iso_begin_all = isodate_from_time_t (0);
iso_begin = isodate_from_time_t (tt_begin); iso_begin = isodate_from_time_t (tt_begin);
iso_end = isodate_from_time_t (tt_end); iso_end = isodate_from_time_t (tt_end);
if (to_do_pane->priv->show_no_duedate_tasks) { if (to_do_pane->priv->show_no_duedate_tasks) {
if (to_do_pane->priv->show_completed_tasks) { if (to_do_pane->priv->show_completed_tasks) {
tasks_filter = g_strdup ("#t"); tasks_filter = g_strdup ("#t");
} else { } else {
skipping to change at line 1499 skipping to change at line 1569
} }
} }
path = gtk_tree_row_reference_get_path (to_do_pane->priv- >roots[ii]); path = gtk_tree_row_reference_get_path (to_do_pane->priv- >roots[ii]);
if (gtk_tree_model_get_iter (gtk_tree_row_reference_get_m odel (to_do_pane->priv->roots[ii]), &iter, path)) { if (gtk_tree_model_get_iter (gtk_tree_row_reference_get_m odel (to_do_pane->priv->roots[ii]), &iter, path)) {
struct tm tm; struct tm tm;
gchar *markup; gchar *markup;
guint date_mark; guint date_mark;
tm = icaltimetype_to_tm (&itt); tm = e_cal_util_icaltime_to_tm (itt);
icaltime_adjust (&itt, 1, 0, 0, 0); i_cal_time_adjust (itt, 1, 0, 0, 0);
date_mark = etdp_create_date_mark (&itt); date_mark = etdp_create_date_mark (itt);
if (ii == 0) { if (ii == 0) {
markup = g_markup_printf_escaped ("<b>%s< /b>", _("Today")); markup = g_markup_printf_escaped ("<b>%s< /b>", _("Today"));
} else if (ii == 1) { } else if (ii == 1) {
markup = g_markup_printf_escaped ("<b>%s< /b>", _("Tomorrow")); markup = g_markup_printf_escaped ("<b>%s< /b>", _("Tomorrow"));
} else if (ii == N_ROOTS - 1) { } else if (ii == N_ROOTS - 1) {
if (!to_do_pane->priv->show_no_duedate_ta sks) { if (!to_do_pane->priv->show_no_duedate_ta sks) {
gtk_tree_store_remove (to_do_pane ->priv->tree_store, &iter); gtk_tree_store_remove (to_do_pane ->priv->tree_store, &iter);
gtk_tree_row_reference_free (to_d o_pane->priv->roots[ii]); gtk_tree_row_reference_free (to_d o_pane->priv->roots[ii]);
to_do_pane->priv->roots[ii] = NUL L; to_do_pane->priv->roots[ii] = NUL L;
skipping to change at line 1534 skipping to change at line 1604
g_free (date); g_free (date);
} }
gtk_tree_store_set (to_do_pane->priv->tree_store, &iter, gtk_tree_store_set (to_do_pane->priv->tree_store, &iter,
COLUMN_SUMMARY, markup, COLUMN_SUMMARY, markup,
COLUMN_DATE_MARK, date_mark, COLUMN_DATE_MARK, date_mark,
-1); -1);
g_free (markup); g_free (markup);
} else { } else {
icaltime_adjust (&itt, 1, 0, 0, 0); i_cal_time_adjust (itt, 1, 0, 0, 0);
} }
gtk_tree_path_free (path); gtk_tree_path_free (path);
} }
/* Update data-model-s */ /* Update data-model-s */
e_cal_data_model_subscribe (to_do_pane->priv->events_data_model, e_cal_data_model_subscribe (to_do_pane->priv->events_data_model,
E_CAL_DATA_MODEL_SUBSCRIBER (to_do_pane), tt_begin, tt_en d); E_CAL_DATA_MODEL_SUBSCRIBER (to_do_pane), tt_begin, tt_en d);
e_cal_data_model_set_filter (to_do_pane->priv->tasks_data_model, tasks_filter); e_cal_data_model_set_filter (to_do_pane->priv->tasks_data_model, tasks_filter);
skipping to change at line 1556 skipping to change at line 1626
e_cal_data_model_subscribe (to_do_pane->priv->tasks_data_model, e_cal_data_model_subscribe (to_do_pane->priv->tasks_data_model,
E_CAL_DATA_MODEL_SUBSCRIBER (to_do_pane), 0, 0); E_CAL_DATA_MODEL_SUBSCRIBER (to_do_pane), 0, 0);
g_free (tasks_filter); g_free (tasks_filter);
g_free (iso_begin_all); g_free (iso_begin_all);
g_free (iso_begin); g_free (iso_begin);
g_free (iso_end); g_free (iso_end);
etdp_update_all (to_do_pane); etdp_update_all (to_do_pane);
} else { } else {
time_t now_tt = icaltime_as_timet_with_zone (itt, zone); time_t now_tt = i_cal_time_as_timet_with_zone (itt, zone);
if (to_do_pane->priv->nearest_due != (time_t) -1 && if (to_do_pane->priv->nearest_due != (time_t) -1 &&
to_do_pane->priv->nearest_due <= now_tt) to_do_pane->priv->nearest_due <= now_tt)
etdp_update_colors (to_do_pane, TRUE); etdp_update_colors (to_do_pane, TRUE);
} }
g_clear_object (&itt);
} }
static gboolean static gboolean
etdp_check_time_cb (gpointer user_data) etdp_check_time_cb (gpointer user_data)
{ {
EToDoPane *to_do_pane = user_data; EToDoPane *to_do_pane = user_data;
g_return_val_if_fail (E_IS_TO_DO_PANE (to_do_pane), FALSE); g_return_val_if_fail (E_IS_TO_DO_PANE (to_do_pane), FALSE);
etdp_check_time_changed (to_do_pane, FALSE); etdp_check_time_changed (to_do_pane, FALSE);
skipping to change at line 1603 skipping to change at line 1675
etdp_check_time_changed (to_do_pane, TRUE); etdp_check_time_changed (to_do_pane, TRUE);
} }
static gboolean static gboolean
etdp_settings_map_string_to_icaltimezone (GValue *value, etdp_settings_map_string_to_icaltimezone (GValue *value,
GVariant *variant, GVariant *variant,
gpointer user_data) gpointer user_data)
{ {
GSettings *settings; GSettings *settings;
const gchar *location = NULL; const gchar *location = NULL;
icaltimezone *timezone = NULL; ICalTimezone *timezone = NULL;
settings = e_util_ref_settings ("org.gnome.evolution.calendar"); settings = e_util_ref_settings ("org.gnome.evolution.calendar");
if (g_settings_get_boolean (settings, "use-system-timezone")) if (g_settings_get_boolean (settings, "use-system-timezone"))
timezone = e_cal_util_get_system_timezone (); timezone = e_cal_util_get_system_timezone ();
else else
location = g_variant_get_string (variant, NULL); location = g_variant_get_string (variant, NULL);
if (location != NULL && *location != '\0') if (location != NULL && *location != '\0')
timezone = icaltimezone_get_builtin_timezone (location); timezone = i_cal_timezone_get_builtin_timezone (location);
if (timezone == NULL) if (timezone == NULL)
timezone = icaltimezone_get_utc_timezone (); timezone = i_cal_timezone_get_utc_timezone ();
g_value_set_pointer (value, timezone); g_value_set_object (value, timezone);
g_object_unref (settings); g_object_unref (settings);
return TRUE; return TRUE;
} }
static gboolean static gboolean
etdp_settings_map_string_to_rgba (GValue *value, etdp_settings_map_string_to_rgba (GValue *value,
GVariant *variant, GVariant *variant,
gpointer user_data) gpointer user_data)
skipping to change at line 1832 skipping to change at line 1904
if (rows && gtk_tree_model_get_iter (model, &iter, rows->data)) { if (rows && gtk_tree_model_get_iter (model, &iter, rows->data)) {
GtkTreeIter parent; GtkTreeIter parent;
guint date_mark = 0; guint date_mark = 0;
while (gtk_tree_model_iter_parent (model, &parent, &iter) ) while (gtk_tree_model_iter_parent (model, &parent, &iter) )
iter = parent; iter = parent;
gtk_tree_model_get (model, &iter, COLUMN_DATE_MARK, &date _mark, -1); gtk_tree_model_get (model, &iter, COLUMN_DATE_MARK, &date _mark, -1);
if (date_mark > 0) { if (date_mark > 0) {
struct icaltimetype now; ICalTime *now;
ICalTimezone *zone;
gint time_divisions_secs; gint time_divisions_secs;
icaltimezone *zone;
time_divisions_secs = g_settings_get_int (setting s, "time-divisions") * 60; time_divisions_secs = g_settings_get_int (setting s, "time-divisions") * 60;
zone = e_cal_data_model_get_timezone (to_do_pane- >priv->events_data_model); zone = e_cal_data_model_get_timezone (to_do_pane- >priv->events_data_model);
now = icaltime_current_time_with_zone (zone); now = i_cal_time_new_current_with_zone (zone);
now.year = date_mark / 10000; i_cal_time_set_year (now, date_mark / 10000);
now.month = (date_mark / 100) % 100; i_cal_time_set_month (now, (date_mark / 100) % 10
now.day = date_mark % 100; 0);
i_cal_time_set_day (now, date_mark % 100);
/* The date_mark is the next day, not the day it belongs to */ /* The date_mark is the next day, not the day it belongs to */
icaltime_adjust (&now, -1, 0, 0, 0); i_cal_time_adjust (now, -1, 0, 0, 0);
dtstart = icaltime_as_timet_with_zone (now, zone) ; dtstart = i_cal_time_as_timet_with_zone (now, zon e);
if (dtstart > 0 && time_divisions_secs > 0) { if (dtstart > 0 && time_divisions_secs > 0) {
dtstart = dtstart + time_divisions_secs - (dtstart % time_divisions_secs); dtstart = dtstart + time_divisions_secs - (dtstart % time_divisions_secs);
dtend = dtstart + time_divisions_secs; dtend = dtstart + time_divisions_secs;
} else { } else {
dtstart = 0; dtstart = 0;
} }
g_clear_object (&now);
} }
} }
g_list_free_full (rows, (GDestroyNotify) gtk_tree_path_free); g_list_free_full (rows, (GDestroyNotify) gtk_tree_path_free);
e_cal_ops_new_event_editor (shell_window, client_source_uid, is_a ssigned, FALSE, e_cal_ops_new_event_editor (shell_window, client_source_uid, is_a ssigned, FALSE,
g_settings_get_boolean (settings, "use-default-reminder") , g_settings_get_boolean (settings, "use-default-reminder") ,
g_settings_get_int (settings, "default-reminder-interval" ), g_settings_get_int (settings, "default-reminder-interval" ),
g_settings_get_enum (settings, "default-reminder-units"), g_settings_get_enum (settings, "default-reminder-units"),
dtstart, dtend); dtstart, dtend);
skipping to change at line 1967 skipping to change at line 2041
static void static void
etdp_remove_component_thread (EAlertSinkThreadJobData *job_data, etdp_remove_component_thread (EAlertSinkThreadJobData *job_data,
gpointer user_data, gpointer user_data,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
RemoveOperationData *rod = user_data; RemoveOperationData *rod = user_data;
g_return_if_fail (rod != NULL); g_return_if_fail (rod != NULL);
e_cal_client_remove_object_sync (rod->client, rod->uid, rod->rid, rod->mo d, cancellable, error); e_cal_client_remove_object_sync (rod->client, rod->uid, rod->rid, rod->mo d, E_CAL_OPERATION_FLAG_NONE, cancellable, error);
} }
static void static void
etdp_delete_common (EToDoPane *to_do_pane, etdp_delete_common (EToDoPane *to_do_pane,
ECalObjModType mod) ECalObjModType mod)
{ {
ECalClient *client = NULL; ECalClient *client = NULL;
ECalComponent *comp = NULL; ECalComponent *comp = NULL;
g_return_if_fail (E_IS_TO_DO_PANE (to_do_pane)); g_return_if_fail (E_IS_TO_DO_PANE (to_do_pane));
skipping to change at line 1992 skipping to change at line 2066
gchar *display_name; gchar *display_name;
GCancellable *cancellable; GCancellable *cancellable;
ESource *source; ESource *source;
RemoveOperationData *rod; RemoveOperationData *rod;
ECalComponentId *id; ECalComponentId *id;
id = e_cal_component_get_id (comp); id = e_cal_component_get_id (comp);
g_return_if_fail (id != NULL); g_return_if_fail (id != NULL);
if (!e_cal_dialogs_delete_component (comp, FALSE, 1, e_cal_compon ent_get_vtype (comp), GTK_WIDGET (to_do_pane))) { if (!e_cal_dialogs_delete_component (comp, FALSE, 1, e_cal_compon ent_get_vtype (comp), GTK_WIDGET (to_do_pane))) {
e_cal_component_free_id (id); e_cal_component_id_free (id);
g_clear_object (&client); g_clear_object (&client);
g_clear_object (&comp); g_clear_object (&comp);
return; return;
} }
switch (e_cal_client_get_source_type (client)) { switch (e_cal_client_get_source_type (client)) {
case E_CAL_CLIENT_SOURCE_TYPE_EVENTS: case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
description = _("Removing an event"); description = _("Removing an event");
alert_ident = "calendar:failed-remove-event"; alert_ident = "calendar:failed-remove-event";
break; break;
skipping to change at line 2021 skipping to change at line 2095
default: default:
g_warn_if_reached (); g_warn_if_reached ();
return; return;
} }
if (!e_cal_component_is_instance (comp)) if (!e_cal_component_is_instance (comp))
mod = E_CAL_OBJ_MOD_ALL; mod = E_CAL_OBJ_MOD_ALL;
rod = g_new0 (RemoveOperationData,1); rod = g_new0 (RemoveOperationData,1);
rod->client = g_object_ref (client); rod->client = g_object_ref (client);
rod->uid = g_strdup (id->uid); rod->uid = g_strdup (e_cal_component_id_get_uid (id));
rod->rid = g_strdup (id->rid); rod->rid = g_strdup (e_cal_component_id_get_rid (id));
rod->mod = mod; rod->mod = mod;
source = e_client_get_source (E_CLIENT (client)); source = e_client_get_source (E_CLIENT (client));
display_name = e_util_get_source_full_name (e_source_registry_wat cher_get_registry (to_do_pane->priv->watcher), source); display_name = e_util_get_source_full_name (e_source_registry_wat cher_get_registry (to_do_pane->priv->watcher), source);
/* It doesn't matter which data-model is picked, because it's use d /* It doesn't matter which data-model is picked, because it's use d
only for thread creation and manipulation, not for its content . */ only for thread creation and manipulation, not for its content . */
cancellable = e_cal_data_model_submit_thread_job (to_do_pane->pri v->events_data_model, description, alert_ident, cancellable = e_cal_data_model_submit_thread_job (to_do_pane->pri v->events_data_model, description, alert_ident,
display_name, etdp_remove_component_thread, rod, remove_o peration_data_free); display_name, etdp_remove_component_thread, rod, remove_o peration_data_free);
e_cal_component_free_id (id); e_cal_component_id_free (id);
g_clear_object (&cancellable); g_clear_object (&cancellable);
g_free (display_name); g_free (display_name);
} }
g_clear_object (&client); g_clear_object (&client);
g_clear_object (&comp); g_clear_object (&comp);
} }
static void static void
etdp_delete_selected_cb (GtkMenuItem *item, etdp_delete_selected_cb (GtkMenuItem *item,
skipping to change at line 2091 skipping to change at line 2165
ECalClient *client = NULL; ECalClient *client = NULL;
ECalComponent *comp = NULL; ECalComponent *comp = NULL;
g_return_if_fail (E_IS_TO_DO_PANE (to_do_pane)); g_return_if_fail (E_IS_TO_DO_PANE (to_do_pane));
g_return_if_fail (GTK_IS_MENU (menu)); g_return_if_fail (GTK_IS_MENU (menu));
etdp_get_tree_view_selected_one (to_do_pane, &client, &comp); etdp_get_tree_view_selected_one (to_do_pane, &client, &comp);
menu_shell = GTK_MENU_SHELL (menu); menu_shell = GTK_MENU_SHELL (menu);
item = gtk_image_menu_item_new_with_mnemonic (_("New _Appointment...")); item = gtk_image_menu_item_new_with_mnemonic (_("New _Appointment"));
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item),
gtk_image_new_from_icon_name ("appointment-new", GTK_ICON_SIZE_ME NU)); gtk_image_new_from_icon_name ("appointment-new", GTK_ICON_SIZE_ME NU));
g_signal_connect (item, "activate", g_signal_connect (item, "activate",
G_CALLBACK (etdp_new_appointment_cb), to_do_pane); G_CALLBACK (etdp_new_appointment_cb), to_do_pane);
gtk_widget_show (item); gtk_widget_show (item);
gtk_menu_shell_append (menu_shell, item); gtk_menu_shell_append (menu_shell, item);
item = gtk_image_menu_item_new_with_mnemonic (_("New _Meeting...")); item = gtk_image_menu_item_new_with_mnemonic (_("New _Meeting"));
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item),
gtk_image_new_from_icon_name ("stock_people", GTK_ICON_SIZE_MENU) ); gtk_image_new_from_icon_name ("stock_people", GTK_ICON_SIZE_MENU) );
g_signal_connect (item, "activate", g_signal_connect (item, "activate",
G_CALLBACK (etdp_new_meeting_cb), to_do_pane); G_CALLBACK (etdp_new_meeting_cb), to_do_pane);
gtk_widget_show (item); gtk_widget_show (item);
gtk_menu_shell_append (menu_shell, item); gtk_menu_shell_append (menu_shell, item);
item = gtk_image_menu_item_new_with_mnemonic (_("New _Task...")); item = gtk_image_menu_item_new_with_mnemonic (_("New _Task"));
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item),
gtk_image_new_from_icon_name ("stock_task", GTK_ICON_SIZE_MENU)); gtk_image_new_from_icon_name ("stock_task", GTK_ICON_SIZE_MENU));
g_signal_connect (item, "activate", g_signal_connect (item, "activate",
G_CALLBACK (etdp_new_task_cb), to_do_pane); G_CALLBACK (etdp_new_task_cb), to_do_pane);
gtk_widget_show (item); gtk_widget_show (item);
gtk_menu_shell_append (menu_shell, item); gtk_menu_shell_append (menu_shell, item);
item = gtk_image_menu_item_new_with_mnemonic (_("_New Assigned Task...")) ; item = gtk_image_menu_item_new_with_mnemonic (_("_New Assigned Task…"));
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item),
gtk_image_new_from_icon_name ("stock_task-assigned", GTK_ICON_SIZ E_MENU)); gtk_image_new_from_icon_name ("stock_task-assigned-to", GTK_ICON_ SIZE_MENU));
g_signal_connect (item, "activate", g_signal_connect (item, "activate",
G_CALLBACK (etdp_new_assigned_task_cb), to_do_pane); G_CALLBACK (etdp_new_assigned_task_cb), to_do_pane);
gtk_widget_show (item); gtk_widget_show (item);
gtk_menu_shell_append (menu_shell, item); gtk_menu_shell_append (menu_shell, item);
if (client && comp) { if (client && comp) {
item = gtk_separator_menu_item_new (); item = gtk_separator_menu_item_new ();
gtk_widget_show (item); gtk_widget_show (item);
gtk_menu_shell_append (menu_shell, item); gtk_menu_shell_append (menu_shell, item);
item = gtk_image_menu_item_new_with_mnemonic (_("_Open...")); item = gtk_image_menu_item_new_with_mnemonic (_("_Open"));
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item),
gtk_image_new_from_icon_name ("document-open", GTK_ICON_S IZE_MENU)); gtk_image_new_from_icon_name ("document-open", GTK_ICON_S IZE_MENU));
g_signal_connect (item, "activate", g_signal_connect (item, "activate",
G_CALLBACK (etdp_open_selected_cb), to_do_pane); G_CALLBACK (etdp_open_selected_cb), to_do_pane);
gtk_widget_show (item); gtk_widget_show (item);
gtk_menu_shell_append (menu_shell, item); gtk_menu_shell_append (menu_shell, item);
item = gtk_separator_menu_item_new (); item = gtk_separator_menu_item_new ();
gtk_widget_show (item); gtk_widget_show (item);
gtk_menu_shell_append (menu_shell, item); gtk_menu_shell_append (menu_shell, item);
if (e_cal_component_get_vtype (comp) == E_CAL_COMPONENT_EVENT && if (e_cal_component_get_vtype (comp) == E_CAL_COMPONENT_EVENT &&
e_cal_component_is_instance (comp)) { e_cal_component_is_instance (comp)) {
item = gtk_image_menu_item_new_with_mnemonic (_("_Delete This Instance...")); item = gtk_image_menu_item_new_with_mnemonic (_("_Delete This Instance"));
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item) , gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item) ,
gtk_image_new_from_icon_name ("edit-delete", GTK_ ICON_SIZE_MENU)); gtk_image_new_from_icon_name ("edit-delete", GTK_ ICON_SIZE_MENU));
g_signal_connect (item, "activate", g_signal_connect (item, "activate",
G_CALLBACK (etdp_delete_selected_cb), to_do_pane) ; G_CALLBACK (etdp_delete_selected_cb), to_do_pane) ;
gtk_widget_show (item); gtk_widget_show (item);
gtk_menu_shell_append (menu_shell, item); gtk_menu_shell_append (menu_shell, item);
item = gtk_image_menu_item_new_with_mnemonic (_("D_elete All Instances...")); item = gtk_image_menu_item_new_with_mnemonic (_("D_elete All Instances"));
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item) , gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item) ,
gtk_image_new_from_icon_name ("edit-delete", GTK_ ICON_SIZE_MENU)); gtk_image_new_from_icon_name ("edit-delete", GTK_ ICON_SIZE_MENU));
g_signal_connect (item, "activate", g_signal_connect (item, "activate",
G_CALLBACK (etdp_delete_series_cb), to_do_pane); G_CALLBACK (etdp_delete_series_cb), to_do_pane);
gtk_widget_show (item); gtk_widget_show (item);
gtk_menu_shell_append (menu_shell, item); gtk_menu_shell_append (menu_shell, item);
} else { } else {
item = gtk_image_menu_item_new_with_mnemonic (_("_Delete. ..")); item = gtk_image_menu_item_new_with_mnemonic (_("_Delete"));
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item) , gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item) ,
gtk_image_new_from_icon_name ("edit-delete", GTK_ ICON_SIZE_MENU)); gtk_image_new_from_icon_name ("edit-delete", GTK_ ICON_SIZE_MENU));
g_signal_connect (item, "activate", g_signal_connect (item, "activate",
G_CALLBACK (etdp_delete_series_cb), to_do_pane); G_CALLBACK (etdp_delete_series_cb), to_do_pane);
gtk_widget_show (item); gtk_widget_show (item);
gtk_menu_shell_append (menu_shell, item); gtk_menu_shell_append (menu_shell, item);
} }
} }
g_clear_object (&client); g_clear_object (&client);
 End of changes. 164 change blocks. 
216 lines changed or deleted 296 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)