month-view: fix end-of-month multi-day selections

Use g_date_time_add_days to add a day to the final day of the month to
fix behaviour when selecting a range up to the last day of the month.

https://bugzilla.gnome.org/show_bug.cgi?id=763015
This commit is contained in:
fosero
2016-03-14 16:54:54 -03:00
committed by Georges Basile Stavracas Neto
parent 2ac228a9b8
commit 96d2b37fec
+8 -1
View File
@@ -282,7 +282,14 @@ show_popover_for_position (GcalMonthView *view,
/* Only setup an end date when days are different */
if (start_day != end_day)
end_dt = g_date_time_new_local (priv->date->year, priv->date->month, end_day + 1, 0, 0, 0);
{
GDateTime *tmp_dt;
tmp_dt = g_date_time_new_local (priv->date->year, priv->date->month, end_day, 0, 0, 0);
end_dt = g_date_time_add_days (tmp_dt, 1);
g_clear_pointer (&tmp_dt, g_date_time_unref);
}
g_signal_emit_by_name (GCAL_VIEW (widget), "create-event", start_dt, end_dt, x, y);