Initial commit, part deux

This commit is contained in:
Reinout Meliesie 2024-11-20 16:32:37 +01:00
parent 4a7beace84
commit fd5ee1420c
Signed by: zedfrigg
GPG key ID: 3AFCC06481308BC6
10 changed files with 1463 additions and 0 deletions

36
src/main.rs Normal file
View file

@ -0,0 +1,36 @@
mod collection ;
mod persistence ;
mod ui ;
mod utility ;
use {
gtk4 :: { gio :: spawn_blocking , glib :: * } ,
libadwaita :: { * , prelude :: * } ,
} ;
use crate :: { persistence :: * , ui :: * } ;
fn main () -> ExitCode {
let application = Application :: builder ()
. application_id ("com.kernelmaft.zoodex")
. build () ;
application . connect_activate (on_activate) ;
application . run ()
}
fn on_activate ( app : & Application ) {
let mut ui = UI :: new (app) ;
let collection_handle = spawn_blocking ( ||
read_collection_file () . unwrap ()
) ;
ui . show_window () ;
spawn_future_local ( async move {
let collection = collection_handle . await . unwrap () ;
ui . render_collection (collection) ;
} ) ;
}