aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/cal-util
diff options
context:
space:
mode:
authorDamon Chaplin <damon@helixcode.com>2001-01-18 02:45:40 +0800
committerDamon Chaplin <damon@src.gnome.org>2001-01-18 02:45:40 +0800
commit08ea9ff68d9b544242dfe7f0f4409e90f2f24ebd (patch)
tree511f5630856246bf8fa2a917b5d51dd11bf5240b /calendar/cal-util
parent60d8fc824908c3522765003de4ef821005c415ff (diff)
downloadgsoc2013-evolution-08ea9ff68d9b544242dfe7f0f4409e90f2f24ebd.tar.gz
gsoc2013-evolution-08ea9ff68d9b544242dfe7f0f4409e90f2f24ebd.tar.zst
gsoc2013-evolution-08ea9ff68d9b544242dfe7f0f4409e90f2f24ebd.zip
gui/e-week-view*.c don't use the theme colors at all within the graphical
2001-01-17 Damon Chaplin <damon@helixcode.com> * gui/e-week-view*.c * gui/e-day-view*.c: don't use the theme colors at all within the graphical parts of the widgets, since they may clash with our colors. May make them configurable in future so people can tweak them to go with their theme. At least the calendars are usable in any theme now, even though the colors may not go well with the theme. Also set the font of all the EText items in style_set. * gui/e-week-view-event-item.c (e_week_view_event_item_draw): don't draw the icons if we are editing the event. * gui/e-day-view.c: * gui/e-week-view.c: reinstated the optimizations so we don't do a complete relayout if the event's dates haven't been changed. (Though we still do a re-layout when recurring events change, since comparing all the RDATES/RRULES/EXDATES/EXRULES is too much hassle.) A side-effect of this change is that the EWeekView won't crash so often - only recurring events will be a problem. * cal-util/cal-component.[hc]: added function to check if the start and end dates of a component match. Used for optimizing the updating of the EDayView & EWeekView. svn path=/trunk/; revision=7593
Diffstat (limited to 'calendar/cal-util')
-rw-r--r--calendar/cal-util/cal-component.c73
-rw-r--r--calendar/cal-util/cal-component.h2
2 files changed, 75 insertions, 0 deletions
diff --git a/calendar/cal-util/cal-component.c b/calendar/cal-util/cal-component.c
index 2c01991a90..daf50600c8 100644
--- a/calendar/cal-util/cal-component.c
+++ b/calendar/cal-util/cal-component.c
@@ -3890,3 +3890,76 @@ cal_component_alarm_set_trigger (CalComponentAlarm *alarm, CalAlarmTrigger trigg
}
}
}
+
+
+/**
+ * cal_component_event_dates_match:
+ * @comp1: A calendar component object.
+ * @comp2: A calendar component object.
+ *
+ * Checks if the DTSTART and DTEND properties of the 2 components match.
+ * Note that the events may have different recurrence properties which are not
+ * taken into account here.
+ *
+ * Returns: TRUE if the DTSTART and DTEND properties of the 2 components match.
+ **/
+gboolean
+cal_component_event_dates_match (CalComponent *comp1,
+ CalComponent *comp2)
+{
+ CalComponentDateTime comp1_dtstart, comp1_dtend;
+ CalComponentDateTime comp2_dtstart, comp2_dtend;
+
+ cal_component_get_dtstart (comp1, &comp1_dtstart);
+ cal_component_get_dtend (comp1, &comp1_dtend);
+ cal_component_get_dtstart (comp2, &comp2_dtstart);
+ cal_component_get_dtend (comp2, &comp2_dtend);
+
+ /* If either value is NULL they must both be NULL to match. */
+ if (comp1_dtstart.value == NULL || comp2_dtstart.value == NULL) {
+ if (comp1_dtstart.value != comp2_dtstart.value)
+ return FALSE;
+ } else {
+ if (icaltime_compare (*comp1_dtstart.value,
+ *comp2_dtstart.value))
+ return FALSE;
+ }
+
+ if (comp1_dtend.value == NULL || comp2_dtend.value == NULL) {
+ if (comp1_dtend.value != comp2_dtend.value)
+ return FALSE;
+ } else {
+ if (icaltime_compare (*comp1_dtend.value,
+ *comp2_dtend.value))
+ return FALSE;
+ }
+
+ /* Now check the timezones. */
+ if (!cal_component_strings_match (comp1_dtstart.tzid,
+ comp2_dtstart.tzid))
+ return FALSE;
+
+ if (!cal_component_strings_match (comp1_dtend.tzid,
+ comp2_dtend.tzid))
+ return FALSE;
+
+ return TRUE;
+}
+
+
+/* Returns TRUE if both strings match, i.e. they are both NULL or the
+ strings are equal. */
+static gboolean
+cal_component_strings_match (const gchar *string1,
+ const gchar *string2)
+{
+ if (string1 == NULL || string2 == NULL)
+ return (string1 == string2) ? TRUE : FALSE;
+
+ if (!strcmp (string1, string2))
+ return TRUE;
+
+ return FALSE;
+}
+
+
diff --git a/calendar/cal-util/cal-component.h b/calendar/cal-util/cal-component.h
index 7f77544467..b7d8b602e9 100644
--- a/calendar/cal-util/cal-component.h
+++ b/calendar/cal-util/cal-component.h
@@ -255,6 +255,8 @@ void cal_component_set_transparency (CalComponent *comp, CalComponentTransparenc
void cal_component_get_url (CalComponent *comp, const char **url);
void cal_component_set_url (CalComponent *comp, const char *url);
+gboolean cal_component_event_dates_match (CalComponent *comp1, CalComponent *comp2);
+
/* Functions to free returned values */
void cal_component_free_categories_list (GSList *categ_list);