Encapsulate window and its operations in struct
This commit is contained in:
parent
8bea2088a0
commit
90594514bd
2 changed files with 27 additions and 12 deletions
11
src/main.rs
11
src/main.rs
|
|
@ -8,7 +8,7 @@ use gtk4 :: style_context_add_provider_for_display ;
|
|||
use gtk4 :: STYLE_PROVIDER_PRIORITY_APPLICATION ;
|
||||
use gtk4 :: gdk :: * ;
|
||||
use gtk4 :: glib :: * ;
|
||||
use libadwaita :: * ;
|
||||
use libadwaita :: Application ;
|
||||
use libadwaita :: prelude :: * ;
|
||||
|
||||
use crate :: data_manager :: * ;
|
||||
|
|
@ -39,12 +39,7 @@ fn add_style_provider ( _ : & Application ) {
|
|||
}
|
||||
|
||||
fn show_window ( application : & Application ) {
|
||||
let window = leak (
|
||||
ApplicationWindow :: builder ()
|
||||
. application (application)
|
||||
. title ("Zoödex")
|
||||
. build ()
|
||||
) ;
|
||||
let window = leak ( Window :: new (application) ) ;
|
||||
|
||||
spawn_future_local ( async move {
|
||||
async_result_context ! (
|
||||
|
|
@ -57,7 +52,7 @@ fn show_window ( application : & Application ) {
|
|||
data_manager . get_film_details (film_uuid) . await . unwrap ()
|
||||
} ) ,
|
||||
) ;
|
||||
window . set_visible (true) ;
|
||||
window . show () ;
|
||||
|
||||
let collection = data_manager . get_collection_overview () . await ? ;
|
||||
ui . render_collection_overview (collection) . await ;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue