aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorJP Rosevear <jpr@helixcode.com>2000-09-06 09:06:48 +0800
committerJP Rosevear <jpr@src.gnome.org>2000-09-06 09:06:48 +0800
commit114f5b7f916184cf8269b36a06b74b74bb7b18e2 (patch)
treeeb0fe5dcdda6dae6727c5f616e3e418cd6c9d65f /calendar
parente8648e48175c1b6d26bff5316c2c7d738245a63c (diff)
downloadgsoc2013-evolution-114f5b7f916184cf8269b36a06b74b74bb7b18e2.tar
gsoc2013-evolution-114f5b7f916184cf8269b36a06b74b74bb7b18e2.tar.gz
gsoc2013-evolution-114f5b7f916184cf8269b36a06b74b74bb7b18e2.tar.bz2
gsoc2013-evolution-114f5b7f916184cf8269b36a06b74b74bb7b18e2.tar.lz
gsoc2013-evolution-114f5b7f916184cf8269b36a06b74b74bb7b18e2.tar.xz
gsoc2013-evolution-114f5b7f916184cf8269b36a06b74b74bb7b18e2.tar.zst
gsoc2013-evolution-114f5b7f916184cf8269b36a06b74b74bb7b18e2.zip
Kill all exdates if there are no dates in the box
2000-09-05 JP Rosevear <jpr@helixcode.com> * gui/event-editor.c (dialog_to_comp_object): Kill all exdates if there are no dates in the box * cal-util/cal-recur.c (generate_instances_for_year): Add a special case for when there are exceptions but no rrules or rdates. (cal_obj_remove_exceptions): Use date only compare func (cal_obj_date_only_compare_func): New compare function that compares the date only, not the time. * gui/event-editor.c (dialog_to_comp_object): Need a break for the yearly recurrence type (dialog_to_comp_object): We need to allocate icaltimetypes for the exdate list (fill_widgets): Handle a weekly recurrence with no particular day set (dialog_to_comp_object): Kill all rrules if "None" is selected as the recurrence type by the user svn path=/trunk/; revision=5218
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog19
-rw-r--r--calendar/cal-util/cal-recur.c40
-rw-r--r--calendar/gui/event-editor.c23
3 files changed, 72 insertions, 10 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index af7e292b09..05574bd69d 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,22 @@
+2000-09-05 JP Rosevear <jpr@helixcode.com>
+
+ * gui/event-editor.c (dialog_to_comp_object): Kill all exdates if
+ there are no dates in the box
+
+ * cal-util/cal-recur.c (generate_instances_for_year): Add a special
+ case for when there are exceptions but no rrules or rdates.
+ (cal_obj_remove_exceptions): Use date only compare func
+ (cal_obj_date_only_compare_func): New compare function that
+ compares the date only, not the time.
+
+ * gui/event-editor.c (dialog_to_comp_object): Need a break for the
+ yearly recurrence type
+ (dialog_to_comp_object): We need to allocate icaltimetypes for the
+ exdate list
+ (fill_widgets): Handle a weekly recurrence with no particular day set
+ (dialog_to_comp_object): Kill all rrules if "None" is selected as
+ the recurrence type by the user
+
2000-09-06 Damon Chaplin <damon@helixcode.com>
* gui/e-calendar-table.c (e_calendar_table_open_task): uses the new
diff --git a/calendar/cal-util/cal-recur.c b/calendar/cal-util/cal-recur.c
index fd4d875d83..49bf9a9a08 100644
--- a/calendar/cal-util/cal-recur.c
+++ b/calendar/cal-util/cal-recur.c
@@ -792,6 +792,18 @@ generate_instances_for_year (CalComponent *comp,
g_array_append_val (occs, cotime);
}
+ /* Special case when there are exceptions but no recurrence rules */
+ if (occs->len == 0) {
+ CalComponentDateTime dt;
+ time_t t;
+
+ cal_component_get_dtstart (comp, &dt);
+ t = icaltime_as_timet (*dt.value);
+ cal_object_time_from_time (&cotime, t);
+
+ g_array_append_val (occs, cotime);
+ }
+
/* Expand each of the exception rules. */
for (elem = exrules; elem; elem = elem->next) {
struct icalrecurrencetype *ir;
@@ -1392,7 +1404,7 @@ cal_obj_remove_exceptions (GArray *occs,
/* Step through the exceptions until we come to one
that matches or follows this occurrence. */
while (ex_occ) {
- cmp = cal_obj_time_compare_func (ex_occ, occ);
+ cmp = cal_obj_date_only_compare_func (ex_occ, occ);
if (cmp > 0)
break;
@@ -2952,6 +2964,32 @@ cal_obj_time_compare_func (const void *arg1,
return 0;
}
+static gint
+cal_obj_date_only_compare_func (const void *arg1,
+ const void *arg2)
+{
+ CalObjTime *cotime1, *cotime2;
+
+ cotime1 = (CalObjTime*) arg1;
+ cotime2 = (CalObjTime*) arg2;
+
+ if (cotime1->year < cotime2->year)
+ return -1;
+ if (cotime1->year > cotime2->year)
+ return 1;
+
+ if (cotime1->month < cotime2->month)
+ return -1;
+ if (cotime1->month > cotime2->month)
+ return 1;
+
+ if (cotime1->day < cotime2->day)
+ return -1;
+ if (cotime1->day > cotime2->day)
+ return 1;
+
+ return 0;
+}
/* Returns the weekday of the given CalObjTime, from 0 - 6. The week start
day is Monday by default, but can be set in the recurrence rule. */
diff --git a/calendar/gui/event-editor.c b/calendar/gui/event-editor.c
index 9a398d13cb..d1742b280a 100644
--- a/calendar/gui/event-editor.c
+++ b/calendar/gui/event-editor.c
@@ -802,8 +802,8 @@ fill_widgets (EventEditor *ee)
case ICAL_SATURDAY_WEEKDAY:
e_dialog_toggle_set (priv->recurrence_rule_weekly_sat, TRUE);
break;
- default:
- g_assert_not_reached ();
+ case ICAL_NO_WEEKDAY:
+ break;
}
}
break;
@@ -1021,7 +1021,8 @@ dialog_to_comp_object (EventEditor *ee)
case ICAL_YEARLY_RECURRENCE:
recur.interval = e_dialog_spin_get_int (priv->recurrence_rule_yearly_every_n_years);
-
+ break;
+
default:
g_assert_not_reached ();
}
@@ -1047,24 +1048,28 @@ dialog_to_comp_object (EventEditor *ee)
list = NULL;
list = g_slist_append (list, &recur);
cal_component_set_rrule_list (comp, list);
+ g_slist_free (list);
+ } else {
+ list = NULL;
+ cal_component_set_rrule_list (comp, list);
}
/* Set exceptions */
list = NULL;
exception_list = GTK_CLIST (priv->recurrence_exceptions_list);
for (i = 0; i < exception_list->rows; i++) {
- struct icaltimetype tt;
+ struct icaltimetype *tt;
time_t *t;
t = gtk_clist_get_row_data (exception_list, i);
- tt = icaltime_from_timet (*t, FALSE, TRUE);
+ tt = g_new0 (struct icaltimetype, 1);
+ *tt = icaltime_from_timet (*t, FALSE, FALSE);
- list = g_slist_prepend (list, &tt);
+ list = g_slist_prepend (list, tt);
}
- if (list) {
- cal_component_set_exdate_list (comp, list);
+ cal_component_set_exdate_list (comp, list);
+ if (list)
cal_component_free_exdate_list (list);
- }
cal_component_commit_sequence (comp);
}