This is another major reorganization of the Month view's
allocation code. The goal is not to reduce the number
of lines, but to make them readable and maintainable.
During this reorganization, multiple bugs that were never
hit were ironed out! That itself would be a major win, but
since the code is actually more readable, we can expect
more improvements from now on.
This removes much of the subtle complexities of the size allocation
function in month view, and finally delivers a readable and working
implementation of the month view.
This also introduces a small code refactoring, and fixes clicking
on a cell on RTL.
Multiday event handling was a mess, and still it. But this commit
makes it at least layout things correctly.
It's not perfect, though; This commit brought back that terrible
allocation cycle issue, since we're showing and hiding events in
size-allocate.
If we need to resize, then let's just accept we need to
resize the month view (event if that's an expensive
operation) and do the resizing.
This fixed many minor annoyances like invisible overflow
labels, on-the-fly text direction changes, etc.
We can potentially not have an end date set, but there's always
a start date. If there isn't, it means the user clicked from
outside of month view, or at an invalid cell, in which cases we
shouldn't display the quick add popover anyway.
Nowadays, GcalEventWidget draws the time by itself. This
makes adding a time header pretty much useless.
Fix this double information by removing the time headers
from event listboxs.
The current GcalEventWidget implementation is a direct
GtkWidget subclass, which means we have to take care of
all the implementation details such as raising GdkWindows
and managing the drawing all by ourselves.
The event widget, however, can be easily described through
a GtkBuilder file. This would simplify the implementation
and makes us maintain less code.
Fix that by making GcalEventWidget a GtkBin subclass.
The subscriber view was an unecessary layer and only
added more complication than it actually helped.
This commit merges GcalSubscriberView and GcalMonthView
into a single class.
When deleting events with recurrence, we want to hide the event
widgets according to the modification type. So that selecting
e.g. subsequent in the modification type dialog hides the event,
and the subsequent ones, truly reflecting the operation that will
happen.
Currently, however, the views don't do that, and only hide the
event that was asked to be deleted.
Fix that by passing the object modification type, and adapting the
views to take that into account.
Currently, on the year view, Saturday and Sunday are marked
as non working days by default, despite the Locale settings and the
fact that in some Countries Sunday and/or Saturday are workdays.
This patch introduces a new function "is_workday" to check
whether a day is a working day according to the territory part of
Locale.
https://bugzilla.gnome.org/show_bug.cgi?id=746927
The overflow layout displays "Other n events" when there are too much event
that a cell can accomodate.
But on rtl languages, due to the layering out of the cell, the position of the
overflow is not renderend on the mirrored date.
We fix that by mirroring the positon of the day on which the events occur so
that the events can appear on the right day.
https://bugzilla.gnome.org/show_bug.cgi?id=777427
Month view used to calculate the event's start date and end date from
the physical layout of the month and compare it with the event's
original start date and end date to see if there is a change and then
update as necessary by either slanted start or end, when either is/are
not equal to the one in the original start and end dates.
However, the way in which the start date and end date in RTL language are
calculated must be different since the layering of the days in the weeks
are opposite. Month view uses precalculated days number to mirror the
last week, which already chop off the days_delay number from cell_idx value.
In RTL, this cause issues such that the days are calculated wrongly and a
slanted start or end is visible. Because the date is not the same as the
original events date, month view thinks that the view needs an update and
so tries to update the view wrongly.
We can fix this by using the cell_idx value to calculate the days and then
substracting the days_delay value after that.
https://bugzilla.gnome.org/show_bug.cgi?id=777426