From 2b5b48149fc7e91286551b0ca709ce9ab49a6584 Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Tue, 30 Jul 2002 20:28:31 +0000 Subject: make sure that the work week view goes to the current work week if the day 2002-07-29 JP Rosevear * 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 svn path=/trunk/; revision=17645 --- calendar/ChangeLog | 6 ++++++ calendar/gui/e-day-view.c | 13 +++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) (limited to 'calendar') 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 + + * 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 * 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); -- cgit