Commit Graph
164 Commits
Author SHA1 Message Date
Georges Basile Stavracas Neto 6a9d5a75fa core/calendar-monitor: Remove property descriptions
They're unnecessary.
2025-05-21 01:38:00 -03:00
Titouan Real 42f891ff42 gui/event-editor: Add time zone selection
Creates a chooser managing a GDateTime. The chooser allows the user
to change the date, the time and the timezone independently.

This replaces the precedent GcalTimeChooserRow widget, because it is
easier to manage the different interactions with the user in a single
widget.

Co-authored-by: Georges Basile Stavracas Neto
<georges.stavracas@gmail.com>
2025-01-31 19:37:26 -03:00
Georges Basile Stavracas Neto f883de2d02 core/context: Properly initialize time format
The property default and the actual initialization didn't agree on
24h.
2024-12-16 15:55:09 -03:00
Georges Basile Stavracas Neto 004fdb0f3d utils: Shuffle and cleanup some paintable code
- It's only used in GcalShellSearchProvider so move it there.
- GdkTexture implements GIcon so no need to convert to a pixbuf.
2024-10-11 22:55:03 -03:00
Felipe Anibal 5ce7b210dc event: correctly interpret floating time events
When dealing with floating time events the timezone used was UTC,
but according to RFC5545 when the timezone is not specified the
local timezone should be used.

Fixes #171
2024-07-12 11:07:24 -03:00
Abdullahi Usman 2896bd5177 timeline: notify subscribers to remove event outside their range
Timeline subscribers (i.e week_view, month_view, agenda_view, date_chooser) were not
properly notified of event(s) moved out of their listening ranges.
We notify them to remove these events.

fixes: #994 and #1043
2024-07-12 06:59:43 +01:00
Daniel Garcia Moreno c7875f03ff timeline: Handle multiday events in calculate_changed_events
This patch do not sends ADD_EVENT for events that are multiday and are
part of the old_range when calling calculate_changed_events. This will
prevent multiday duplicate events to appear in the agenda widget when
using the week view.

If the event is a multiday and it was in the previous range, it won't
send the REMOVE_EVENT so multiday events won't dissapear when it's still
relevant.

See https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/898#note_1602391
2024-07-09 19:59:42 +00:00
Markus Göllnitz 02465d1bed gcal-manager: fix typo debug message
Signed-off-by: Markus Göllnitz <camelcasenick@bewares.it>
2024-01-27 16:09:02 +00:00
Rami Alkawadri 487e72ee07 gcal-range: Implement gcal_range_get_range_type 2024-01-15 19:31:56 +00:00
Daniel Garcia Moreno 68c921bf60 test: Add event_date_edit_tzid
This new test check that the tz data in the component is set correctly
after editing an event date end.

See https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/170
2023-11-09 20:59:59 +00:00
Daniel Garcia Moreno 20aa929966 event: Set dt_end to next day when DTEND is not defined
from RFC5545 (p. 54) https://datatracker.ietf.org/doc/html/rfc5545#page-54
For cases where a "VEVENT" calendar component specifies a "DTSTART"
property with a DATE value type but no "DTEND" nor "DURATION" property,
the event's duration is taken to be one day.

Fix https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/327
2023-11-09 14:37:09 +00:00
Georges Basile Stavracas Neto 80a258c705 core/timeline: Use g_clear_handle_id
Saves us a few lines of code.
2023-09-28 11:33:30 -03:00
Georges Basile Stavracas Neto 96625ec595 core/calendar-monitor: Protect against NULL range 2023-09-28 11:33:02 -03:00
Georges Basile Stavracas Neto 750c62d4f2 core/context: Use Settings portal for 24h setting
Closes: https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/1105
2023-09-23 02:54:09 -03:00
Georges Basile Stavracas Neto 439b46af89 core/calendar-monitor: Remove g_autoptr from a variable
g_hash_table_lookup() is not transfer-full, so this g_autoptr + the
g_hash_table_remove() call end up double-unreffing the event, which
causes a crash.

Remove g_autoptr from the variable.
2023-09-13 17:51:34 -03:00
Georges Basile Stavracas Neto 07c5b6280a core/calendar-monitor: Transfer event ownership properly
g_steal_pointer() is not enough, since the event is not declared
with g_autoptr.

Use g_object_ref().

