Currently, clicking on a calendar in the sidebar's listbox traps
the keyboard focus. As a result, pressing PageUp or PageDown
scrolls the listbox instead of switching the date.
Similar to commit fbc18174 for the week view, this adds a
capture-phase ShortcutController to the calendar listbox. This
ensures that PgUp and PgDown consistently switch month or week
regardless of whether a calendar item is focused.
Fixes #1593
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/771>
42 lines
1010 B
Plaintext
42 lines
1010 B
Plaintext
using Gtk 4.0;
|
|
using Adw 1;
|
|
|
|
template $GcalCalendarList: Adw.Bin {
|
|
child: ScrolledWindow {
|
|
hscrollbar-policy: never;
|
|
propagate-natural-height: true;
|
|
propagate-natural-width: true;
|
|
|
|
child: Adw.Clamp {
|
|
maximum-size: 800;
|
|
tightening-threshold: 800;
|
|
|
|
child: ListBox calendar_listbox {
|
|
hexpand: true;
|
|
selection-mode: none;
|
|
row-activated => $on_listbox_row_activated_cb(template) not-swapped;
|
|
// Allow Page-Up/Page-Down to consistently switch months/weeks,
|
|
// regardless of whether the sidebar's calendars listbox has focus.
|
|
ShortcutController {
|
|
propagation-phase: capture;
|
|
|
|
Shortcut {
|
|
trigger: "Page_Up";
|
|
action: "action(win.previous-date)";
|
|
}
|
|
|
|
Shortcut {
|
|
trigger: "Page_Down";
|
|
action: "action(win.next-date)";
|
|
}
|
|
}
|
|
|
|
styles [
|
|
"navigation-sidebar",
|
|
"calendar-list",
|
|
]
|
|
};
|
|
};
|
|
};
|
|
}
|