Commit Graph
228 Commits
Author SHA1 Message Date
mindonwarp 059d72499f core: Get week start day from GcalContext
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/822>
2026-09-26 17:21:59 +00:00
mindonwarp c874bde622 refactor: Reduce code duplication in GcalContext
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/822>
2026-09-26 17:21:58 +00:00
mindonwarp 6e1330430b core: Get week start day from settings portal
Uses the already available settings portal in GcalContext to fetch and
track changes in global "week start day" desktop setting. Will use this
later to redraw views.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/822>
2026-09-26 17:21:58 +00:00
Hari Rana 117c032d95 utils: Prefix every function with gcal_util_
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/842>
2026-09-20 12:44:24 +00:00
Maximiliano Sandoval 28e0b65017 Stop using G_GNUC_CONST in _get_type functions
As per g_type_ensure's documentation it is incorrect to mark _get_type
functions with G_GNUC_CONST since they have side-effects on their first
run.

See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/5223 for more
details.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/819>
2026-08-29 11:06:13 +00:00
Niklas Wimmer 81954048f9 core/event: Fix schedule comparison function
Fixes a few problems in the schedule comparison code:

- Same recurrence pointer short-circuits to TRUE: a pointer to the
  same recurrence is not a sufficient condition, because the dates
  could still be different (this is especially true if the recurrence
  is NULL for both events, but also holds if that is not the case).
  Also deleted the explicit check if only one of the recurrence
  pointers is NULL, because that is the first thing that is checked
  in `gcal_recurrence_is_equal()` anyway.
- Date comparisons only check if the date moved into a specific
  direction: the correct logic is to check if they are not the same,
  no matter in which direction the date moved.
- The time is not compared: for non all-day events, it is necessary
  to compare the time values too. The glib function that is now used
  for that also checks the date, so these checks can be collapsed
  into one.

For the second and third point it seems like some things got a bit
mixed up in
https://gitlab.gnome.org/GNOME/gnome-calendar/-/commit/2ee6dfc5e7bd5823bee5029a7ac3a32d3c247ba9:

- The `gcal_schedule_section_changed()` implementation already used the
  `g_date_time_equal()` function (which is now used again).
- It was `gcal_schedule_section_day_changed()` which only compared the
  dates using `gcal_date_time_compare_date()`, but this function was
  only used for edits to recurring events to determine whether to
  allow changing all instances. This commit now exposes a regression
  in this part of the code, which is tracked separately in
  https://gitlab.gnome.org/GNOME/gnome-calendar/-/work_items/1613.

Fixes: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/work_items/1612>
See: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/783>
See: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/work_items/1613>
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/792>
2026-07-22 10:27:57 -04:00
Niklas Wimmer ea2c637b35 core/range: Fix compare function
Fixes a regression from
https://gitlab.gnome.org/GNOME/gnome-calendar/-/commit/62345668748b571939c1c7b441e44664a05a0287

Essentially, `gcal_range_compare()` is just a faster subset of
`gcal_range_calculate_overlap()`. The commit that introduced this
regression accidentally flipped the sign of the compare function,
which made it no longer match with the implementation of overlap.

The function's implementation also did not match its doc comment,
returning any integer instead of only `-1`, `0` or `1`. Since the
behavior described in the doc comment is more commonly used for
comparison functions, the implementation was adjusted to match it.

To avoid any such failures in the future, the next commits will
add tests to validate.

Fixes: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/work_items/1615>
See: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/770>
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/798>
2026-07-22 14:13:36 +00:00
Zelda Ahmed b29cf4e517 core/event: Use en-dash instead of em-dash
En-dashes "–" should be used instead of the longer em-dashes "—", since
the dash was used to represent a range of dates, which means the correct
dash to use is the en-dash

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/789>
2026-06-29 16:44:18 +01:00
Hari Rana 2ee6dfc5e7 core/event: Add utility functions for checking equality
This adds:
- `gcal_event_alarms_equal()`
- `gcal_event_schedule_equal()`
- `gcal_event_strings_equal()`

We aren't going to make use of it yet, but eventually these functions
will be used for the event editor dialog, as well as writing tests for.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/783>
2026-06-26 07:09:52 -04:00
Hari Rana 50ee469d42 core/event: Add remove_alarm() prototype to header
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/780>
2026-06-23 12:48:03 -04:00
Georges Basile Stavracas Neto 6234566874 core/range: Compute and use timestamps for comparison
Using GDateTime utilities is costly and shows up high in profiling.
That's because GDateTime has to run timezone offset checks for every
comparison. We can amortize this cost by converting these datetimes
to unix timestamps upfront, and using them for comparisons.

