aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--calendar/ChangeLog6
-rw-r--r--calendar/gui/e-day-view.c13
2 files changed, 15 insertions, 4 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index b251dcb448..ce067b25b4 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,9 @@
+2002-07-29 JP Rosevear <jpr@ximian.com>
+
+ * gui/e-day-view.c (e_day_view_find_work_week_start): make sure
+ that the work week view goes to the current work week if the day
+ selected is before the start of the work week
+
2002-07-28 Rodrigo Moya <rodrigo@ximian.com>
* gui/dialogs/task-details-page.c: fixed mapping of popdown menu
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index c73b969731..e7f49eb6ac 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -2275,7 +2275,8 @@ e_day_view_find_work_week_start (EDayView *day_view,
time_t start_time)
{
GDate date;
- gint weekday, day, i, offset;
+ gint weekday, day, i;
+ guint offset;
struct icaltimetype tt = icaltime_null_time ();
time_to_gdate_with_zone (&date, start_time, day_view->zone);
@@ -2297,9 +2298,13 @@ e_day_view_find_work_week_start (EDayView *day_view,
}
/* Calculate how many days we need to go back to the first workday. */
- offset = (weekday + 7 - day) % 7;
-
- g_date_subtract_days (&date, offset);
+ if (weekday < day) {
+ offset = (day - weekday) % 7;
+ g_date_add_days (&date, offset);
+ } else {
+ offset = (weekday - day) % 7;
+ g_date_subtract_days (&date, offset);
+ }
tt.year = g_date_year (&date);
tt.month = g_date_month (&date);