From 18d6eedb15e7f74a5a97bbfabd178ad6e35b8927 Mon Sep 17 00:00:00 2001 From: Reinout Meliesie Date: Mon, 26 Jan 2026 18:24:15 +0100 Subject: [PATCH] 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. --- src/persist/file_system_manager.rs | 4 ++++ src/ui/components/media_grid_item/film_grid_item.rs | 3 --- src/ui/components/media_grid_item/series_grid_item.rs | 3 --- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/persist/file_system_manager.rs b/src/persist/file_system_manager.rs index 7239800..0033aa7 100644 --- a/src/persist/file_system_manager.rs +++ b/src/persist/file_system_manager.rs @@ -22,6 +22,10 @@ impl FileSystemManager { } pub async fn poster(&self, uuid: &str) -> Result, 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 texture = spawn_blocking(move || Texture::from_filename(file_path)) .await diff --git a/src/ui/components/media_grid_item/film_grid_item.rs b/src/ui/components/media_grid_item/film_grid_item.rs index d9c58cd..029e27d 100644 --- a/src/ui/components/media_grid_item/film_grid_item.rs +++ b/src/ui/components/media_grid_item/film_grid_item.rs @@ -64,7 +64,6 @@ impl FactoryComponent for FilmGridItem { gtk4::Box { set_orientation: Orientation::Vertical, - set_valign: Align::Center, set_margin_vertical: 20, #[name="poster"] @@ -73,8 +72,6 @@ impl FactoryComponent for FilmGridItem { set_margin_bottom: 20, #[watch] set_paintable: self.poster.as_ref(), - #[watch] - set_visible: self.poster.is_some(), }, #[name="name"] diff --git a/src/ui/components/media_grid_item/series_grid_item.rs b/src/ui/components/media_grid_item/series_grid_item.rs index 478a371..ed49981 100644 --- a/src/ui/components/media_grid_item/series_grid_item.rs +++ b/src/ui/components/media_grid_item/series_grid_item.rs @@ -57,7 +57,6 @@ impl FactoryComponent for SeriesGridItem { set_css_classes: &["flat", "media-grid-item"], gtk4::Box { set_orientation: Orientation::Vertical, - set_valign: Align::Center, set_margin_vertical: 20, #[name="poster"] @@ -66,8 +65,6 @@ impl FactoryComponent for SeriesGridItem { set_margin_bottom: 20, #[watch] set_paintable: self.poster.as_ref(), - #[watch] - set_visible: self.poster.is_some(), }, #[name="name"]