week-grid: fix event creation on RTL languages

On RTL languages, the calcs to detect the start and end
of the new event were wrong, leading to the weird behavior
it currently has.

Fix that by correctly calculating the start and end cells
on RTL languages.

https://bugzilla.gnome.org/show_bug.cgi?id=777429
This commit is contained in:
Georges Basile Stavracas Neto
2017-03-29 00:04:10 -03:00
parent 090a79100f
commit 2f2867179d
+9 -2
View File
@@ -913,8 +913,15 @@ gcal_week_grid_button_release (GtkWidget *widget,
}
else
{
start = g_date_time_add_minutes (week_start, MAX_MINUTES - column * MINUTES_PER_DAY + minute);
end = g_date_time_add_minutes (week_start, MAX_MINUTES - column * MINUTES_PER_DAY + (end_cell + 1) * 30);
guint rtl_start_cell, rtl_end_cell, rtl_column;
/* Fix the minute */
rtl_column = 6 - column;
rtl_start_cell = start_cell + (rtl_column - column) * 48;
rtl_end_cell = (rtl_column * MINUTES_PER_DAY + minute) / 30;
start = g_date_time_add_minutes (week_start, rtl_start_cell * 30);
end = g_date_time_add_minutes (week_start, (rtl_end_cell + 1) * 30);
}
x = round ((column + 0.5) * (alloc.width / 7.0));