aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/e-meeting-time-sel-item.c
diff options
context:
space:
mode:
authorMilan Crha <mcrha@src.gnome.org>2007-08-23 21:22:47 +0800
committerMilan Crha <mcrha@src.gnome.org>2007-08-23 21:22:47 +0800
commit4dc713c7197dd5475ef077097561710e45cf5ee0 (patch)
tree9c941249e73780c81f3bcd34990379d9ea3de23a /calendar/gui/e-meeting-time-sel-item.c
parent074e36bd418c9d9b1a7876b6048b156592c72467 (diff)
downloadgsoc2013-evolution-4dc713c7197dd5475ef077097561710e45cf5ee0.tar
gsoc2013-evolution-4dc713c7197dd5475ef077097561710e45cf5ee0.tar.gz
gsoc2013-evolution-4dc713c7197dd5475ef077097561710e45cf5ee0.tar.bz2
gsoc2013-evolution-4dc713c7197dd5475ef077097561710e45cf5ee0.tar.lz
gsoc2013-evolution-4dc713c7197dd5475ef077097561710e45cf5ee0.tar.xz
gsoc2013-evolution-4dc713c7197dd5475ef077097561710e45cf5ee0.tar.zst
gsoc2013-evolution-4dc713c7197dd5475ef077097561710e45cf5ee0.zip
2007-08-23 mcrha Fix for bug #338803
svn path=/trunk/; revision=34075
Diffstat (limited to 'calendar/gui/e-meeting-time-sel-item.c')
-rw-r--r--calendar/gui/e-meeting-time-sel-item.c47
1 files changed, 41 insertions, 6 deletions
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;