Commit Graph
285 Commits
Author SHA1 Message Date
Georges Basile Stavracas Neto 601acef508 views/month: Use variable for better readability
The second part of the if condition is not obvious, so use a variable
with a proper name to make it easier to understand.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/758>
2026-05-19 22:20:10 +00:00
Georges Basile Stavracas Neto 573e1dc042 views/month: Simplify layout blocks recalculation
We can merge two of the three branches, and thus cleanup a function
that is only used there.

Suggested by Hari.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/758>
2026-05-19 22:20:10 +00:00
Georges Basile Stavracas Neto c0127fa2af views/week-header: Reuse event widgets using the new pool
Same deal as the Month view.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/758>
2026-05-19 22:20:10 +00:00
Georges Basile Stavracas Neto bbc041eed9 views/month: Recycle event widgets using the pool
Create a new GcalEventWidgetPool shared between all month view rows.
The event widgets are distributed to rows as needed.

When rows are done with the event widget, the give them back to the
pool so that other rows can reuse them.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/758>
2026-05-19 22:20:10 +00:00
Georges Basile Stavracas Neto 3692747362 views/week-grid: Reuse event widgets
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/758>
2026-05-19 22:20:10 +00:00
Georges Basile Stavracas Neto 4205e08be6 views/month: Reuse event widgets
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/758>
2026-05-19 22:20:10 +00:00
Georges Basile Stavracas Neto 378b7f6075 views/month: Remove unused field
The hash table is not used since we moved to list models.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/761>
2026-05-05 21:37:05 -03:00
Georges Basile Stavracas Neto 64efb3a06b views/month: Completely hide invisible rows
Instead of just skipping painting. This should remove rows and event
widgets from the CSS tree, avoid measurements and relayouts, and a
few other benefits.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/761>
2026-05-05 21:36:58 -03:00
Hari Rana 8629b1f422 views/month-cell: Create activation signal and shortcuts from utility function
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/747>
2026-05-04 10:42:02 +00:00
Georges Basile Stavracas Neto 16a67b7f60 views/week-header: Use gdkarrayimpl.c as backing store
Same deal. It's faster.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/757>
2026-05-03 15:30:20 -03:00
Georges Basile Stavracas Neto 95bc0a8fb2 views/month: Reduce to 3 pages
Now that the timeline handles augmentation, the Month view doesn't need
to fetch so much data at once. Reduce to 3 pages of month rows.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/757>
2026-05-03 14:56:07 -03:00
Georges Basile Stavracas Neto c084e28400 views/week: Don't deal with events out of range
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/742>
2026-05-03 16:57:54 +00:00
Georges Basile Stavracas Neto c71fcf7029 views/month: Add "range" property to rows and use it
Use it as the binding source of the GtkExpression for the boolean
filter used to filter the list of events. This allows automatic
filtering when the "range" property changes.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/742>
2026-05-03 16:57:54 +00: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 d065d4b9e8 views/agenda: Port to GListModel
This is a major rework of the Agenda view. It splits the view into
GcalAgendaViewDay, which represent a single day with events; and
GcalAgendaViewDayRow, which is the actual widget with a title label,
and a listbox with event widgets.

The Agenda view itself merely manages a list of GcalAgendaViewDays,
and updates them with the events model, and active dates.

This allows us to get rid of the custom listbox row, and the confusing
checks for event widgets, and all the bugs the came with it. It also
allows for removing the internal GcalRangeTree, and delegate all
event management to list models.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/742>
2026-05-03 16:57:54 +00:00
Georges Basile Stavracas Neto fa03c6f9af views/week-grid: Port to GListModel
And, while at it, rewrite the layout algorithm to operate on blocks of
overlapping events, and segmented columns. Like the month view row,
layouts blocks are invalidated at any point in time, but recalculated
immediately before a relayout happens.

The reason for doing such a massive rewrite while in the middle of the
port to GListModel is because it's easier to handle GListModel data
with this approach, than with the previous approach of storing it all
in a GcalRangeTree.

