Commit Graph
3519 Commits
Author SHA1 Message Date
Georges Basile Stavracas Neto dbfebc85fa Introduce GcalRange
GcalRange is a new structure that represents a time range. It is
always inclusive at the start, and exclusive at the end.
2020-04-14 19:08:05 +00:00
Matej Urbančič 6091a14a44 Updated Slovenian translation 2020-04-10 22:16:55 +02:00
Justin van Steijn eedbfdc177 Update Dutch translation 2020-04-06 18:22:19 +00:00
Dušan Kazik ca04f15a8d Update Slovak translation
(cherry picked from commit 43d9466ccd08df2e3cc214f0ecc353c08db1dbcc)
2020-04-05 11:02:10 +00:00
Michael Catanzaro 2bf6cfe289 Avoid critical on startup when a calendar is broken
This is a workaround for evolution-data-server#205. Depending on the
resolution of that bug, this might even be the correct fix.
2020-04-02 15:59:32 -05:00
Michael Catanzaro 26897f89a2 Revert "new-calendar-page: add support for webcal:// links"
This reverts commit 8520e1819c
2020-04-02 15:30:35 +00:00
Michael Catanzaro 8520e1819c new-calendar-page: add support for webcal:// links
Turns out, all we have to do is rewrite the URL to https://. I'm
surprised this works, but I don't see any problems with it. I tested
subscribing to webcal://www.gnome.org/start/unstable/schedule.ics.

See also: #481
2020-04-02 03:09:06 +00:00
Michael Catanzaro 7a3db413e9 new-calendar-page: properly track state of URL entry and Add button
Currently, when the user enters an invalid URL -- a URL that does not
pass SoupURI's URI format validation -- then we set the error style
class on the URL entry to turn the border of the entry red. For example,
if I try to enter "dog" then GNOME Calendar catches this and flags the
entry as red.

But there are some problems.

First of all, GNOME Calendar doesn't do anything to prevent users from
entering URLs that are syntatically valid but not usable as calendars.
The code knows whether the URL was successfully parsed as a calendar
file, it just doesn't do anything with this information. So there is no
red warning if I try to use https://example.com as a calendar, even
though the dialog knows that it didn't work.

Secondly, GNOME Calendar allows pressing the Add button even if the URL
entry contains invalid input, but only if the Calendar Name has been
entered. The dialog thinks: "if I have a name, but not a valid URL, then
the user wants to create a new, empty local calendar!" But this is not
right. If the user has typed anything in the URL entry, then the goal is
to import a new calendar, not to create a new one.

This commit changes set_url_entry_error() into update_url_entry_state(),
and gives it responsibility for updating the add button sensitivity and
URL entry pulsing in addition to the URL entry style class, solving both
of the above problems.

As a side effect, this also closes a race window where the Add button
remains sensitive for half a second after typing new text in the URL entry.
At this point, we don't yet know whether the URL is valid, because we
wait half a second before validating the URL, so we shouldn't allow the
user to activate the Add button during this race window.

Fixes #481
2020-04-02 03:09:06 +00:00
Michael Catanzaro bba6c60c32 new-calendar-page: improve URI validity check
This check passes if the URI is empty. Normally this callback only runs
when there is text in the URL entry, but there is a race window where
the user could delete it first. (Passing NULL to a SoupURI creates an
invalid non-NULL empty URI that can be filled in later.)
2020-04-02 03:09:06 +00:00
Georges Basile Stavracas Neto aaab4af282 timeline: Respond well to subscriber removal 2020-04-01 23:10:01 -03:00
Georges Basile Stavracas Neto fa0173e174 window: Remove subscribers on destroy 2020-04-01 23:10:01 -03:00
Georges Basile Stavracas Neto e4debb9912 views: Free GDateTimes with g_date_time_unref() 2020-04-01 23:10:01 -03:00
Georges Basile Stavracas Neto 93542e8853 timeline: Add already cached events to new subscribers 2020-04-01 23:10:01 -03:00
Georges Basile Stavracas Neto 6586c8738c calendars-page: Add already connected calendars on startup
Fixes https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/479
2020-04-01 23:10:01 -03:00
Michael Catanzaro 164ec8620b calendar-monitor: Fix critical in finalize
self->thread can be NULL if gcal_calendar_monitor_set_range() was never
called prior to finalize. This is fine, so just check for NULL here
using g_clear_pointer().
2020-04-02 01:54:33 +00:00
Michael Catanzaro e816657116 calendar-monitor: fix unused variable warning
Fixes:

