using Gtk 4.0; template $GcalWeekView: Box { orientation: vertical; styles [ "week-view", ] Box { orientation: horizontal; Box expand_button_box { hexpand: false; ToggleButton { visible: bind header.can-expand; active: bind header.expanded bidirectional; tooltip-text: bind $get_header_state_tooltip(header.expanded) as ; hexpand: true; halign: center; valign: end; margin-bottom: 6; icon-name: "go-down-symbolic"; styles [ "flat", "circular", "week-header-expander", ] } } $GcalWeekHeader header { hexpand: true; event-activated => $on_event_activated(template); } } ScrolledWindow scrolled_window { hexpand: true; vexpand: true; GestureZoom { scale-changed => $on_zoom_gesture_scale_changed_cb(template) not-swapped; begin => $on_zoom_gesture_begin_cb(template) not-swapped; end => $on_zoom_gesture_end_cb(template) not-swapped; } EventControllerScroll { propagation-phase: capture; flags: vertical | kinetic; scroll-begin => $on_scroll_controller_scroll_begin_cb(template) not-swapped; scroll => $on_scroll_controller_scroll_cb(template) not-swapped; scroll-end => $on_scroll_controller_scroll_end_cb(template) not-swapped; } EventControllerMotion { propagation-phase: capture; enter => $on_motion_controller_enter_cb(template) not-swapped; motion => $on_motion_controller_motion_cb(template) not-swapped; leave => $on_motion_controller_leave_cb(template) not-swapped; } // Make the behaviour of Page-Up/Page-Down consistent regardless of // whether an event is selected in the week view. ShortcutController { propagation-phase: capture; Shortcut { trigger: "Page_Up"; action: "action(win.previous-date)"; } Shortcut { trigger: "Page_Down"; action: "action(win.next-date)"; } } Viewport { Box content { orientation: horizontal; $GcalWeekHourBar hours_bar {} $GcalWeekGrid week_grid { hexpand: true; vexpand: true; event-activated => $on_event_activated(template); } styles [ "week-main-content", ] } } } } SizeGroup sizegroup { mode: horizontal; widgets [ expand_button_box, hours_bar, ] }