Commit Graph
3569 Commits
Author SHA1 Message Date
Georges Basile Stavracas Neto 4b6a559924 manager: Assert that cloning was successful
Cloning an ECalComponent can fail, and we need to be able to
catch these failures.

Assert that cloning was successful before procceeding with
the move.
2020-06-17 21:24:36 -03:00
Georges Basile Stavracas Neto 1bb00b8989 edit-dialog: Commit sequence after poking at component
GcalEditDialog code pre-dates GcalEvent and apply changes directly
to the underlying ECalComponent. However, it doesn't commit the
sequence after doing so, which opens the door for doom.

Commit the component sequence after changing the recurrence data.
2020-06-17 21:24:36 -03:00
Georges Basile Stavracas Neto c1ec9e734b event: Commit component more often
GcalEvent was mising many points where committing the component
is required. Commit the component more often.

https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/620
2020-06-17 21:24:36 -03:00
Georges Basile Stavracas Neto 53bc8d15a7 edit-dialog: Fake a cancel response when moving
When moving an event to another calendar, the GcalEvent instance
that is being held by GcalEditDialog is not valid one. On the other
hand, moving an event shouldn't trigger an update either.

For now, simply fake a GTK_RESPONSE_CANCEL. In the future, it'll
be better to move most of the GcalWindow code to GcalEventDialog
itself.
2020-06-17 21:24:36 -03:00
Georges Basile Stavracas Neto d5ed8626ca edit-dialog: Factor out update code to a separate function
To simplify readability of the response function, move some of
its code to an auxiliary function.
2020-06-17 21:24:36 -03:00
Douglas Fuller a9e74b7966 week-header: Clone and modify new event when dropping
Update week-header to use the same clone strategy used by month-cell
2020-06-15 20:05:14 -04:00
Douglas Fuller 1ce21be23a week-header: trivial cleanup 2020-06-15 20:04:41 -04:00
Douglas Fuller 2cb26a4399 week-grid: Clone and modify new event when dropping
Update week-grid to use the same clone strategy used by month-cell

Fixes #607
2020-06-15 20:01:56 -04:00
Douglas Fuller c7161543b2 week-grid: trivial cleanup 2020-06-15 19:59:19 -04:00
Evangelos Ribeiro Tzaras 07f544b78d gcal-date-time-utils: Fix week start
In locales where the first weekday is a monday, the previous code
had a off by one error determining the week a sunday is in.
The problem ultimately arose because in the
`gcal_date_time_get_start_of_week()` function the variable
`n_days_after_week_start` would become negative (-1 in this case) making
the following `g_date_time_add_days (date, -n_days_after_week_start)`
add 1 day resulting in `start_of_week` being set to the start of the
following week.

The solution was to make sure `n_days_after_week_start` would be
positive by adding 7 to it. The variable is taken modulo 7 hence this
should not introduce any bugs.

Fixes #583
2020-06-15 20:43:55 +02:00
Georges Basile Stavracas Neto 4b1e303448 year-view: Clone and modify new event when dropping
Pretty much the same rationale and implementation of the previous
commit.
2020-06-15 13:32:02 -03:00
Georges Basile Stavracas Neto ed7121c995 month-cell: Clone and modify new event when dropping
Instead of modifying the original event, create a new event
from it and modify this new event instead. After updating it
through gcal_manager_update_event(), GcalMonthView will remove
the old instance and add the new one anyway.
2020-06-15 13:26:51 -03:00
Georges Basile Stavracas Neto cab7d5907f month-cell: Instrument drop function
It's useful for debugging DnD.
2020-06-15 13:26:12 -03:00
Georges Basile Stavracas Neto 8243e0b8ed edit-dialog: Edit cloned event
Edit a cloned event instead of the actual event, so that it
can preserve the original event's integrity. This allows for
a major edit dialog cleanup in the future.
2020-06-15 13:19:38 -03:00
Georges Basile Stavracas Neto dbd81f401c event: Add API to clone events
This will be useful for updating events without having
to keep track of the event states.

Add the new API, and also a unit test.
2020-06-15 13:07:48 -03:00
Georges Basile Stavracas Neto d18441204f tests: Trivial cleanup 2020-06-15 13:07:37 -03:00
Matej Urbančič 0e34e0c7b3 Updated Slovenian translation 2020-06-05 09:14:42 +02:00
Matej Urbančič 3fce38238e Updated Slovenian translation 2020-06-01 22:06:47 +02:00
Douglas Fuller 2f6aae7f21 week-grid: Convert event timezones to local on allocation
When inserting events into the display grid, use local start and end
times.

Fixes #599
2020-05-12 11:38:18 -04:00
Carmen Bianca BAKKER f24ca1ea15 Update Esperanto translation 2020-05-09 09:02:14 +00:00
Cheng-Chia Tseng deda606bd9 Update Chinese (Taiwan) translation 2020-05-01 16:20:45 +00:00
Dz Chen 2c4e2cb00c Update Chinese (China) translation 2020-04-18 09:25:21 +00:00
Georges Basile Stavracas Neto e5986a05c1 calendar-monitor: Use inclusive end date for ECalClientView
May prevent a few events from being transmitted.
2020-04-16 16:31:36 -03:00
Georges Basile Stavracas Neto 0c510d6709 month-view: Ignore events outside current range
The month view looks specially awful when switching between
dates, since it doesn't implicitly filter the ranges it's
displaying.

