Make get_collection_from_file async

This commit is contained in:
Reinout Meliesie 2024-12-22 21:02:39 +01:00
parent 183efaa047
commit f1751882be
Signed by: zedfrigg
GPG key ID: 3AFCC06481308BC6
4 changed files with 83 additions and 53 deletions

View file

@ -4,10 +4,7 @@ mod persistence ;
mod ui ;
mod utility ;
use {
gtk4 :: { gio :: spawn_blocking , glib :: * } ,
libadwaita :: { * , prelude :: * } ,
} ;
use { gtk4 :: glib :: * , libadwaita :: { * , prelude :: * } } ;
use crate :: { error :: { * , ZoodexError :: * } , persistence :: * , ui :: * } ;
@ -28,10 +25,8 @@ fn on_activate ( app : & Application ) {
spawn_future_local ( async move {
async_unit_result_context (
async {
let collection = spawn_blocking ( ||
get_collection_from_file () ) . await ? ? ;
let collection = get_collection_from_file () . await ? ;
ui . render_collection (collection) ;
Ok (())
} ,
|error| {