Fixes: f7ee9279ad
Closes: https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/1097
2023-09-13 14:18:36 -03:00
Georges Basile Stavracas Neto a1810433ed core/timeline: Don't excise events from queue
When removing the last subscriber (something that can happen when
closing the main window), GcalTimeline clears the event queue. But
that leaves us in an inconsistent state, as we don't process any of
the potentially removed events.

Don't do that.

Related: https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/1087
2023-09-13 09:17:12 -03:00
Georges Basile Stavracas Neto f6c4fe108d core/calendar-monitor: Join view thread in dispose
Joining the calendar view thread in finalize is too late; dispose
is an earlier phase, and recoverable.

Do that.

Closes: https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/1085
2023-08-25 17:18:16 -03:00
Georges Basile Stavracas Neto d8742df706 core/calendar-monitor: Remove unnecessary g_main_loop_quit() 2023-08-23 11:25:59 -03:00
Georges Basile Stavracas Neto ef1f154c7a core/shell-search-provider: Check for pending search
Now that GcalTimeline properly notifies about the complete state,
it uncovered an issue where GcalShellSearchProvider was dereferencing
a NULL pointer.

Protect against that.
2023-08-23 11:19:10 -03:00
Georges Basile Stavracas Neto b32353e0ed core/timeline: Update completed when adding or removing
We need to do that, so we can keep properly keep the complete
property up-to-date.
2023-08-23 11:19:10 -03:00
Georges Basile Stavracas Neto 0eb3ebb1fa core/timeline: Track complete state differently
Don't try and track the number of completed calendars; instead,
recalculate the completed state from scratch every time. This
is not a performance concern, as we're dealing with at most some
hundreds of calendars.
2023-08-23 11:19:10 -03:00
Georges Basile Stavracas Neto f16b0a1563 core/calendar-monitor: Assert more startup conditions
The calendar view thread can start spinning its own mainloop
before g_thread_new() returns, and in that case we have a NULL
thread.

Check that either the GThread is what we expect it to be, OR,
the thread is NULL and there are no messages in the queue.
2023-08-23 10:17:01 -03:00
Georges Basile Stavracas Neto 8403052d88 core/calendar-monitor: Initialize and clear mutex
An oversight from previous commits
2023-08-23 10:11:13 -03:00
Georges Basile Stavracas Neto 373da242d0 core/calendar: Ensure notify happens in main thread
The notify signals of ESourceSelectable seem to come from the
ESourceRegistry thread, and this has the potential to derail
the execution of Calendar. This might be true for all signals
we connect to.

Make sure to always emit notify signals on the main thread.
2023-08-23 09:33:01 -03:00
Georges Basile Stavracas Neto 42de771c24 core/calendar-monitor: Join thread before NULLifying it
This allows the threading macros to compare against the correct
value.
2023-08-23 09:33:01 -03:00
Georges Basile Stavracas Neto 6f45dcc26f core/calendar: Notify about the right property
When we change colors, notify about colors, not the name.
2023-08-22 17:28:13 -03:00
Georges Basile Stavracas Neto 9e341d87e4 core/monitor: Assert we're in the right thread
Right now everything works as expected, but this should catch cases
where we're running functions on the wrong thread.
2023-08-22 17:25:56 -03:00
Georges Basile Stavracas Neto df66e484a7 core: Add global threading utility
For now, we only store what's the main thread of the program.
2023-08-22 17:25:56 -03:00
Georges Basile Stavracas Neto da84b727b3 core/subscriber: Pass old event on update
Now that we keep precise control over GcalEvent instances, and
can use simple pointer comparisons everywhere, GcalMonthView
implemented its update function as a simple remove + add pair.

The problem is that we're not passing the old event instance,
so removals never actually happen, since the new instance is
not yet available to subscribers.

Pass old event in additio to the new one, and use it where it
makes sense.

Closes https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/1073
2023-08-18 10:41:41 -03:00
Georges Basile Stavracas Neto 60223adc5c core/calendar-monitor: Replace signals by callbacks
This should save quite some resources when manipulating events.
Signals are relatively expensive, and 2 pointer chases are
definitely better than a global lock + FFI stashing + signal
manipulation.
2023-08-18 10:41:18 -03:00
Georges Basile Stavracas Neto 7f57cfeb83 range: Add API to check if range contains datetime
This will be used by next commits to make some code
more legible.
2023-08-11 15:13:44 -03:00
Georges Basile Stavracas Neto 3dc669f2ec calendar-monitor: Set the right field when removing events 2023-08-07 14:51:52 +00:00
Georges Basile Stavracas Neto 04522b7817 core/calendar: Remove connection timeout
As per discussions, this is not really what we want here. There
already is offline caching and post-connection sync, so we want
to show events as soon as possible.

