Use label UI macro in collection item rendering

This commit is contained in:
Reinout Meliesie 2025-02-07 13:54:44 +01:00
commit cd45d4303b
Signed by: zedfrigg
GPG key ID: 3AFCC06481308BC6
2 changed files with 30 additions and 28 deletions

View file

@ -168,35 +168,29 @@ async fn create_collection_item (
Texture :: from_filename (poster_file_path) . unwrap ()
) . await . unwrap () ;
container . append (
& image ! (
@ paintable : & poster_texture ;
@ width_request : 300 ;
@ height_request : 300 ;
@ margin_bottom : 10 ;
)
) ;
container . append ( & image ! (
@ paintable : & poster_texture ;
@ width_request : 300 ;
@ height_request : 300 ;
@ margin_bottom : 10 ;
) ) ;
}
container . append (
& Label :: builder ()
. label (name)
. attributes ( & pango_attributes ! ( @ scale : SCALE_LARGE ; @ weight : Bold ; ) )
. justify ( Justification :: Center )
. wrap (true)
. max_width_chars (1) // Not the actual limit, used instead to wrap more aggressively
. build ()
) ;
container . append ( & label ! (
@ justify : Justification :: Center ;
@ wrap : true ;
@ max_width_chars : 1 ; // Not the actual limit, used instead to wrap more aggressively
@ attributes : & pango_attributes ! ( @ scale : SCALE_LARGE ; @ weight : Bold ; ) ;
name ,
) ) ;
if let Some (original_name) = original_name {
container . append (
& Label :: builder ()
. label (original_name)
. justify ( Justification :: Center )
. wrap (true)
. max_width_chars (1) // Not the actual limit, used instead to wrap more aggressively
. build ()
) ;
container . append ( & label ! (
@ justify : Justification :: Center ;
@ wrap : true ;
@ max_width_chars : 1 ; // Not the actual limit, used instead to wrap more aggressively
original_name ,
) ) ;
}
container . append (details_widget) ;