From 4dc713c7197dd5475ef077097561710e45cf5ee0 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Thu, 23 Aug 2007 13:22:47 +0000 Subject: 2007-08-23 mcrha Fix for bug #338803 svn path=/trunk/; revision=34075 --- calendar/ChangeLog | 11 ++++++++ calendar/gui/dialogs/event-page.c | 2 ++ calendar/gui/e-meeting-time-sel-item.c | 47 +++++++++++++++++++++++++++++----- 3 files changed, 54 insertions(+), 6 deletions(-) (limited to 'calendar') diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 1a6d88698a..cad6e38d04 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,14 @@ +2007-08-23 Milan Crha + + ** Fix for bug #338803 + + * gui/e-meeting-time-sel-item.c: + (e_meeting_time_selector_item_button_press): + Keeps actual meeting duration, not reset to half/full hour. + + * gui/dialogs/event-page.c: (update_time): + Updates also duration spin buttons, not only end date/time edits. + 2007-08-23 Milan Crha ** Fix for bug #347770 diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index 54281be172..d890ac5d67 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -543,6 +543,8 @@ update_time (EventPage *epage, ECalComponentDateTime *start_date, ECalComponentD gtk_signal_handler_unblock_by_data (GTK_OBJECT (priv->start_timezone), epage); priv->sync_timezones = TRUE; + + update_end_time_selector (epage); } /* Fills the widgets with default values */ diff --git a/calendar/gui/e-meeting-time-sel-item.c b/calendar/gui/e-meeting-time-sel-item.c index 8f08164757..6d50325443 100644 --- a/calendar/gui/e-meeting-time-sel-item.c +++ b/calendar/gui/e-meeting-time-sel-item.c @@ -870,15 +870,50 @@ e_meeting_time_selector_item_button_press (EMeetingTimeSelectorItem *mts_item, /* Find the nearest half-hour or hour interval, depending on whether zoomed_out is set. */ if (!mts->all_day) { - if (mts->zoomed_out) { + gint astart_year, astart_month, astart_day, astart_hour, astart_minute; + gint aend_year, aend_month, aend_day, aend_hour, aend_minute; + int hdiff, mdiff; + GDate asdate, aedate; + + e_meeting_time_selector_get_meeting_time (mts_item->mts, + &astart_year, + &astart_month, + &astart_day, + &astart_hour, + &astart_minute, + &aend_year, + &aend_month, + &aend_day, + &aend_hour, + &aend_minute); + if (mts->zoomed_out) start_time.minute = 0; - end_time = start_time; - end_time.hour += 1; - } else { + else start_time.minute -= start_time.minute % 30; - end_time = start_time; - end_time.minute += 30; + + g_date_set_dmy (&asdate, astart_day, astart_month, astart_year); + g_date_set_dmy (&aedate, aend_day, aend_month, aend_year); + end_time = start_time; + mdiff = end_time.minute + aend_minute - astart_minute; + hdiff = end_time.hour + aend_hour - astart_hour + (24 * g_date_days_between (&asdate, &aedate)); + while (mdiff < 0) { + mdiff += 60; + hdiff -= 1; + } + while (mdiff > 60) { + mdiff -= 60; + hdiff += 1; + } + while (hdiff < 0) { + hdiff += 24; + g_date_subtract_days (end_date, 1); + } + while (hdiff >= 24) { + hdiff -= 24; + g_date_add_days (end_date, 1); } + end_time.minute = mdiff; + end_time.hour = hdiff; } else { start_time.hour = 0; start_time.minute = 0; -- cgit v1.2.3