gui/event-popover: Wrap content inside AdwClamp widget

The event popover contains a lot of text in different sizes, which
pushes us to magic-number the maximum amount of characters
(i.e. `max-width-chars`) and hope that all is well.

This approach addresses that by simply clamping the parent widget
to the desired size, allowing us to remove all instances
of `max-width-chars`.

Do note that `Adw.Clamp:tightening-threshold` is set to 400 by default,
which technically doesn't need to bind to `Adw.Clamp:maximum-size` at
the moment, but I decided to do it anyway in case we want to change
`Adw.Clamp:maximum-size` in the future and can't figure out why
the margins are off.

Co-authored-by: Jamie Gravendeel <me@jamie.garden>
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/728>
This commit is contained in:
Hari Rana
2026-03-20 11:24:47 -04:00
co-authored by Jamie Gravendeel
parent 24621b4d2b
commit ec5884fcce
+6
View File
@@ -1,4 +1,5 @@
using Gtk 4.0; using Gtk 4.0;
using Adw 1;
template $GcalEventPopover: Popover { template $GcalEventPopover: Popover {
default-widget: action_button; default-widget: action_button;
@@ -9,6 +10,10 @@ template $GcalEventPopover: Popover {
"event-popover", "event-popover",
] ]
child: Adw.Clamp clamp {
maximum-size: 400;
tightening-threshold: bind clamp.maximum-size;
child: Box { child: Box {
orientation: vertical; orientation: vertical;
@@ -176,4 +181,5 @@ template $GcalEventPopover: Popover {
} }
} }
}; };
};
} }