aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorJP Rosevear <jpr@ximian.com>2002-07-31 04:28:31 +0800
committerJP Rosevear <jpr@src.gnome.org>2002-07-31 04:28:31 +0800
commit2b5b48149fc7e91286551b0ca709ce9ab49a6584 (patch)
tree220470c11e61f88c3aad540f0cd9422d66d94951 /calendar
parent57f5c9b58bb01ec1d30b3e6daf311c9dc009f546 (diff)
downloadgsoc2013-evolution-2b5b48149fc7e91286551b0ca709ce9ab49a6584.tar
gsoc2013-evolution-2b5b48149fc7e91286551b0ca709ce9ab49a6584.tar.gz
gsoc2013-evolution-2b5b48149fc7e91286551b0ca709ce9ab49a6584.tar.bz2
gsoc2013-evolution-2b5b48149fc7e91286551b0ca709ce9ab49a6584.tar.lz
gsoc2013-evolution-2b5b48149fc7e91286551b0ca709ce9ab49a6584.tar.xz
gsoc2013-evolution-2b5b48149fc7e91286551b0ca709ce9ab49a6584.tar.zst
gsoc2013-evolution-2b5b48149fc7e91286551b0ca709ce9ab49a6584.zip
make sure that the work week view goes to the current work week if the day
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 svn path=/trunk/; revision=17645
Diffstat (limited to 'calendar')
-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);