Commit Graph
3029 Commits
Author SHA1 Message Date
Daniel García Moreno adb56d9c29 event-editor: Do not apply section that doesn't changed
Fix https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/1028
2023-11-12 21:29:07 +01: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
Daniel Garcia Moreno 6afb5cf3a5 view: Fix daylight saving issue in week view
This patch fixes an issue when creating new events in week view the week
after the daylight saving change.

The problem was in the calc of the selected date, that's done couting
the 30 minutes slots and adding that minutes to the week_start datetime.
When there's a daylight saving change, the real date to select should be
adjusted. This patch adds a new util function to make it easy to add
minutes ignoring the tz so we can make this calc directly with
gcal_date_time_add_floating_minutes.

This also includes a new test file with some checks for the new util
function and spring / autumn changes.

This new function could be used in other places to fix specific issues
that could be caused by the same logic error, calculate a selection or
event position based on GDateTime operations.

Fix https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/482
2023-11-09 13:17:20 +00:00
Hari Rana 518de4eb93 help-overlay: Add menu shortcuts 2023-11-07 19:05:12 +00:00
Hari Rana af6ea3bbda calendar-button: Add mnemonic for Manage Calendars 2023-11-07 18:56:30 +00:00
Georges Basile Stavracas Neto 82a6fa364e event-editor/date-selector: Use portal for week dates
Closes: https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/1022
2023-11-07 18:55:05 +00:00
Georges Basile Stavracas Neto ab714d6f39 gui/event-popover: Show at the top
Seems slightly less worse than showing at the sides of the event.

Related: https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/1006
2023-10-18 15:51:32 -03:00
Georges Basile Stavracas Neto 4fb2cd87b0 event-popover: Rework spacings
This allows the scrolled window to have infinite borders
2023-10-18 15:47:46 -03:00
Georges Basile Stavracas Neto ddaf0e17a4 views/month: Create timed ranges
This allows proper range comparisons.

Closes: https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/1106
2023-09-28 13:21:30 -03:00
Georges Basile Stavracas Neto 3ff57f71e4 views/month: Dispose overflow popover 2023-09-28 11:52:40 -03:00
Georges Basile Stavracas Neto e9ab7effad calendar-management/edit: Remove unnecessary binding
This is handled by the C code now.
2023-09-28 11:52:11 -03: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 27ee81b072 views/month: Only diff when current range exists
Right after bring created, the current date - and consequently
the range - is NULL. We shouldn't diff in this case.
2023-09-28 11:25:27 -03:00
Georges Basile Stavracas Neto 9a665a94c7 application: Add message when running as a service 2023-09-28 11:19:23 -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 b26f33ea10 utils: Remove 24h utility function
The last user of this function is gone now.
2023-09-23 02:39:39 -03:00
Georges Basile Stavracas Neto 38108ffa7a event-widget: Fetch 24h setting from context
Instead of using the auxiliary function.
2023-09-23 02:39:07 -03:00
Georges Basile Stavracas Neto c8543aa822 views/week/header: Use en dash
Closes: https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/1107
2023-09-22 11:47:47 -03:00
Georges Basile Stavracas Neto a7f798a815 views/month: Use en dash
Closes: https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/1107
2023-09-22 11:45:47 -03:00
Georges Basile Stavracas Neto 77c908b394 event-widget: Properly unparent preview popover
GcalEventWidget currently doesn't track the preview popover, and
that can easily crash Calendar upon destruction.

Track that, and unparent on dispose.

Closes: https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/986
2023-09-14 12:09:11 -03:00
Georges Basile Stavracas Neto 8d79fe2ffd views/month: Demote assertion to regular check
We can have a NULL selection start, when starting the drag on the
header section.
2023-09-13 18:34:22 -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 dd61f8ef6f views/month/row: Adjust for exclusive end date
Subtract a second from the end date so we can properly compare dates.

Closes: https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/1098
2023-09-13 14:25:45 -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 f1767037ac views/month: Clear selection after showing overflow
This should prevent selection after clicking any overflow button.
2023-09-13 09:17:12 -03:00
Georges Basile Stavracas Neto ad34aa40fc views/month: Add header above week rows
Otherwise GTK4 will pick the rows, even when they're clipped.

Closes: https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/1095
2023-09-09 20:14:39 -03:00
Sam Hewitt b7e04c561e style: Fix papercuts in the calendar cell style 2023-09-05 13:07:25 -02:30
Georges Basile Stavracas Neto 5503e5ca50 views/month: Handle reduced animations setting
Move rows slightly faster in that case.

Closes: https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/1080
2023-09-02 10:28:39 -03:00
Georges Basile Stavracas Neto 20ad7f3676 views/month: Reset offset when animation is done 2023-09-02 10:26:41 -03:00
Georges Basile Stavracas Neto b0813fb605 month-view-row: Clamp last cell to [first cell, 6]
This is not ideal but it's what we've got for now.

Closes: https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/1083
2023-09-02 10:26:41 -03:00
Georges Basile Stavracas Neto e3a350126b gui/month-cell: Accept drops from other months
We support that now fairly easily, let's enable it.

Closes: https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/1077
2023-08-25 18:07:04 -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 ec840fbab9 style: Improve selection visuals of month cells
Add specific CSS rules for the selected state, and make it a bit
more prominent.
2023-08-17 21:22:49 -03:00
Georges Basile Stavracas Neto bd989aae66 views/month: Implement event creation flow
Add a click gesture to detect when we have to start monitoring
cursor motion. Also add a motion event controller to react to
cursor motion, and enable and disable the this motion controller
on button press and release, respectively.

Selection is implemented as a pair of GDateTimes stored in the
month view struct. Whenever a selection begins, the start date
is set; the end date is only set when moving the cursor. It is
valid to have a start of the selection, and no end (meaning, a
1 day selection); it is, however, forbidden to have an end but
not a start.

Future improvements can be added later, such as scrolling when
moving the cursor close to the edges of the month view. We're
gonna have to live without that for now though.

Implement the GcalView.clear_marks vfunc now that we have a
selection to operate on.
2023-08-17 21:13:54 -03:00