diff --git a/Cargo.toml b/Cargo.toml index 0fefe37..921bb68 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,4 +17,4 @@ serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" dirs = "4.0.0" -# tokio = { version = "1.19.2", features = ["rt", "rt-multi-thread", "macros"]} +tokio = { version = "1.19.2", features = ["rt", "rt-multi-thread", "macros"] } diff --git a/anime-game-core b/anime-game-core index 9fd1413..527a8d1 160000 --- a/anime-game-core +++ b/anime-game-core @@ -1 +1 @@ -Subproject commit 9fd14137eaf494f2e6647c12f854c6cd0c20ebd2 +Subproject commit 527a8d12e6e9fcea7bb696254657c937cb2e7f86 diff --git a/assets/dxvk.json b/assets/dxvk.json index 5a6d64c..e62b6c5 100644 --- a/assets/dxvk.json +++ b/assets/dxvk.json @@ -1,5 +1,10 @@ { "vanilla": [ + { + "version": "1.10.2", + "uri": "https://github.com/doitsujin/dxvk/releases/download/v1.10.2/dxvk-1.10.2.tar.gz", + "recommended": true + }, { "version": "1.10.1", "uri": "https://github.com/doitsujin/dxvk/releases/download/v1.10.1/dxvk-1.10.1.tar.gz", diff --git a/blueprint-compiler b/blueprint-compiler index 75475d1..664fa22 160000 --- a/blueprint-compiler +++ b/blueprint-compiler @@ -1 +1 @@ -Subproject commit 75475d1a457dce5fc8d66a2156e4489fe4204420 +Subproject commit 664fa2250b02f64f2c1d8afd82801ab01e353c78 diff --git a/src/lib/mod.rs b/src/lib/mod.rs index 284e078..234967f 100644 --- a/src/lib/mod.rs +++ b/src/lib/mod.rs @@ -2,3 +2,4 @@ pub mod consts; pub mod config; pub mod game; pub mod dxvk; +pub mod tasks; diff --git a/src/lib/tasks.rs b/src/lib/tasks.rs new file mode 100644 index 0000000..45fe4ca --- /dev/null +++ b/src/lib/tasks.rs @@ -0,0 +1,8 @@ +use std::future::Future; + +pub fn run(future: T) where + T: Future + Send + 'static, + ::Output: Send +{ + tokio::task::spawn(future); +} diff --git a/src/main.rs b/src/main.rs index 3cdc125..a91be12 100644 --- a/src/main.rs +++ b/src/main.rs @@ -8,8 +8,8 @@ pub mod lib; use ui::*; -// #[tokio::main] -fn main() { +#[tokio::main] +async fn main() { gtk::init().expect("GTK initialization failed"); adw::init(); diff --git a/src/ui/main.rs b/src/ui/main.rs index d9e7eec..2ca53ff 100644 --- a/src/ui/main.rs +++ b/src/ui/main.rs @@ -13,6 +13,7 @@ use super::preferences::PreferencesStack; use super::ToastError; use crate::lib::game; +use crate::lib::tasks; /// This structure is used to describe widgets used in application /// @@ -154,21 +155,20 @@ impl App { let values = this.values.take(); // Some debug output - println!("[update] action: {:?}, values: {:?}", &action, &values); + println!("[main] [update] action: {:?}, values: {:?}", &action, &values); match action { Actions::OpenPreferencesPage => { this.widgets.leaflet.set_visible_child_name("preferences_page"); - if let Err(err) = this.widgets.preferences_stack.update() { - this.toast_error("Failed to update preferences", err); - } - - /*tokio::task::spawn(async { - if let Err(err) = this.widgets.preferences_stack.update().await { - // this.update(Actions::ToastError(Rc::new((String::from("Failed to update preferences"), err)))); + tasks::run(clone!(@strong this => async move { + if let Err(err) = this.widgets.preferences_stack.update() { + glib::MainContext::default().invoke(move || { + this.update(Actions::PreferencesGoBack); + this.toast_error("Failed to update preferences", err); + }); } - });*/ + })); } Actions::PreferencesGoBack => { diff --git a/src/ui/preferences/general_page.rs b/src/ui/preferences/general_page.rs index edf0f33..5fd95da 100644 --- a/src/ui/preferences/general_page.rs +++ b/src/ui/preferences/general_page.rs @@ -171,7 +171,7 @@ impl App { let values = this.values.take(); // Some debug output - println!("[update] action: {:?}, values: {:?}", &action, &values); + println!("[general page] [update] action: {:?}, values: {:?}", &action, &values); match action { Actions::DownloadDXVK(i) => {