Replace single data model with data management struct and views

This commit is contained in:
Reinout Meliesie 2025-02-04 23:46:51 +01:00
commit 7610b291a4
Signed by: zedfrigg
GPG key ID: 3AFCC06481308BC6
6 changed files with 88 additions and 96 deletions

View file

@ -4,7 +4,7 @@ mod collation_menu ;
use gtk4 :: { * , Orientation :: * , prelude :: * } ;
use crate :: {
collection :: * ,
persistence :: * ,
ui :: {
component :: * , utility :: * ,
collatable_container :: { collated_grid :: * , collation_menu :: * } ,
@ -63,7 +63,7 @@ pub struct CollatableSeriesContainer {
}
impl CollatableFilmsContainer {
pub fn new ( films : Vec <Film> ) -> Self {
pub fn new ( films : Vec <FilmOverview> ) -> Self {
let collated_grid = leak (
CollatedFilmsGrid :: new ( films , FilmsSorting :: default () ) ) ;
let film_collation_menu = FilmCollationMenu :: new ( |sorting|
@ -81,12 +81,12 @@ impl CollatableFilmsContainer {
Self { collated_grid , widget }
}
pub fn set_films ( & self , films : Vec <Film> ) {
pub fn set_films ( & self , films : Vec <FilmOverview> ) {
self . collated_grid . set_films ( films , FilmsSorting :: default () ) ;
}
}
impl CollatableSeriesContainer {
pub fn new ( series : Vec <Series> ) -> Self {
pub fn new ( series : Vec <SeriesOverview> ) -> Self {
let collated_grid = leak (
CollatedSeriesGrid :: new ( series , SeriesSorting :: default () ) ) ;
let series_collation_menu = SeriesCollationMenu :: new ( |sorting| {
@ -105,7 +105,7 @@ impl CollatableSeriesContainer {
Self { collated_grid , widget }
}
pub fn set_series ( & self , series : Vec <Series> ) {
pub fn set_series ( & self , series : Vec <SeriesOverview> ) {
self . collated_grid . set_series ( series , SeriesSorting :: default () ) ;
}
}