A complication is date-only ranges, for which unix timestamps wouldn't
work. For this, add a new kind of timestamp that only accounts for the
dates.

Add a new test case for date-only comparison.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/770>
2026-06-13 23:22:01 +02:00
Adrian Kramer 823daa3fb1 manager: Don't reset refresh interval on startup
The refresh interval was unconditionally set to 30 minutes every time
a calendar source was loaded, overwriting any user-configured value.
Only set the default if no interval has been configured yet.

Fixes: https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/1443
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/746>
2026-05-26 17:42:37 +00:00
Georges Basile Stavracas Neto c18218d1f6 core/event-list: Use uids to compare events
We can have multiple GcalEvent* instances for the same underlying
icalcomponent. Compare the uids instead of the raw pointers.

Closes https://gitlab.gnome.org/GNOME/gnome-calendar/-/work_items/1585

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/766>
2026-05-20 15:42:15 -04:00
Georges Basile Stavracas Neto 43e0c53ee4 core: Remove dead code
This is now entirely unused.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/767>
2026-05-20 14:33:13 -04:00
Georges Basile Stavracas Neto 1e6fe7af51 core/log: Add tab after time
This should fix the misaligned timestamps.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/761>
2026-05-05 21:37:25 -03:00
Georges Basile Stavracas Neto 1fbd193954 core/timeline: Sort events better
The previous sorter was a simple GcalRange proxy, but we need a more
robust and stable sorting mechanism. Use multiday, start and end dates,
length, and finally the last modified date to sort events.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/761>
2026-05-05 21:37:15 -03:00
Georges Basile Stavracas Neto 2f7dce36e2 core/event-list: Use gdkarrayimpl.c as backing store
GSequence is useful and provides us with a convenient API, however,
it pretty much guarantees cache misses when iterating, lots of pointer
chasing, and scattered memory.

gdkarrayimpl.c works around all of that, at the cost of more expensive
additions and removals. But because we do a lot more lookups compared
to edits, there should still be benefits to it.

Change the backing store to be based on gdkarrayimpl.c.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/757>
2026-05-03 15:29:31 -03:00
Georges Basile Stavracas Neto d47358f294 core/manager: Use an augmented timeline
Augment the range of events by a factor of 2.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/755>
2026-05-03 14:01:22 -03:00
Georges Basile Stavracas Neto b353c9f259 core/timeline: Add support for augmented timelines
Augmented timelines increase the range of dates from its subscribers
by the specified factor. They're useful for the interactive views,
since they prevent fetching new events so often as when views change.

Add the necessary API.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/755>
2026-05-03 14:01:22 -03:00
Georges Basile Stavracas Neto afd9f9b954 core/timeline: Remove message queueing and listeners
"Let go and move on." - The Fool?

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/742>
2026-05-03 16:57:54 +00:00
Georges Basile Stavracas Neto 5c39162f86 core/search-provider: Port to GListModel
No deal

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/742>
2026-05-03 16:57:53 +00:00
Georges Basile Stavracas Neto 5fe24582d4 core/range-tree: Add gcal_range_tree_has_entries_at_range
It checks if there's any entry in that range. It's a little faster
than gcal_range_tree_count_entries_at_range() because it stops at
the first entry that matches it.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/742>
2026-05-03 16:57:52 +00:00
Georges Basile Stavracas Neto df8033b3ba core/timeline: Cosmetics
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/742>
2026-05-03 16:57:51 +00:00
Georges Basile Stavracas Neto 71c5d0b70d core/timeline: Add plumbing for models
Add a GtkFlattenListModel that flattens out all events from the
calendar monitors. Keep a GtkFilterListModel, and a GtkSortListModel,
for each subscriber. Manually update the filter when the range of
the subscriber changes.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/742>
2026-05-03 16:57:50 +00:00
Georges Basile Stavracas Neto 5f5e438955 core/timeline-subscriber: Add set_model() vfunc
This is the entry point that will allow views to use models instead
of the manual add/remove/update_events vfuncs.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/742>
2026-05-03 16:57:50 +00:00
Georges Basile Stavracas Neto a303759913 core/timeline: Store calendar monitors in a GListModel
This will allow flattening and merging them.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/742>
2026-05-03 16:57:50 +00:00
Georges Basile Stavracas Neto cc6736a16f core/calendar-monitor: Implement GListModel
This uses GcalEventList to as the backing store of events, and proxies
the "items-changed" signal.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/742>
2026-05-03 16:57:49 +00:00
Georges Basile Stavracas Neto 9eea2ee985 core/calendar-monitor: Use NULL-terminated arrays
This will help with next commits

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/742>
2026-05-03 16:57:49 +00:00
Georges Basile Stavracas Neto 6da43e9353 Introduce GcalEventList
This is a GListModel implementation that is specific to
GcalEvents. Events are stored in a GSequence in order of
date.