[43/52] Compiling C object 'src/25a6634@@gcal-private@sta/core_gcal-calendar-monitor.c.o'
../../../../Projects/gnome-calendar/src/core/gcal-calendar-monitor.c: In function ‘on_client_view_objects_added_cb’:
../../../../Projects/gnome-calendar/src/core/gcal-calendar-monitor.c:402:16: warning: variable ‘old_size’ set but not used [-Wunused-but-set-variable]
  402 |           gint old_size;
      |                ^~~~~~~~
2020-04-01 20:30:06 -05:00
Georges Basile Stavracas Neto d606bafd15 calendar-monitor: Properly cleanup ECalComponents
Unfortunately, they do not have autoptr functions.
2020-04-01 21:08:21 -03:00
Georges Basile Stavracas Neto 19fc8138ba week-header: Use g_date_time_compare()
It is incorrect to use the date-only comparison here. Use the appropriate
GDateTime API and fix a truckload of issues.

Fixes https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/546
2020-04-01 21:06:51 -03:00
Georges Basile Stavracas Neto b703f5746d week-header: Rename a variable
"event_start" and "event_end" clearly communicate they're the
start and end datetimes of the event. I'm dumb, so I need the
code to tell me what's it about easily.
2020-04-01 21:06:51 -03:00
Georges Basile Stavracas Neto a65a370317 time-zone-monitor: Clear GTimeZone with g_time_zone_unref
GTimeZone is not an object, and it cannot be cleared with g_clear_object().
2020-04-01 21:06:51 -03:00
Georges Basile Stavracas Neto c77e4ecfb5 year-view: Small code cleanup
Merge update_date() with gcal_year_view_set_date(), and
tidy up the code style a bit.
2020-04-01 21:06:51 -03:00
Georges Basile Stavracas Neto cfa4b56a05 timeline: Implement processing changes in idle 2020-04-01 21:06:51 -03:00
Georges Basile Stavracas Neto f052cb6589 event-widget: Remove idle on destroy
Finalize may be too late for us, since a widget
may be destroyed long before it's finalized.

Remove the idle timer on destroy then.
2020-04-01 21:06:51 -03:00
Georges Basile Stavracas Neto 7a0b55aa61 timeline: Replace useless function by GcalEvent counterpart 2020-04-01 21:06:51 -03:00
Georges Basile Stavracas Neto 1f6559de68 Remove ECalDataModel and ECalDataModelSubscriber
Drop the bomb!
2020-04-01 21:06:51 -03:00
Georges Basile Stavracas Neto c68ef4b9ab manager: Remove more unused API 2020-04-01 21:06:51 -03:00
Georges Basile Stavracas Neto 399b9d8d00 Simplify calendar views
We don't need a split subscription update step in GcalView
anymore, since subscribers communicate range directly to
the timeline now.
2020-04-01 21:06:51 -03:00
Georges Basile Stavracas Neto 84eeb58804 Move Shell search to GcalShellSearchProvider
Add a custom timeline to GcalShellSearchProvier and use
it to gather events.

Do a massive cleanup of unused APIs as well.
2020-04-01 21:06:51 -03:00
Georges Basile Stavracas Neto 06fbe2c2b9 month-view: Properly notify the "context" property
After adding the EXPLICIT_NOTIFY flag, we needed to make
GcalMonthView notify about it manually, otherwise the
context wouldn't propagate to GcalMonthPopover. We never
did that.