Closes https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/1027
Closes https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/569
2023-08-07 14:51:52 +00:00
Georges Basile Stavracas Neto 2b78d57459 calendar-monitor: Don't replace new events
If an event is already present in the cache, don't attempt
to insert it, which replaces the available event instance
with the new one.
2023-08-02 11:05:06 -03:00
Georges Basile Stavracas Neto 9c21dff77d calendar-monitor: Improve lifecycle of updated events
Keep a ref alive while updating the old event, as it may be
destroyed during signal emission.
2023-08-02 11:05:00 -03:00
Georges Basile Stavracas Neto 745e022aa0 calendar-monitor: Don't remove events unnecessarily
Apparently I never properly implemented range comparison in
remove_events_outside_range(). Do so now.

This makes the infinite scrolling month view stop flickering
events when changing weeks.
2023-08-02 11:04:52 -03:00
Georges Basile Stavracas Neto f7ee9279ad calendar-monitor: Operate in batches
Instead of smashing the main thread's mainloop with
potentially hundreds or even thousands of idles that
add, remove, or update individual events, pass arrays
of events around.
2023-08-02 11:04:40 -03:00
Georges Basile Stavracas Neto 8b403f10ef calendar-monitor: Use a GPtrArray for accumulated events
This will ease future changes.
2023-08-02 11:04:37 -03:00
Georges Basile Stavracas Neto 0a0128bf4c core/calendar-monitor: Keep event alive while removing it
This might be the last reference to it, so keep it alive while
the signal is being emitted.
2023-03-16 12:27:47 +00:00
Milan Crha 1ba749ee59 gcal-recurrence: Handle invalid 'until' time
When the until's time part is invalid, the libical claims the time
as valid, but the conversion into the GDateTime fails and returns NULL.
Such events, which claim to have until-date recurrence, but NULL 'until'
cannot be edited, because they cause a crash of the application.

More information can be found downstream at:
https://bugzilla.redhat.com/show_bug.cgi?id=2135772

Related to https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/892
2022-11-17 10:46:16 +00:00
Georges Basile Stavracas Neto 1fee8ff144 core/recurrence: Port to gatomicrefcount 2022-10-17 23:37:13 -03:00
Georges Basile Stavracas Neto e3c7a1d777 core/manager: Remove old hack around recurrences
We handle it all before reaching GcalManager now.
2022-10-17 23:37:13 -03:00
Georges Basile Stavracas Neto 2f1fe2b49b core/event: Fix transfer annotation 2022-10-17 23:37:13 -03:00
Georges Basile Stavracas Neto 1beb3c9cf3 manager: Remove unnecessary comment 2022-10-17 23:37:13 -03:00
Georges Basile Stavracas Neto db43bcd096 event: Trivial style fix 2022-10-17 23:37:13 -03:00
Georges Basile Stavracas Neto a0963c0d36 calendar-monitor: Properly update and delete recurrent events
When we receive the 'objects-modified' signal, we get components
that may represent main events. We also may receive components
that have no recurrency because they were just changed from being
recurrent to non-recurrent.

We need to handle all these cases properly.

If the event has no recurrency set, remove any potential old
recurrence instance lingering around. If we're changing an event
with recurrency, make sure the recurrency instances are in sync
with the new recurrency.

Fixes https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/881
(or so I hope.)
2022-10-17 23:37:13 -03:00
Georges Basile Stavracas Neto 16b9337e3f calendar-monitor: Move events hash table to shared section
We'll start accessing the hash table from multiple threads, so
it must be in the shared section of the structure, and it must
be encapsulated by locking.
2022-10-17 23:37:13 -03:00
Georges Basile Stavracas Neto 791d443c54 calendar-monitor: Simplify locking code a bit
Use GRWLock*Locker to simplify the locking code in a couple of
places.
2022-10-17 23:37:13 -03:00
Georges Basile Stavracas Neto 5f67c55304 calendar-monitor: Replace mutex by a rw-lock
This will be more appropriate once we start accessing the events
hash table from the monitor thread.
2022-10-17 23:37:13 -03:00