diff options
-rw-r--r-- | calendar/ChangeLog | 11 | ||||
-rw-r--r-- | calendar/gui/dialogs/event-page.c | 2 | ||||
-rw-r--r-- | calendar/gui/e-meeting-time-sel-item.c | 47 |
3 files changed, 54 insertions, 6 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 1a6d88698a..cad6e38d04 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,5 +1,16 @@ 2007-08-23 Milan Crha <mcrha@redhat.com> + ** 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 <mcrha@redhat.com> + ** Fix for bug #347770 * gui/e-cal-component-memo-preview.c: (write_html): 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; |