aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--calendar/ChangeLog18
-rw-r--r--calendar/cal-util/timeutil.c24
-rw-r--r--calendar/cal-util/timeutil.h1
-rw-r--r--calendar/gui/e-day-view.c3
-rw-r--r--calendar/gui/e-week-view.c7
-rw-r--r--calendar/gui/gnome-cal.c10
6 files changed, 58 insertions, 5 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index d3656bcbc8..bab0f9bd19 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,20 @@
+2001-07-17 Federico Mena Quintero <federico@ximian.com>
+
+ Really fixes #4380. The previous fix was necessary but not
+ sufficient; it worked for me because my system timezone happens to
+ match the Evolution timezone --- if they don't match, the bug
+ would persist.
+
+ * cal-util/timeutil.c (time_to_gdate_with_zone): New function. We
+ cannot use g_date_set_time() anymore because it does not take
+ timezones into account.
+
+ * gui/gnome-cal.c (get_days_shown): Use the function above.
+
+ * gui/e-day-view.c (e_day_view_find_work_week_start): Likewise.
+
+ * gui/e-week-view.c (e_week_view_set_selected_time_range): Likewise.
+
2001-07-17 Jon Trowbridge <trow@ximian.com>
* gui/dialogs/meeting-page.c (invite_entry_changed): Print
@@ -30,6 +47,7 @@
* gui/dialogs/comp-editor-util.c (comp_editor_dates):
* gui/print.c (print_date_label): only free icaltimetype if not NULL.
+>>>>>>> 1.974
2001-07-12 Taylor Hayward <taylorhayward@yahoo.com>
* gui/goto-dialog.glade:
diff --git a/calendar/cal-util/timeutil.c b/calendar/cal-util/timeutil.c
index 3a9308c1e1..f66d851399 100644
--- a/calendar/cal-util/timeutil.c
+++ b/calendar/cal-util/timeutil.c
@@ -393,6 +393,30 @@ time_day_end_with_zone (time_t time, icaltimezone *zone)
return icaltime_as_timet_with_zone (tt, zone);
}
+/**
+ * time_to_gdate_with_zone:
+ * @date: Destination #GDate value.
+ * @time: A time value.
+ * @zone: Desired timezone for destination @date, or NULL if the UTC timezone
+ * is desired.
+ *
+ * Converts a time_t value to a #GDate structure using the specified timezone.
+ * This is analogous to g_date_set_time() but takes the timezone into account.
+ **/
+void
+time_to_gdate_with_zone (GDate *date, time_t time, icaltimezone *zone)
+{
+ struct icaltimetype tt;
+
+ g_return_if_fail (date != NULL);
+ g_return_if_fail (time != -1);
+
+ tt = icaltime_from_timet_with_zone (time, FALSE,
+ zone ? zone : icaltimezone_get_utc_timezone ());
+
+ g_date_set_dmy (date, tt.day, tt.month, tt.year);
+}
+
/**************************************************************************
* General time functions.
diff --git a/calendar/cal-util/timeutil.h b/calendar/cal-util/timeutil.h
index 3679173572..0e2795b287 100644
--- a/calendar/cal-util/timeutil.h
+++ b/calendar/cal-util/timeutil.h
@@ -116,5 +116,6 @@ time_t time_day_begin_with_zone (time_t time, icaltimezone *zone);
timezone. (The end of the day is the start of the next day.) */
time_t time_day_end_with_zone (time_t time, icaltimezone *zone);
+void time_to_gdate_with_zone (GDate *date, time_t time, icaltimezone *zone);
#endif
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index 538fede50e..bb5f4d7559 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -2154,8 +2154,11 @@ e_day_view_find_work_week_start (EDayView *day_view,
gint weekday, day, i, offset;
struct icaltimetype tt = icaltime_null_time ();
+#if 0
g_date_clear (&date, 1);
g_date_set_time (&date, start_time);
+#endif
+ time_to_gdate_with_zone (&date, start_time, day_view->zone);
/* The start of the work-week is the first working day after the
week start day. */
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index 2cf036289f..32af97d1fa 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -1205,9 +1205,11 @@ e_week_view_set_selected_time_range (EWeekView *week_view,
gboolean update_adjustment_value = FALSE;
g_return_if_fail (E_IS_WEEK_VIEW (week_view));
-
+#if 0
g_date_clear (&date, 1);
g_date_set_time (&date, start_time);
+#endif
+ time_to_gdate_with_zone (&date, start_time, week_view->zone);
if (week_view->multi_week_view) {
/* Find the number of days since the start of the month. */
@@ -1271,8 +1273,11 @@ e_week_view_set_selected_time_range (EWeekView *week_view,
week_view->zone))
week_view->selection_end_day = week_view->selection_start_day;
else {
+#if 0
g_date_clear (&end_date, 1);
g_date_set_time (&end_date, end_time - 60);
+#endif
+ time_to_gdate_with_zone (&end_date, end_time - 60, week_view->zone);
week_view->selection_end_day = g_date_julian (&end_date)
- g_date_julian (&base_date);
}
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index cf8d12bc14..7068fbe1fe 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -1692,14 +1692,16 @@ get_days_shown (GnomeCalendar *gcal, GDate *start_date, gint *days_shown)
switch (priv->current_view_type) {
case GNOME_CAL_DAY_VIEW:
- g_date_clear (start_date, 1);
- g_date_set_time (start_date, E_DAY_VIEW (priv->day_view)->lower);
+ time_to_gdate_with_zone (start_date,
+ E_DAY_VIEW (priv->day_view)->lower,
+ priv->zone);
*days_shown = e_day_view_get_days_shown (E_DAY_VIEW (priv->day_view));
break;
case GNOME_CAL_WORK_WEEK_VIEW:
- g_date_clear (start_date, 1);
- g_date_set_time (start_date, E_DAY_VIEW (priv->work_week_view)->lower);
+ time_to_gdate_with_zone (start_date,
+ E_DAY_VIEW (priv->work_week_view)->lower,
+ priv->zone);
*days_shown = e_day_view_get_days_shown (E_DAY_VIEW (priv->work_week_view));
break;