aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/cal-util/cal-recur.c
diff options
context:
space:
mode:
authorDamon Chaplin <damon@helixcode.com>2000-12-11 10:22:06 +0800
committerDamon Chaplin <damon@src.gnome.org>2000-12-11 10:22:06 +0800
commitba28f6622636fc3932aab4a0551e2d86b69fd6e4 (patch)
tree4fa39103cd28af9eff5a79778eb22fe2c9b8a9bf /calendar/cal-util/cal-recur.c
parent50fcc2ad7d4c717aafa62195988a8362fc7a3f19 (diff)
downloadgsoc2013-evolution-ba28f6622636fc3932aab4a0551e2d86b69fd6e4.tar.gz
gsoc2013-evolution-ba28f6622636fc3932aab4a0551e2d86b69fd6e4.tar.zst
gsoc2013-evolution-ba28f6622636fc3932aab4a0551e2d86b69fd6e4.zip
added changed flags and added calls to a new function
2000-12-11 Damon Chaplin <damon@helixcode.com> * gui/event-editor.c: added changed flags and added calls to a new function event_editor_set_changed() to set & reset this flag. Added prompt_to_save_changed() which is called when the user selects File/Close or the window's close button. Fixed the 'All day event' toggle button. Made the 'Alarm' page sensitive as appropriate when filling widgets. (Though note that the alarm widgets are not being set yet.) * gui/dialogs/task-editor.c: added changed flag as above. * gui/event-editor-dialog.glade: used good names for all the classification radio buttons so we can access them in the code. * gui/event-editor.c (init_widgets): use the "show week numbers" config option in the recurrence preview calendar. * gui/e-day-view.c (e_day_view_update_event_label): use 9:00 instead of 09:00 in the main view, as we do everywhere else now. It means the times won't line up, but they are easier to read which I think is better. Added support for Page Up/Down, though I think it should move the selection rather than just scroll the canvas. * cal-util/cal-recur.c (generate_instances_for_chunk): removed the end parameter since we should be using the chunk end time now. Added single_rule parameter for when we are generating the occurrences of a single RRULE, in which case the event's start date is not included in the occurrences output (unless it results from the RRULE expansion). Both of these fix problems when using COUNT. * gui/gnome-cal.c (gnome_calendar_on_date_navigator_selection_changed): fixed bug when checking if the new start day starts on the week start day. If you select a complete week it should now show the Week view. svn path=/trunk/; revision=6896
Diffstat (limited to 'calendar/cal-util/cal-recur.c')
-rw-r--r--calendar/cal-util/cal-recur.c49
1 files changed, 33 insertions, 16 deletions
diff --git a/calendar/cal-util/cal-recur.c b/calendar/cal-util/cal-recur.c
index 99e4991323..c2d1516f28 100644
--- a/calendar/cal-util/cal-recur.c
+++ b/calendar/cal-util/cal-recur.c
@@ -260,11 +260,11 @@ static gboolean generate_instances_for_chunk (CalComponent *comp,
GSList *rdates,
GSList *exrules,
GSList *exdates,
+ gboolean single_rule,
CalObjTime *event_start,
+ time_t interval_start,
CalObjTime *chunk_start,
CalObjTime *chunk_end,
- time_t interval_start_time,
- time_t interval_end_time,
gint duration_days,
gint duration_seconds,
CalRecurInstanceFn cb,
@@ -600,7 +600,7 @@ cal_recur_generate_instances (CalComponent *comp,
* If the callback routine returns FALSE the occurrence generation stops.
*
* The use of the specific rule is for determining the end of a rule when
- * COUNT is set. The callback will count instances and store the enddata
+ * COUNT is set. The callback will count instances and store the enddate
* when COUNT is reached.
*
* Both start and end can be -1, in which case we start at the events first
@@ -621,6 +621,7 @@ cal_recur_generate_instances_of_rule (CalComponent *comp,
CalObjTime interval_start, interval_end, event_start, event_end;
CalObjTime chunk_start, chunk_end;
gint days, seconds, year;
+ gboolean single_rule;
g_return_if_fail (comp != NULL);
g_return_if_fail (cb != NULL);
@@ -662,10 +663,14 @@ cal_recur_generate_instances_of_rule (CalComponent *comp,
/* If a specific recurrence rule is being used, set up a simple list,
else get the recurrence rules from the component. */
if (prop) {
+ single_rule = TRUE;
+
elem.data = prop;
elem.next = NULL;
rrules = &elem;
} else {
+ single_rule = FALSE;
+
/* Make sure all the enddates for the rules are set. */
cal_recur_ensure_end_dates (comp, FALSE);
@@ -738,9 +743,10 @@ cal_recur_generate_instances_of_rule (CalComponent *comp,
if (!generate_instances_for_chunk (comp, dtstart_time,
rrules, rdates,
exrules, exdates,
+ single_rule,
&event_start,
+ start,
&chunk_start, &chunk_end,
- start, end,
days, seconds,
cb, cb_data))
break;
@@ -934,11 +940,11 @@ generate_instances_for_chunk (CalComponent *comp,
GSList *rdates,
GSList *exrules,
GSList *exdates,
+ gboolean single_rule,
CalObjTime *event_start,
+ time_t interval_start,
CalObjTime *chunk_start,
CalObjTime *chunk_end,
- time_t interval_start_time,
- time_t interval_end_time,
gint duration_days,
gint duration_seconds,
CalRecurInstanceFn cb,
@@ -969,13 +975,17 @@ generate_instances_for_chunk (CalComponent *comp,
rdate_periods = g_array_new (FALSE, FALSE,
sizeof (CalObjRecurrenceDate));
- /* The original DTSTART property is included in the occurrence set.
- So we add it if it is in this chunk. If it is after this chunk
- we set finished to FALSE. */
- if (cal_obj_time_compare_func (event_start, chunk_end) >= 0)
- finished = FALSE;
- else if (cal_obj_time_compare_func (event_start, chunk_start) >= 0)
- g_array_append_vals (occs, event_start, 1);
+ /* The original DTSTART property is included in the occurrence set,
+ but not if we are just generating occurrences for a single rule. */
+ if (!single_rule) {
+ /* We add it if it is in this chunk. If it is after this chunk
+ we set finished to FALSE, since we know we aren't finished
+ yet. */
+ if (cal_obj_time_compare_func (event_start, chunk_end) >= 0)
+ finished = FALSE;
+ else if (cal_obj_time_compare_func (event_start, chunk_start) >= 0)
+ g_array_append_vals (occs, event_start, 1);
+ }
/* Expand each of the recurrence rules. */
for (elem = rrules; elem; elem = elem->next) {
@@ -1102,9 +1112,14 @@ generate_instances_for_chunk (CalComponent *comp,
break;
}
+ /* Check to ensure that the start time is at or after the
+ events DTSTART time, that it is not after the end of the
+ interval we are generating instances for, and that it is
+ inside the chunk that we are currently working on. */
if (start_time < comp_dtstart
- || (interval_end_time != -1
- && start_time >= interval_end_time))
+ || start_time < interval_start
+ || cal_obj_time_compare_func (occ, chunk_start) < 0
+ || cal_obj_time_compare_func (occ, chunk_end) > 0)
continue;
if (occ->is_rdate) {
@@ -1133,7 +1148,9 @@ generate_instances_for_chunk (CalComponent *comp,
break;
}
- if (end_time <= interval_start_time)
+ /* Check that the occurrence ends after the start of the
+ current chunk. */
+ if (cal_obj_time_compare_func (occ, chunk_start) <= 0)
continue;
cb_status = (*cb) (comp, start_time, end_time, cb_data);