[evolution-data-server] Bug #499180 - BYDAY and BYMONTHDAY combination show too many entries
- From: Milan Crha <mcrha src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Bug #499180 - BYDAY and BYMONTHDAY combination show too many entries
- Date: Thu, 15 Oct 2009 14:23:44 +0000 (UTC)
commit 22af1093c9ea29f91170446518b6252e1bbdf381
Author: Milan Crha <mcrha redhat com>
Date: Thu Oct 15 16:23:09 2009 +0200
Bug #499180 - BYDAY and BYMONTHDAY combination show too many entries
calendar/libecal/e-cal-recur.c | 20 +++++++++++++++++++-
1 files changed, 19 insertions(+), 1 deletions(-)
---
diff --git a/calendar/libecal/e-cal-recur.c b/calendar/libecal/e-cal-recur.c
index 6417df7..490f7ca 100644
--- a/calendar/libecal/e-cal-recur.c
+++ b/calendar/libecal/e-cal-recur.c
@@ -1618,6 +1618,9 @@ cal_obj_generate_set_yearly (RecurData *recur_data,
/* If BYMONTHDAY & BYDAY are both set we need to expand them
in parallel and add the results. */
if (recur->bymonthday && recur->byday) {
+ CalObjTime *prev_occ = NULL;
+ GArray *new_occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime));
+
/* Copy the occs array. */
occs2 = g_array_new (FALSE, FALSE,
sizeof (CalObjTime));
@@ -1629,9 +1632,24 @@ cal_obj_generate_set_yearly (RecurData *recur_data,
occs2 = cal_obj_byday_expand_monthly (recur_data,
occs2);
- /* Add the 2 resulting arrays together. */
+ /* Add only intersection of those two arrays. */
g_array_append_vals (occs, occs2->data, occs2->len);
+ cal_obj_sort_occurrences (occs);
+ for (i = 0; i < occs->len; i++) {
+ CalObjTime *act_occ = &g_array_index (occs, CalObjTime, i);
+
+ if (prev_occ && cal_obj_time_compare_func (act_occ, prev_occ) == 0) {
+ prev_occ = NULL;
+ g_array_append_vals (new_occs, act_occ, 1);
+ } else {
+ prev_occ = act_occ;
+ }
+ }
+
+ g_array_free (occs, TRUE);
g_array_free (occs2, TRUE);
+
+ occs = new_occs;
} else {
occs = (*vtable->bymonthday_filter) (recur_data, occs);
/* Note that we explicitly call the monthly version
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]