[gnome-calendar/gnome-3-24] week-header: fix dnd at first column
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar/gnome-3-24] week-header: fix dnd at first column
- Date: Thu, 23 Mar 2017 02:02:04 +0000 (UTC)
commit bd0643ce188fc3e44bd9e2674a39e9bd0981d744
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Fri Mar 17 16:38:59 2017 -0300
week-header: fix dnd at first column
src/views/gcal-week-header.c | 16 +++++++++++-----
1 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/src/views/gcal-week-header.c b/src/views/gcal-week-header.c
index 4278516..5919c39 100644
--- a/src/views/gcal-week-header.c
+++ b/src/views/gcal-week-header.c
@@ -1388,6 +1388,7 @@ gcal_week_header_drag_drop (GtkWidget *widget,
GDateTime *end_date;
GtkWidget *event_widget;
GcalEvent *event;
+ gboolean turn_all_day;
gboolean ltr;
gint drop_cell;
@@ -1412,7 +1413,9 @@ gcal_week_header_drag_drop (GtkWidget *widget,
end_date = gcal_event_get_date_end (event);
week_start = get_start_of_week (self->active_date);
- if (gcal_event_is_multiday (event) && !gcal_event_get_all_day (event))
+ turn_all_day = !gcal_event_is_multiday (event) || gcal_event_get_all_day (event);
+
+ if (!turn_all_day)
{
/*
* The only case where we don't touch the timezone is for
@@ -1432,8 +1435,6 @@ gcal_week_header_drag_drop (GtkWidget *widget,
g_date_time_get_month (week_start),
g_date_time_get_day_of_month (week_start) + drop_cell,
0, 0, 0);
-
- gcal_event_set_all_day (event, TRUE);
}
/* Since the event may have a NULL end date, so we have to check it here */
@@ -1442,8 +1443,10 @@ gcal_week_header_drag_drop (GtkWidget *widget,
g_autoptr (GDateTime) new_end;
GTimeSpan difference;
- difference = g_date_time_difference (end_date, start_date);
- difference /= G_TIME_SPAN_HOUR;
+ if (turn_all_day)
+ difference = 24;
+ else
+ difference = g_date_time_difference (end_date, start_date) / G_TIME_SPAN_HOUR;
new_end = g_date_time_add_hours (dnd_date, difference);
gcal_event_set_date_end (event, new_end);
@@ -1455,6 +1458,9 @@ gcal_week_header_drag_drop (GtkWidget *widget,
*/
gcal_event_set_date_start (event, dnd_date);
+ if (turn_all_day)
+ gcal_event_set_all_day (event, TRUE);
+
/* Commit the changes */
gcal_manager_update_event (self->manager, event);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]