Fixes https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/553
2020-04-01 21:06:51 -03:00
Georges Basile Stavracas Neto 02f21fddab manager: Remove main ECalDataModel
It is not used by any views, nor by the search engine.
2020-04-01 21:06:51 -03:00
Georges Basile Stavracas Neto 9cb29b6dc5 manager: Update event gathering API 2020-04-01 21:06:51 -03:00
Georges Basile Stavracas Neto 72952e42cb timeline: Add API to gather events at a certain range
Will be used by the month popover.
2020-04-01 21:06:51 -03:00
Georges Basile Stavracas Neto 70bcc18bf9 manager: Remove unused API 2020-04-01 21:06:51 -03:00
Georges Basile Stavracas Neto c0016b266b search: Port to GcalTimeline 2020-04-01 21:06:51 -03:00
Georges Basile Stavracas Neto 2d46e673ca timeline: Add filtering API
This will be used by the search.
2020-04-01 21:06:51 -03:00
Georges Basile Stavracas Neto 7cfc264c6d views: Remove ECalDataModel code 2020-04-01 21:06:51 -03:00
Georges Basile Stavracas Neto 9787f02e5b views: Implement GcalTimelineSubscriber 2020-04-01 21:06:51 -03:00
Georges Basile Stavracas Neto 6bcf1a3705 manager: Add GcalTimelineSubscribers to GcalTimeline
Instead of subscribing to the ECalDataModel's API, use the
new API.
2020-04-01 21:06:51 -03:00
Georges Basile Stavracas Neto 3692a0ccf6 Introduce the new calendar monitoring API
It is, as expected, heavily inspired by the ECalDataModel code,
except it uses GDateTime, is timezone aware, and can handle all
day events correctly.
2020-04-01 21:06:51 -03:00
Georges Basile Stavracas Neto 94413c26b1 event: Remove event cache
It's for the best. The cache was being more
problematic than it was worth it.
2020-04-01 21:06:51 -03:00
Georges Basile Stavracas Neto 92f331cd9f range-tree: Add API to remove data
It'll be useful to remove entries without knowing their
range.
2020-04-01 21:06:50 -03:00
Georges Basile Stavracas Neto ec0c17f6fb range-tree: Support destroy function 2020-04-01 21:06:50 -03:00
Georges Basile Stavracas Neto 78248bec5e calendar: Mark all properties as G_PARAM_EXPLICIT_NOTIFY
We explicitly notify them all, so mark them as such. Otherwise,
GLib notifies it when changing these properties through bindings
and such.
2020-04-01 21:06:50 -03:00
Georges Basile Stavracas Neto 90597ca128 calendar: Only notify visibility when it changes
Otherwise we get weird double-notify issues from it.
2020-04-01 21:06:50 -03:00
Georges Basile Stavracas Neto f182813e49 event: Protect event cache with a lock
We'll be creating events from multiple threads soon,
so make sure the event cache is protected enough.
2020-04-01 21:06:50 -03:00
Georges Basile Stavracas Neto ae2a6b9d21 range-tree: Switch to use GDateTime
Using raw integers forces us to select a pre-defined
start and end ranges for the timeline. Since we want
to reuse this data structure on GcalTimeline, make it
a bit more useful.
2020-04-01 21:06:50 -03:00
Georges Basile Stavracas Neto 047078d67d build: Move foward typedefs to gcal-types.h
Standard practice; gcal-types.h is meant to only be
used by header files.
2020-04-01 21:06:50 -03:00
Georges Basile Stavracas Neto 58ce571e93 build: Include src/ files
This will be required by tests in order to
find headers in src/
2020-04-01 21:06:50 -03:00
Georges Basile Stavracas Neto f3a9fcf8f1 contrib: Fix and simplify range checks 2020-04-01 21:06:50 -03:00
Kai A. Hiller 8f0a860966 gcal-calender-popover: Make sorting stable
When multiple calendars with the same name exist, their relative order in the
list is random and changes e.g. when toggling the checkmark next to them. The
result is glitchy behavior.

Now when two calendars have the same name we do a secondary sort by their ID,
resulting in a nice deterministic order.
2020-04-01 22:58:28 +00:00