mirror of
https://github.com/an-anime-team/an-anime-game-launcher.git
synced 2024-11-25 14:26:16 +03:00
Added async preferences opening
May show white screen with no controls for unknown reason
This commit is contained in:
parent
9817cbd989
commit
8c0685836f
9 changed files with 29 additions and 15 deletions
|
@ -17,4 +17,4 @@ serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
|
|
||||||
dirs = "4.0.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"] }
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 9fd14137eaf494f2e6647c12f854c6cd0c20ebd2
|
Subproject commit 527a8d12e6e9fcea7bb696254657c937cb2e7f86
|
|
@ -1,5 +1,10 @@
|
||||||
{
|
{
|
||||||
"vanilla": [
|
"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",
|
"version": "1.10.1",
|
||||||
"uri": "https://github.com/doitsujin/dxvk/releases/download/v1.10.1/dxvk-1.10.1.tar.gz",
|
"uri": "https://github.com/doitsujin/dxvk/releases/download/v1.10.1/dxvk-1.10.1.tar.gz",
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 75475d1a457dce5fc8d66a2156e4489fe4204420
|
Subproject commit 664fa2250b02f64f2c1d8afd82801ab01e353c78
|
|
@ -2,3 +2,4 @@ pub mod consts;
|
||||||
pub mod config;
|
pub mod config;
|
||||||
pub mod game;
|
pub mod game;
|
||||||
pub mod dxvk;
|
pub mod dxvk;
|
||||||
|
pub mod tasks;
|
||||||
|
|
8
src/lib/tasks.rs
Normal file
8
src/lib/tasks.rs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
use std::future::Future;
|
||||||
|
|
||||||
|
pub fn run<T>(future: T) where
|
||||||
|
T: Future + Send + 'static,
|
||||||
|
<T as Future>::Output: Send
|
||||||
|
{
|
||||||
|
tokio::task::spawn(future);
|
||||||
|
}
|
|
@ -8,8 +8,8 @@ pub mod lib;
|
||||||
|
|
||||||
use ui::*;
|
use ui::*;
|
||||||
|
|
||||||
// #[tokio::main]
|
#[tokio::main]
|
||||||
fn main() {
|
async fn main() {
|
||||||
gtk::init().expect("GTK initialization failed");
|
gtk::init().expect("GTK initialization failed");
|
||||||
adw::init();
|
adw::init();
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ use super::preferences::PreferencesStack;
|
||||||
use super::ToastError;
|
use super::ToastError;
|
||||||
|
|
||||||
use crate::lib::game;
|
use crate::lib::game;
|
||||||
|
use crate::lib::tasks;
|
||||||
|
|
||||||
/// This structure is used to describe widgets used in application
|
/// This structure is used to describe widgets used in application
|
||||||
///
|
///
|
||||||
|
@ -154,21 +155,20 @@ impl App {
|
||||||
let values = this.values.take();
|
let values = this.values.take();
|
||||||
|
|
||||||
// Some debug output
|
// Some debug output
|
||||||
println!("[update] action: {:?}, values: {:?}", &action, &values);
|
println!("[main] [update] action: {:?}, values: {:?}", &action, &values);
|
||||||
|
|
||||||
match action {
|
match action {
|
||||||
Actions::OpenPreferencesPage => {
|
Actions::OpenPreferencesPage => {
|
||||||
this.widgets.leaflet.set_visible_child_name("preferences_page");
|
this.widgets.leaflet.set_visible_child_name("preferences_page");
|
||||||
|
|
||||||
|
tasks::run(clone!(@strong this => async move {
|
||||||
if let Err(err) = this.widgets.preferences_stack.update() {
|
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);
|
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))));
|
|
||||||
}
|
|
||||||
});*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Actions::PreferencesGoBack => {
|
Actions::PreferencesGoBack => {
|
||||||
|
|
|
@ -171,7 +171,7 @@ impl App {
|
||||||
let values = this.values.take();
|
let values = this.values.take();
|
||||||
|
|
||||||
// Some debug output
|
// Some debug output
|
||||||
println!("[update] action: {:?}, values: {:?}", &action, &values);
|
println!("[general page] [update] action: {:?}, values: {:?}", &action, &values);
|
||||||
|
|
||||||
match action {
|
match action {
|
||||||
Actions::DownloadDXVK(i) => {
|
Actions::DownloadDXVK(i) => {
|
||||||
|
|
Loading…
Reference in a new issue