quick-add-popover: Port to libadwaita widgets and merge stack pages

Both stack pages are merged into one page to avoid additional
cycling through pages.

`GtkListBoxRow`s were replaced by `AdwActionRow`s with
`GtkCheckBox`es as children.

Closes https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/90,
https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/1003

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/362>
This commit is contained in:
Hari Rana
2025-11-18 11:33:23 -03:00
committed by Georges Basile Stavracas Neto
parent ac6cccee53
commit 324bde2c72
4 changed files with 182 additions and 263 deletions
+88 -147
View File
@@ -1,166 +1,107 @@
using Gtk 4.0;
using Adw 1;
template $GcalQuickAddPopover: Popover {
width-request: 350;
width-request: 360;
show => $gtk_widget_grab_focus(summary_entry);
Stack stack {
hexpand: true;
vexpand: true;
styles [
"quick-add-popover",
]
Box {
orientation: vertical;
margin-top: 12;
margin-bottom: 12;
margin-start: 12;
margin-end: 12;
hhomogeneous: false;
vhomogeneous: true;
transition-type: slide_left_right;
interpolate-size: true;
spacing: 12;
StackPage {
name: "events";
Label title_label {
hexpand: true;
wrap: true;
max-width-chars: 25;
xalign: 0.0;
margin-top: 6;
margin-bottom: 6;
margin-start: 27;
margin-end: 27;
child: Grid {
row-spacing: 12;
column-spacing: 12;
styles [
"title-4",
]
}
Label title_label {
hexpand: true;
ListBox {
accessible-role: none;
selection-mode: none;
margin-start: 12;
margin-end: 12;
styles [
"boxed-list",
]
Adw.EntryRow summary_entry {
title: _("Title");
notify::text => $summary_entry_text_changed(template) not-swapped;
entry-activated => $summary_entry_activated(template) not-swapped;
}
}
ScrolledWindow {
propagate-natural-height: true;
max-content-height: 240;
styles [
"undershoot-top",
"undershoot-bottom",
]
child: ListBox calendars_listbox {
selection-mode: none;
margin-start: 12;
margin-end: 12;
margin-top: 12;
margin-bottom: 12;
styles [
"boxed-list",
"calendars-list",
"compact",
]
};
}
Box {
homogeneous: true;
margin-start: 12;
margin-end: 12;
spacing: 9;
Button edit_button {
valign: center;
clicked => $edit_or_create_event(template);
child: Label {
label: _("_Edit Details");
use-underline: true;
styles [
"heading",
]
};
}
layout {
column: 0;
row: 0;
column-span: 3;
}
}
Button add_button {
valign: center;
sensitive: false;
label: _("_Save Event");
use-underline: true;
clicked => $edit_or_create_event(template);
Entry summary_entry {
hexpand: true;
notify::text => $summary_entry_text_changed(template) not-swapped;
activate => $summary_entry_activated(template) not-swapped;
layout {
column: 0;
row: 1;
column-span: 3;
}
}
Button select_calendar_button {
hexpand: true;
clicked => $select_calendar_button_clicked(template);
layout {
column: 0;
row: 2;
column-span: 3;
}
Box {
spacing: 12;
Image color_image {
styles [
"calendar-color-image",
]
}
Label calendar_name_label {
hexpand: true;
xalign: 0;
}
Image {
icon-name: "go-next-symbolic";
}
}
}
Button edit_button {
label: _("Edit Details…");
margin-top: 6;
clicked => $edit_or_create_event(template);
layout {
column: 0;
row: 3;
}
}
Button add_button {
label: _("Add");
sensitive: false;
margin-top: 6;
clicked => $edit_or_create_event(template);
layout {
column: 2;
row: 3;
}
styles [
"suggested-action",
]
}
};
}
StackPage {
name: "calendars";
child: Box {
orientation: vertical;
spacing: 6;
CenterBox {
[start]
Button back_button {
icon-name: "go-previous-symbolic";
clicked => $back_button_clicked(template);
styles [
"flat",
]
}
[center]
Label {
label: _("Calendar");
styles [
"heading",
]
}
}
ScrolledWindow {
hexpand: true;
vexpand: true;
Viewport {
scroll-to-focus: true;
ListBox calendars_listbox {
selection-mode: none;
row-activated => $select_row(template);
styles [
"calendars-list",
]
}
}
}
};
styles [
"suggested-action",
]
}
}
}
}
SizeGroup {
widgets [
edit_button,
add_button,
]
}