aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorKidd Wang <kiddwang@src.gnome.org>2004-05-28 12:50:38 +0800
committerKidd Wang <kiddwang@src.gnome.org>2004-05-28 12:50:38 +0800
commit80b2ded553a96ab787d327a928d4db11fb0264b2 (patch)
treee2dedcade53120cca46312577e173ea478871804 /calendar
parentcd26a513dfc3339aee4f4db74c231dedece737ab (diff)
downloadgsoc2013-evolution-80b2ded553a96ab787d327a928d4db11fb0264b2.tar.gz
gsoc2013-evolution-80b2ded553a96ab787d327a928d4db11fb0264b2.tar.zst
gsoc2013-evolution-80b2ded553a96ab787d327a928d4db11fb0264b2.zip
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
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog12
-rw-r--r--calendar/gui/e-week-view.c18
2 files changed, 21 insertions, 9 deletions
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 <kidd.wang@sun.com>
+
+ * 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 <fejj@novell.com>
Fix for bug #57818.
@@ -26,6 +32,12 @@
2004-05-26 Kidd Wang <kidd.wang@sun.com>
* 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 <kidd.wang@sun.com>
+
+ * gui/e-week-view.c: (e_week_view_event_move),
(e_week_view_change_event_time): In week view all-day events should
keep all-dayness when moved around.
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