Give media grids a more consistent layout

Centering everything caused the posters to vary in position depending on
the number of title lines and the presence of an original title. Now we
simply fill each item top to bottom and reserve space for the poster
even if there is none - we're aiming to have a poster for every piece of
media anyway.
This commit is contained in:
Reinout Meliesie 2026-01-26 18:24:15 +01:00
commit 18d6eedb15
Signed by: zedfrigg
GPG key ID: 3AFCC06481308BC6
3 changed files with 4 additions and 6 deletions

View file

@ -22,6 +22,10 @@ impl FileSystemManager {
} }
pub async fn poster(&self, uuid: &str) -> Result<Option<Texture>, DataManagerError> { pub async fn poster(&self, uuid: &str) -> Result<Option<Texture>, DataManagerError> {
// TODO: Investigate if we can limit the size of the poster here already, so
// that we could use a gtk4::Picture in the UI and avoid wasting space due
// to the square aspect ratio limitation of gtk4::Image.
let file_path = concat_os_str!(&self.data_dir, "/posters/", uuid); let file_path = concat_os_str!(&self.data_dir, "/posters/", uuid);
let texture = spawn_blocking(move || Texture::from_filename(file_path)) let texture = spawn_blocking(move || Texture::from_filename(file_path))
.await .await

View file

@ -64,7 +64,6 @@ impl FactoryComponent for FilmGridItem {
gtk4::Box { gtk4::Box {
set_orientation: Orientation::Vertical, set_orientation: Orientation::Vertical,
set_valign: Align::Center,
set_margin_vertical: 20, set_margin_vertical: 20,
#[name="poster"] #[name="poster"]
@ -73,8 +72,6 @@ impl FactoryComponent for FilmGridItem {
set_margin_bottom: 20, set_margin_bottom: 20,
#[watch] #[watch]
set_paintable: self.poster.as_ref(), set_paintable: self.poster.as_ref(),
#[watch]
set_visible: self.poster.is_some(),
}, },
#[name="name"] #[name="name"]

View file

@ -57,7 +57,6 @@ impl FactoryComponent for SeriesGridItem {
set_css_classes: &["flat", "media-grid-item"], set_css_classes: &["flat", "media-grid-item"],
gtk4::Box { gtk4::Box {
set_orientation: Orientation::Vertical, set_orientation: Orientation::Vertical,
set_valign: Align::Center,
set_margin_vertical: 20, set_margin_vertical: 20,
#[name="poster"] #[name="poster"]
@ -66,8 +65,6 @@ impl FactoryComponent for SeriesGridItem {
set_margin_bottom: 20, set_margin_bottom: 20,
#[watch] #[watch]
set_paintable: self.poster.as_ref(), set_paintable: self.poster.as_ref(),
#[watch]
set_visible: self.poster.is_some(),
}, },
#[name="name"] #[name="name"]