[gnome-calendar] window: fix new event action
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] window: fix new event action
- Date: Tue, 16 Feb 2016 20:26:42 +0000 (UTC)
commit bfe18b00df0f0c4bffb5d5730e53a37d8533c555
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Tue Feb 16 17:53:16 2016 -0200
window: fix new event action
src/gcal-window.c | 19 +++++++++----------
1 files changed, 9 insertions(+), 10 deletions(-)
---
diff --git a/src/gcal-window.c b/src/gcal-window.c
index a705790..9bcdf49 100644
--- a/src/gcal-window.c
+++ b/src/gcal-window.c
@@ -1569,29 +1569,28 @@ gcal_window_new_with_view_and_date (GcalApplication *app,
void
gcal_window_new_event (GcalWindow *window)
{
- icaltimetype *start_date, *end_date;
+ GDateTime *start_date, *end_date;
+ icaltimetype date;
/* 1st and 2nd steps */
set_new_event_mode (window, TRUE);
- start_date = gcal_dup_icaltime (window->current_date);
- start_date->is_date = 1;
- end_date = gcal_dup_icaltime (window->current_date);
- end_date->is_date = 1;
+ date = *window->current_date;
+ date.is_date = 1;
+
+ start_date = icaltime_to_datetime (&date);
+ end_date = icaltime_to_datetime (&date);
/* adjusting dates according to the actual view */
switch (window->active_view)
{
case GCAL_WINDOW_VIEW_DAY:
case GCAL_WINDOW_VIEW_WEEK:
- end_date->hour += 1;
- *end_date = icaltime_normalize (*end_date);
+ end_date = g_date_time_add_hours (start_date, 1);
break;
case GCAL_WINDOW_VIEW_MONTH:
case GCAL_WINDOW_VIEW_YEAR:
- end_date->day += 1;
- end_date->is_date = 1;
- *end_date = icaltime_normalize (*end_date);
+ end_date = g_date_time_add_days (start_date, 1);
break;
case GCAL_WINDOW_VIEW_LIST:
case GCAL_WINDOW_VIEW_SEARCH:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]