Reimplement collation menu as component

This commit is contained in:
Reinout Meliesie 2025-01-31 15:34:09 +01:00
commit 04755fabb7
Signed by: zedfrigg
GPG key ID: 3AFCC06481308BC6
4 changed files with 133 additions and 45 deletions

View file

@ -6,18 +6,19 @@ use gtk4 :: { * , Orientation :: * , prelude :: * } ;
use crate :: {
collection :: * ,
ui :: {
component :: * , utility :: * ,
collatable_container :: { collated_grid :: * , collation_menu :: * } ,
component :: * ,
utility :: * ,
} ,
utility :: * ,
} ;
# [ derive (PartialEq) ] pub enum FilmsSortedBy { Name , ReleaseDate , Runtime }
# [ derive (PartialEq) ] pub enum SeriesSortedBy { Name , FirstReleaseDate }
# [ derive (PartialEq) ] pub enum SortingDirection { Ascending , Descending }
# [ derive ( Clone , Copy , PartialEq ) ] pub enum FilmsSortedBy { Name , ReleaseDate , Runtime }
# [ derive ( Clone , Copy , PartialEq ) ] pub enum SeriesSortedBy { Name , FirstReleaseDate }
# [ derive ( Clone , Copy , PartialEq ) ] pub enum SortingDirection { Ascending , Descending }
pub struct FilmSorting { property : FilmsSortedBy , direction : SortingDirection }
pub struct CollatableFilmsContainer {
collated_grid : & 'static CollatedFilmsGrid ,
@ -37,8 +38,8 @@ impl CollatableFilmsContainer {
let widget = g_box ! (
@ orientation : Vertical ,
film_collation_menu . get_widget () ,
& create_collection_scrolled_window ( collated_grid . get_widget () ) ,
* film_collation_menu . get_widget () ,
create_collection_scrolled_window ( collated_grid . get_widget () ) ,
) ;
Self { collated_grid , widget }
@ -58,8 +59,8 @@ impl CollatableSeriesContainer {
let widget = g_box ! (
@ orientation : Vertical ,
series_collation_menu . get_widget () ,
& create_collection_scrolled_window ( collated_grid . get_widget () ) ,
* series_collation_menu . get_widget () ,
create_collection_scrolled_window ( collated_grid . get_widget () ) ,
) ;
Self { collated_grid , widget }
@ -79,7 +80,7 @@ impl Component <Box> for CollatableSeriesContainer {
fn create_collection_scrolled_window ( child : & FlowBox ) -> ScrolledWindow {
ScrolledWindow :: builder ()
. child ( & vertically_filling ! (child) )
. child ( & vertically_filling ! ( * child ) )
. propagate_natural_height (true)
. build ()
}