Add a couple of tests exercising additions and removals.

WIP: add more tests
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/742>
2026-05-03 16:57:49 +00:00
Georges Basile Stavracas Neto 4796330de0 core/log: Ignore GWeather messages
Mostly noise, and lots of XML outputs.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/742>
2026-05-03 16:57:49 +00:00
Hari Rana 48e86c7f3d search/search-engine: Replace "context" property with context getter method
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/702>
2026-03-23 19:30:04 +00:00
Hari Rana e0250064f6 core/shell-search-provider: Replace "context" property with context getter method
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/702>
2026-03-23 19:30:04 +00:00
Hari Rana dc4cfe4ecf core/manager: Remove "context" property
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/702>
2026-03-23 19:30:03 +00:00
Hari Rana 4e9ea9cd51 core/timeline: Remove "context" property
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/702>
2026-03-23 19:30:03 +00:00
Georges Basile Stavracas Neto 9712280aea core/manager: Cosmetics 2026-03-03 20:12:45 -03:00
Georges Basile Stavracas Neto b4292c2026 core/manager: Increment before potentially decrementing
Otherwise we can go backwards first. Not going to break anything,
but this is a more robust logic.
2026-03-03 20:11:07 -03:00
Georges Basile Stavracas Neto e1438b3c8e core/manager: Use g_autoptr more
In the clients list.
2026-03-03 20:09:51 -03:00
voyage200 9f956c93d4 core/manager: Also refresh collections
Add on_collection_source_refreshed() callback. Track collection
source refresh in clients_synchronizing. Refresh collection sources
before calendar clients. Fix PROP_SYNCHRONIZING state by waiting for
all async ops.
2026-03-03 20:07:18 -03:00
mindonwarp b90b99f1bd core: Use GListModel for attendees instead of GSList
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/686>
2026-01-29 23:26:42 +00:00
mindonwarp 0149b7a042 core/editor: Replace g_return_* with g_assert
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/671>
2026-01-21 19:37:53 +00:00
mindonwarp 884855ee0b core: Add a wrapper object for event organizer
Add a wrapper for the ECalComponentOrganizer. An instance of this type
is kept as part of the GcalEvent structure.

The GcalEventOrganizer is just a "proxy" to the ECalComponentAttendee
and its purpose is to unclutter the GcalEvent interface and provide a
bindable base for a UI widget.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/671>
2026-01-21 19:37:52 +00:00
mindonwarp 4f6e705e8b core: Add a wrapper object for attendees
Wrap ECalComponentAttendee structure in calendar's own structure to
prevent propagating the dependency on libecal types to the ui layer.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/671>
2026-01-21 19:37:51 +00:00
Georges Basile Stavracas Neto 4c4fc5a965 core/range-tree: Properly free nodes
It was missing the GDateTime *max field.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/664>
2025-11-19 18:01:11 -03:00
Georges Basile Stavracas Neto 36d3837e0b core/range-tree: Clear range from deleted nodes
Otherwise we leak the range.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/664>
2025-11-19 17:43:04 -03:00
Georges Basile Stavracas Neto 50217bba42 core/event: Cosmetics
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/663>
2025-11-19 09:48:25 -03:00
Georges Basile Stavracas Neto a884076dc5 core/event: Remove g_autoptr declaration
Turns out g_date_time_get_timezone() is transfer-none, so assigning it
to a g_autoptr variable is invalid.

Fixes 42f891ff42

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/663>
2025-11-19 09:47:29 -03:00
Georges Basile Stavracas Neto 6bb52f53e5 core/event: Improve setup function
Use g_autoptr, shuffle some code around, and fix a memory leak.
2025-11-18 14:58:08 -03:00
Federico Mena Quintero 63cf4374e4 Remove gcal_event_set/get_original_timezones()
They are unused now.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/550>
2025-08-27 20:00:01 -03:00
Georges Basile Stavracas Neto d16cc2bc68 utils: Remove get_source_parent_name_color
One less weird function lurking around.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/610>
2025-07-02 18:04:26 +00:00
Georges Basile Stavracas Neto e9ec77f15b core/calendar: Add "parent-source" property
Tracks the parent ESource of this calendar. Will be useful for future
patches.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/610>
2025-07-02 18:04:26 +00:00