using Gtk 4.0; using Adw 1; template $GcalDateChooser: Adw.Bin { Grid { orientation: vertical; $GcalMultiChoice month_choice { halign: fill; min-value: 0; max-value: 11; animate: false; value: 0; category: _("Month"); previous-button-tooltip: _("Previous Month"); next-button-tooltip: _("Next Month"); visible: bind $get_split_choice_visible(template.show-heading, template.split-month-year) as ; notify::value => $split_multi_choice_changed() swapped; layout { column: 0; row: 0; } } $GcalMultiChoice year_choice { visible: bind $get_split_choice_visible(template.show-heading, template.split-month-year) as ; halign: fill; min-value: 1; max-value: 9999; animate: false; value: 0; category: _("Year"); previous-button-tooltip: _("Previous Year"); next-button-tooltip: _("Next Year"); notify::value => $split_multi_choice_changed() swapped; layout { column: 1; row: 0; } } $GcalMultiChoice combined_choice { visible: bind $get_combined_choice_visible(template.show-heading, template.split-month-year) as ; halign: fill; // From January 1st, 1 (32 * (1 * 12 + 0) + 0): min-value: 384; // …to December 31st, 9999 (32 * (9999×12+11) + 30): max-value: 3839998; popover: popover; animate: false; value: 0; category: _("Month"); previous-button-tooltip: _("Previous Month"); next-button-tooltip: _("Next Month"); notify::value => $combined_multi_choice_changed() swapped; layout { column: 0; column-span: 2; row: 0; } } $GcalGizmo gizmo { layout-manager: BinLayout {}; layout { column: 0; column-span: 2; row: 1; } Grid grid { row-homogeneous: true; column-homogeneous: true; } } } } Popover popover { Box { orientation: vertical; spacing: 12; $GcalMultiChoice popover_month_choice { min-value: bind month_choice.min-value bidirectional; max-value: bind month_choice.max-value bidirectional; animate: bind month_choice.animate bidirectional; value: bind month_choice.value bidirectional; category: bind month_choice.category bidirectional; previous-button-tooltip: bind month_choice.previous-button-tooltip; next-button-tooltip: bind month_choice.next-button-tooltip; } $GcalMultiChoice { min-value: bind year_choice.min-value bidirectional; max-value: bind year_choice.max-value bidirectional; animate: bind year_choice.animate bidirectional; value: bind year_choice.value bidirectional; category: bind year_choice.category bidirectional; previous-button-tooltip: bind year_choice.previous-button-tooltip; next-button-tooltip: bind year_choice.next-button-tooltip; } styles [ "activatable", "month", ] } }