[evolution] Bug #661549 - Avoid fetching from backend when calculating summary
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Bug #661549 - Avoid fetching from backend when calculating summary
- Date: Tue, 18 Oct 2011 11:09:11 +0000 (UTC)
commit 78acd3814028630271d64896aeb7b16c59eb1aac
Author: Milan Crha <mcrha redhat com>
Date: Tue Oct 18 13:08:51 2011 +0200
Bug #661549 - Avoid fetching from backend when calculating summary
calendar/gui/e-calendar-view.c | 40 ++++++++++++++++++++++++----------------
1 files changed, 24 insertions(+), 16 deletions(-)
---
diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c
index 0da5afc..e2ecfc1 100644
--- a/calendar/gui/e-calendar-view.c
+++ b/calendar/gui/e-calendar-view.c
@@ -2066,23 +2066,31 @@ e_calendar_view_get_icalcomponent_summary (ECalClient *client,
if (icalcomp_contains_category (icalcomp, _("Birthday")) ||
icalcomp_contains_category (icalcomp, _("Anniversary"))) {
- struct icaltimetype dtstart, dtnow;
- icalcomponent *item_icalcomp = NULL;
-
- if (e_cal_client_get_object_sync (client,
- icalcomponent_get_uid (icalcomp),
- icalcomponent_get_relcalid (icalcomp),
- &item_icalcomp,
- NULL, NULL)) {
- dtstart = icalcomponent_get_dtstart (item_icalcomp);
- dtnow = icalcomponent_get_dtstart (icalcomp);
-
- if (dtnow.year - dtstart.year > 0) {
- summary = g_strdup_printf ("%s (%d)", summary ? summary : "", dtnow.year - dtstart.year);
- *free_text = summary != NULL;
- }
+ icalproperty *xprop;
+
+ for (xprop = icalcomponent_get_first_property (icalcomp, ICAL_X_PROPERTY);
+ xprop;
+ xprop = icalcomponent_get_next_property (icalcomp, ICAL_X_PROPERTY)) {
+ const gchar *xname = icalproperty_get_x_name (xprop);
+
+ if (xname && g_ascii_strcasecmp (xname, "X-EVOLUTION-SINCE-YEAR") == 0) {
+ struct icaltimetype dtnow;
+ gint since_year;
+ gchar *str;
+
+ str = icalproperty_get_value_as_string_r (xprop);
+ since_year = str ? atoi (str) : 0;
+ g_free (str);
- icalcomponent_free (item_icalcomp);
+ dtnow = icalcomponent_get_dtstart (icalcomp);
+
+ if (since_year > 0 && dtnow.year - since_year > 0) {
+ summary = g_strdup_printf ("%s (%d)", summary ? summary : "", dtnow.year - since_year);
+ *free_text = summary != NULL;
+ }
+
+ break;
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]