Closes: https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/1153
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/742>
2026-05-03 16:57:53 +00:00
Georges Basile Stavracas Neto 34e28e31fe views/week: Port week header to GListModel
Rework the add/remove functions to make them internal. The remove
function can now operate on GcalEvent* instead of gchar* uuid,
since it's not bound to GcalTimelineSubscriber anymore.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/742>
2026-05-03 16:57:52 +00:00
Georges Basile Stavracas Neto c635db3495 views/week: Port to GPtrArray
GLists are an artifact of times immemorial and we should
avoid using them as much as possible. In this commit, for
example, there were a couple of accidentally quadratic
pieces of code.

Port (mostly of) the week view header to GPtrArray.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/742>
2026-05-03 16:57:51 +00:00
Georges Basile Stavracas Neto 039b75755e views/month: Port to GListModel
Neutralize the add/remove/update vfuncs (we can't remove them yet).
Pass the event model to the individual week rows, and let them
filter their events using a GtkFilterListModel.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/742>
2026-05-03 16:57:51 +00:00
Jordan Petridis b900a65760 Use standalone Month format when appropriate
Some locales use different strings for the months depending if they are
accompanied by a numberic date or not. When we use the month name as a
standalone, we should use %OB instead to accomodate for these locales.

For more see: https://docs.gtk.org/glib/method.DateTime.format.html

Close #1546

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/705>
2026-04-23 16:28:06 +00:00
Hari Rana 92b74849bf views/month-cell: Add AdwBin as parent to methods retrieving height of widget
This is future-proofing the uncertain decision of removing
GtkWidget's `margin-*` properties in the future, which is what
we're currently using to retrieve the height of certain widgets.

Whenever the intention is to get the entire size of a particular
widget, including properties that contribute to layout such as
margins, the `get_width()`/`get_height()` methods don't include
these properties during calculations. However, getting the size
of the parent widget will include them in its entirety.

As such, the safest path is to use AdwBin as the parent to the
respective widgets, and using it to retrieve the height.

See: <https://gitlab.gnome.org/GNOME/gtk/-/issues/6556#note_2056432>
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/739>
2026-04-03 16:37:14 -04:00
Hari Rana 49e0521b67 views/week-view: Adapt to high contrast
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/710>
2026-03-31 21:55:32 -04:00
Zoey Ahmed fbfacb6972 gui/blueprint: Drop unneeded casts to built-ins
Blueprint can now "infer" the type a closure returns, as long as it is
not the property of a custom GType, so some of the casts (e.g. `as
<string>`) will not be necessary anymore

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/733>
2026-03-24 16:43:10 +00:00
Hari Rana 037ffd3700 gui/event-widget: Replace "context" property with context getter method
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/702>
2026-03-23 19:30:02 +00:00
Hari Rana 15a7a8cbd2 views/view: Remove "context" property
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/702>
2026-03-23 19:30:00 +00:00
Hari Rana 5616ba2c03 views/agenda-view: Replace "context" property with context getter method
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/702>
2026-03-23 19:30:00 +00:00
Hari Rana cebd3cd84d views/month-view: Replace "context" property with context getter method
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/702>
2026-03-23 19:30:00 +00:00
Hari Rana d9f02cee20 views/week-view: Replace "context" property with context getter method
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/702>
2026-03-23 19:29:59 +00:00
Hari Rana d0bdc9f2af gui/month-view-row: Add upward variable
`!downward` is disambiguous and could merely be interpreted
as "not downward and not upward either". The `upward` variable
is explicit and describes literally the condition.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/729>
2026-03-21 10:39:16 -04:00
Abdullahi Usman 24621b4d2b agenda-view: Respect local timezone
convert events' time to equivalent local time before sorting.

fixes: https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/1324
2026-03-17 20:09:23 -03:00
Zoey Ahmed f99678aea9 views/month-view: Check if focused widget is month cell
This fixes an issue where pressing Shift + Up/Down while focused on the
overflow button will result in a bail out when asserting the focused
widget has a month cell ancestor:

```
GcalMonthView:ERROR:../src/gui/views/gcal-month-view.c:1002:on_key_controller_key_pressed_cb: assertion failed: (GCAL_IS_MONTH_CELL (month_cell))
Bail out! GcalMonthView:ERROR:../src/gui/views/gcal-month-view.c:1002:on_key_controller_key_pressed_cb: assertion failed: (GCAL_IS_MONTH_CELL (month_cell))
```

When navigating between month cells with a keyboard, focus is set
on respective month cells, so checking whether the ancestor
is a month cell or not is not only unnecessary, it also causes
bugs like the assertion above.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/720>
2026-03-11 08:55:09 -04:00
Hari Rana 50e048c7e0 utils: Turn number of weekdays into a macro
While "7" may be obvious in the context of calendaring that
it represents the number of week days, it often gives me the
impression of it being a magic number when I'm hyperfocused on certain
parts of the codebase for several consecutive hours. Turning the
number into a macro helps me scan functions much more easily.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/674>
2026-03-08 21:53:40 -04:00
Hari Rana 2638766d10 views/month-view: Focus adjacent cell when tabbing forward from the last event widget
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/564>
2026-03-03 21:11:16 -03:00
Hari Rana e607a6bd2e views/month-view: Clear marks when tabbing from a cell
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/564>
2026-03-03 21:11:16 -03:00
Hari Rana 4e54c18d06 views/month-view: Set focus to cell upon click release
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/564>
2026-03-03 21:11:16 -03:00
Hari Rana 3102766c51 views/month-view: Allow selecting cells
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/564>
2026-03-03 21:11:16 -03:00
Hari Rana 6c6dd46a89 views/month-view: Scroll view when out of bounds
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/564>
2026-03-03 18:35:18 -05:00
Hari Rana c74fe74b97 views/month-view: Wrap cells
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/564>
2026-03-03 18:35:18 -05:00
Hari Rana d8e44108ea views/month-view: Display quick add popover when activating cell
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/564>
2026-03-03 18:35:18 -05:00
Hari Rana 3088b2260a views/month-view-row: Add "activate-cell" signal
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/564>
2026-03-03 18:35:18 -05:00
Hari Rana cd0138393f views/month-cell: Add activate signal
This will be needed for keyboard navigation.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/564>
2026-03-03 18:35:17 -05:00
Hari Rana 471f81eb31 views/month-view-row: Implement focusing cells horizontally
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/564>
2026-03-03 18:35:17 -05:00
Hari Rana e6e201d9aa views/month-view-row: Implement focusing cells vertically
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/564>
2026-03-03 18:35:17 -05:00
Hari Rana 48e6607d43 views/month-view: Focus adjacent cell when pressing Ctrl+Tab
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/564>
2026-03-03 18:35:17 -05:00
Hari Rana 405f826252 views/month-view-row: Add method for focusing adjacent cells
This method allows to focus the month cells behind the event widgets.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/564>
2026-03-03 18:35:17 -05:00
Hari Rana e88f77802b views/month-cell: Override focus() virtual function
Without this patch, focus immediately goes to the "Previous Month"
button at startup, for some unknown reason.
So, as a workaround, skip focus if the root cannot retrieve the
current focused widget.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/564>
2026-03-03 18:35:17 -05:00
Hari Rana 80adbd0d23 views/month-cell: Inherit GtkWidget
AdwBreakpointBin, the parent, cannot set focus to itself. Instead
of focusing GtkOverlay, a child widget, we should instead inherit
GtkWidget to allow focusing that instead.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/564>
2026-03-03 18:35:17 -05:00
Hari Rana b592f15b26 views/month-view: Add and update accessible elements
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/564>
2026-03-03 18:35:17 -05:00
Hari Rana caed41abdd views/month-cell: Set accessibility properties for overflow button
This uses the "toggle-button" role instead of GtkToggleButton widget,
as GtkToggleButton remains toggled after closing the month popover.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/598>
2026-03-01 19:35:46 +00:00
Hari Rana 55aa6b8cc5 views/month-view: Focus last focused widget after closing month popover
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/598>
2026-03-01 19:35:46 +00:00