diff options
author | Milan Crha <mcrha@redhat.com> | 2011-10-18 19:08:51 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2011-10-18 19:08:51 +0800 |
commit | 78acd3814028630271d64896aeb7b16c59eb1aac (patch) | |
tree | 5521051cbcffcdcc3956ed5ecbc0245dcd624c71 | |
parent | a6830da67d0af30d44774879df1a9b06bf23641d (diff) | |
download | gsoc2013-evolution-78acd3814028630271d64896aeb7b16c59eb1aac.tar gsoc2013-evolution-78acd3814028630271d64896aeb7b16c59eb1aac.tar.gz gsoc2013-evolution-78acd3814028630271d64896aeb7b16c59eb1aac.tar.bz2 gsoc2013-evolution-78acd3814028630271d64896aeb7b16c59eb1aac.tar.lz gsoc2013-evolution-78acd3814028630271d64896aeb7b16c59eb1aac.tar.xz gsoc2013-evolution-78acd3814028630271d64896aeb7b16c59eb1aac.tar.zst gsoc2013-evolution-78acd3814028630271d64896aeb7b16c59eb1aac.zip |
Bug #661549 - Avoid fetching from backend when calculating summary
-rw-r--r-- | 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 0da5afc618..e2ecfc10ae 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; + } } } |