mod application_header_bar ; mod collatable_container ; mod collection_view_stack ; mod component ; mod utility ; use gtk4 :: Orientation :: * ; use gtk4 :: prelude :: * ; use libadwaita :: * ; use crate :: data_manager :: * ; use crate :: ui :: application_header_bar :: * ; use crate :: ui :: collatable_container :: * ; use crate :: ui :: collection_view_stack :: * ; use crate :: ui :: component :: * ; use crate :: ui :: utility :: * ; pub struct UI { window : ApplicationWindow , films_component : CollatableFilmsContainer , series_component : CollatableSeriesContainer , } impl UI { pub fn new ( application : & Application ) -> UI { let films_component = CollatableFilmsContainer :: new () ; let series_component = CollatableSeriesContainer :: new () ; let switch_component = CollectionViewStack :: new ( & films_component , & series_component ) ; let header_bar = ApplicationHeaderBar :: new ( & switch_component ) ; let window = application_window ! ( @ application : application ; @ title : "Zoƶdex" ; g_box ! ( @ orientation : Vertical ; * header_bar . get_widget () , * switch_component . get_widget () , ) , ) ; UI { window , films_component , series_component } } pub fn show_window ( & self ) { self . window . set_visible (true) } pub fn close_window ( & self ) { self . window . close () } pub async fn render_collection_overview ( & self , collection : CollectionOverview ) { // TODO: Find a way to await these futures concurrently self . films_component . set_films ( collection . films ) . await ; self . series_component . set_series ( collection . series ) . await ; } }