Ignore events outside the current month range, since they'll
be removed anyway by the timeline.
2020-04-16 16:16:49 -03:00
Georges Basile Stavracas Neto d2da70fb28 range: Properly compare ranges
The behavior of gcal_range_compare(), and the 'position' argument
of gcal_range_calculate_overlap(), should be the same. However,
because we were comparing the end dates in the wrong order, they
didn't match.

Fix that by properly comparing the end of the ranges.
2020-04-16 16:15:34 -03:00
Georges Basile Stavracas Neto a790f30176 timeline: Add sentinel events to the queue
Moving to have one subscriber per event made us face an interesting
problem: when removing an event, there may be no subscribers that
contain this event, in which case we never queue any REMOVE_EVENT
and the range tree isn't updated.

Add sentinel events (that update the range tree) and subscriber events
(that update subscribers, but not the range tree).
2020-04-16 16:10:33 -03:00
Georges Basile Stavracas Neto 494bd187d8 timeline: Cancel additions and removals
When we add an event to the queue, and later remove it, if the
event is still in the queue, we can just cancel both out and
save the timeline some processing time.
2020-04-16 15:11:53 -03:00
Georges Basile Stavracas Neto 61815ddccf timeline: Trivial code cleanup 2020-04-16 13:47:09 -03:00
Georges Basile Stavracas Neto 381ae0046a timeline: Protect against NULL arrays 2020-04-15 20:49:47 -03:00
Georges Basile Stavracas Neto 3073b6b6d8 timeline: Also queue remove events 2020-04-15 20:35:17 -03:00
Georges Basile Stavracas Neto b5cdc0bd38 timeline: Only diff when ranges intersect
When the old and the new range of the subscribers don't
overlap entirely, we can't use the regular diff algorithm.
It fails quite spectacularly.

Do a full cleanup when ranges don't overlap.
2020-04-15 20:35:04 -03:00
Georges Basile Stavracas Neto a1a4804315 timeline: Only modify event tree once
Now that we queue one event per subscriber, we need to
make sure to update the range tree only once.
2020-04-15 19:16:00 -03:00
Georges Basile Stavracas Neto 678d0acc00 timeline: Remove subscriber from range tree as well
update_range() does not remove any subscriber. They must be
removed manually.
2020-04-15 18:49:36 -03:00
Georges Basile Stavracas Neto e9812b2f28 timeline: Don't try to use removed subscribers
Because the timeline is essentially asynchronous, it may
try and process events after their subscribers were removed.

Protect against that.

Fixes https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/576
2020-04-15 18:49:36 -03:00
Georges Basile Stavracas Neto db668a0b90 timeline: Queue one event per subscriber
Right now, GcalTimeline queues one event per N subscribers. Queue
one event per subscriber instead.
2020-04-15 18:49:36 -03:00
Michael Catanzaro 60c3c26ad6 timeline: fix leak of timeline source
g_source_destroy doesn't free memory, just removes the source from its
main context. We have to do both. (g_source_unref() might call
g_source_destroy() if it has the last ref, but if something else has
another ref, then disaster could result if we don't call it manually.)
2020-04-15 21:18:16 +00:00
Clarissa Borges f1d20126dc event: Add more range test cases
More examples of possible dates for events were added to the test cases.
Superset, subset, intersection and no overlap cases are covered.
2020-04-14 17:56:12 -03:00
Michael Catanzaro a3e9af23dc source-discoverer: add support for webcal:// URIs
We can implement webcal:// by simply rewriting the URI to https://.
Amazing!

Fixes #564
2020-04-14 15:16:24 -05:00
Georges Basile Stavracas Neto 98e6ac28e7 event: Remove unused method
Comparing ranges is so easy now that we don't need this
helper anymore.
2020-04-14 19:08:06 +00:00
Georges Basile Stavracas Neto fd32492053 timeline, calendar-monitor: Remove useless event range checks
GcalRange is now smart enough to compare correctly with other ranges.
2020-04-14 19:08:06 +00:00
Georges Basile Stavracas Neto d4a6cd0e61 timeline: Process events in batches
A batch size of 5 doesn't seem to impact the mainloop
any more than a batch of size 1, but it reduces the
amount of time spinning the loop quite considerably.
2020-04-14 19:08:06 +00:00
Georges Basile Stavracas Neto 16c156914a calendar-monitor: Use GcalRange 2020-04-14 19:08:06 +00:00
Georges Basile Stavracas Neto f3c3bbf5ab event: Use GcalRange in public API 2020-04-14 19:08:06 +00:00
Georges Basile Stavracas Neto 12fd607d56 utils: Make date comparison follow time comparison semantics
Right now, comparing dates with gcal_date_time_compare_date() gives
the exact opposite result of when comparing using g_date_time_compare().

As shown by this patch, this was a source of *many* bugs.
2020-04-14 19:08:06 +00:00
Georges Basile Stavracas Neto bed8e10609 range-tree: Add print utility
Useful for debugging
2020-04-14 19:08:05 +00:00
Georges Basile Stavracas Neto 3efbc2436c range-tree: Use GcalRange 2020-04-14 19:08:05 +00:00
Georges Basile Stavracas Neto b97c4a27e0 range-tree: Cleanup header 2020-04-14 19:08:05 +00:00
Georges Basile Stavracas Neto 923e3b7b71 project: Move range tree to core/ 2020-04-14 19:08:05 +00:00
Georges Basile Stavracas Neto 0935a67558 event: Add helper API to return a GcalRange 2020-04-14 19:08:05 +00:00
Georges Basile Stavracas Neto d9733aee27 event: Simplify some code 2020-04-14 19:08:05 +00:00