aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--calendar/ChangeLog9
-rw-r--r--calendar/gui/e-date-time-list.c12
2 files changed, 19 insertions, 2 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 90c885c78c..47c18e3fed 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,12 @@
+2003-07-10 Harry Lu <harry.lu@sun.com>
+
+ Fixes #46075.
+
+ * gui/e-date-time-list.c (compare_datetime): new function to compare
+ two CalComponentDateTime instances.
+ (e_date_time_list_append): check whether the date already exists
+ before adding it to the list.
+
2003-07-07 Rodrigo Moya <rodrigo@ximian.com>
Fixes #45910
diff --git a/calendar/gui/e-date-time-list.c b/calendar/gui/e-date-time-list.c
index 13bfc6df28..6a6848fc25 100644
--- a/calendar/gui/e-date-time-list.c
+++ b/calendar/gui/e-date-time-list.c
@@ -291,6 +291,12 @@ copy_datetime (const CalComponentDateTime *datetime)
return datetime_copy;
}
+static gint
+compare_datetime (const CalComponentDateTime *datetime1, const CalComponentDateTime *datetime2)
+{
+ return icaltime_compare (*datetime1->value, *datetime2->value);
+}
+
void
e_date_time_list_set_date_time (EDateTimeList *date_time_list, GtkTreeIter *iter,
const CalComponentDateTime *datetime)
@@ -311,8 +317,10 @@ e_date_time_list_append (EDateTimeList *date_time_list, GtkTreeIter *iter,
{
g_return_if_fail (datetime != NULL);
- date_time_list->list = g_list_append (date_time_list->list, copy_datetime (datetime));
- row_added (date_time_list, g_list_length (date_time_list->list) - 1);
+ if (g_list_find_custom (date_time_list->list, datetime, (GCompareFunc)compare_datetime) == NULL) {
+ date_time_list->list = g_list_append (date_time_list->list, copy_datetime (datetime));
+ row_added (date_time_list, g_list_length (date_time_list->list) - 1);
+ }
if (iter) {
iter->user_data = g_list_last (date_time_list->list);