From 80b2ded553a96ab787d327a928d4db11fb0264b2 Mon Sep 17 00:00:00 2001 From: Kidd Wang Date: Fri, 28 May 2004 04:50:38 +0000 Subject: a more straightforward way to calculate the offset of a day within the * gui/e-week-view.c: (e_week_view_event_move), (e_week_view_get_day_offset_of_event): a more straightforward way to calculate the offset of a day within the week. svn path=/trunk/; revision=26118 --- calendar/ChangeLog | 12 ++++++++++++ calendar/gui/e-week-view.c | 18 +++++++++--------- 2 files changed, 21 insertions(+), 9 deletions(-) (limited to 'calendar') diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 424d1bc81e..dc44a15e54 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,9 @@ +2004-05-28 Kidd Wang + + * gui/e-week-view.c: (e_week_view_event_move), + (e_week_view_get_day_offset_of_event): a more straightforward way + to calculate the offset of a day within the week. + 2004-05-26 Jeffrey Stedfast Fix for bug #57818. @@ -23,6 +29,12 @@ * gui/gnome-cal.c (gnome_calendar_remove_source_by_uid): remove all queries we've got for the removed source. +2004-05-26 Kidd Wang + + * gui/e-week-view.c: (e_week_view_event_move), + (e_week_view_get_day_offset_of_event): a more straightforward way + to calculate the offset of a day within the week. + 2004-05-26 Kidd Wang * gui/e-week-view.c: (e_week_view_event_move), diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index b52d155c66..734d66be8a 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -3174,12 +3174,14 @@ static gboolean e_week_view_event_move (ECalendarView *cal_view, ECalViewMoveDir current_start_day = e_week_view_get_day_offset_of_event (week_view,start_dt); current_end_day = e_week_view_get_day_offset_of_event (week_view,end_dt); + if (is_all_day) + current_end_day--; if (current_start_day < 0) { return TRUE; } if (week_view->multi_week_view) { - if (current_end_day > week_view->weeks_shown * 7) { + if (current_end_day >= week_view->weeks_shown * 7) { return TRUE; } }else { @@ -3195,14 +3197,12 @@ static gboolean e_week_view_event_move (ECalendarView *cal_view, ECalViewMoveDir static gint e_week_view_get_day_offset_of_event (EWeekView *week_view, time_t event_time) { - struct tm first_day_shown_tm = {0}; - struct tm *event_time_tm; - - event_time_tm = NULL; - - g_date_to_struct_tm (&(week_view->first_day_shown), &first_day_shown_tm); - event_time_tm = gmtime (&event_time); - return (event_time_tm->tm_yday - first_day_shown_tm.tm_yday); + time_t first_day = week_view->day_starts[0]; + + if (event_time - first_day < 0) + return -1; + else + return (event_time - first_day) / (24 * 60 * 60); } static void -- cgit v1.2.3