Several changes
- updated core library; this fixes getting available space on systems with lots of disks - added patch folder selection during initial setup - fixed error panicking when you're closing folder selection dialogue during initial setup
This commit is contained in:
parent
a425c3cddf
commit
bcdb0217ad
5 changed files with 30 additions and 8 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -31,7 +31,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anime-game-core"
|
name = "anime-game-core"
|
||||||
version = "0.3.2"
|
version = "0.3.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bzip2",
|
"bzip2",
|
||||||
"curl",
|
"curl",
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 7c1279a6c3df8ea1eda70064aaa5b7b340aef4ce
|
Subproject commit ea6d8638d8167badf2ef1753621560003412e3c8
|
|
@ -9,7 +9,6 @@ Gtk.Box page {
|
||||||
Adw.PreferencesGroup {
|
Adw.PreferencesGroup {
|
||||||
Gtk.Label {
|
Gtk.Label {
|
||||||
label: "Set default paths";
|
label: "Set default paths";
|
||||||
margin-top: 16;
|
|
||||||
|
|
||||||
styles ["title-1"]
|
styles ["title-1"]
|
||||||
}
|
}
|
||||||
|
@ -39,6 +38,11 @@ Gtk.Box page {
|
||||||
activatable: true;
|
activatable: true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Adw.ActionRow patch_folder {
|
||||||
|
title: "Patch storing folder";
|
||||||
|
activatable: true;
|
||||||
|
}
|
||||||
|
|
||||||
Adw.ActionRow temp_folder {
|
Adw.ActionRow temp_folder {
|
||||||
title: "Temp data saving folder";
|
title: "Temp data saving folder";
|
||||||
activatable: true;
|
activatable: true;
|
||||||
|
|
|
@ -9,7 +9,7 @@ use wait_not_await::Await;
|
||||||
use crate::lib::config;
|
use crate::lib::config;
|
||||||
use crate::ui::*;
|
use crate::ui::*;
|
||||||
|
|
||||||
pub fn choose_dir<T: IsA<gtk::Window>>(current_folder: String, parent: &T) -> Await<String> {
|
pub fn choose_dir<T: IsA<gtk::Window>>(current_folder: String, parent: &T) -> Await<Option<String>> {
|
||||||
let dialogue = gtk::FileChooserDialog::new(
|
let dialogue = gtk::FileChooserDialog::new(
|
||||||
Some("Select folder"),
|
Some("Select folder"),
|
||||||
Some(parent),
|
Some(parent),
|
||||||
|
@ -32,7 +32,10 @@ pub fn choose_dir<T: IsA<gtk::Window>>(current_folder: String, parent: &T) -> Aw
|
||||||
dialogue.show();
|
dialogue.show();
|
||||||
|
|
||||||
Await::new(move || {
|
Await::new(move || {
|
||||||
receiver.recv().unwrap()
|
match receiver.recv() {
|
||||||
|
Ok(path) => Some(path),
|
||||||
|
Err(_) => None
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,6 +48,7 @@ pub struct Page {
|
||||||
pub dxvk_folder: adw::ActionRow,
|
pub dxvk_folder: adw::ActionRow,
|
||||||
pub prefix_folder: adw::ActionRow,
|
pub prefix_folder: adw::ActionRow,
|
||||||
pub game_folder: adw::ActionRow,
|
pub game_folder: adw::ActionRow,
|
||||||
|
pub patch_folder: adw::ActionRow,
|
||||||
pub temp_folder: adw::ActionRow,
|
pub temp_folder: adw::ActionRow,
|
||||||
|
|
||||||
pub continue_button: gtk::Button,
|
pub continue_button: gtk::Button,
|
||||||
|
@ -63,6 +67,7 @@ impl Page {
|
||||||
dxvk_folder: get_object(&builder, "dxvk_folder")?,
|
dxvk_folder: get_object(&builder, "dxvk_folder")?,
|
||||||
prefix_folder: get_object(&builder, "prefix_folder")?,
|
prefix_folder: get_object(&builder, "prefix_folder")?,
|
||||||
game_folder: get_object(&builder, "game_folder")?,
|
game_folder: get_object(&builder, "game_folder")?,
|
||||||
|
patch_folder: get_object(&builder, "patch_folder")?,
|
||||||
temp_folder: get_object(&builder, "temp_folder")?,
|
temp_folder: get_object(&builder, "temp_folder")?,
|
||||||
|
|
||||||
continue_button: get_object(&builder, "continue_button")?,
|
continue_button: get_object(&builder, "continue_button")?,
|
||||||
|
@ -79,6 +84,7 @@ impl Page {
|
||||||
result.dxvk_folder.set_subtitle(&config.game.dxvk.builds);
|
result.dxvk_folder.set_subtitle(&config.game.dxvk.builds);
|
||||||
result.prefix_folder.set_subtitle(&config.game.wine.prefix);
|
result.prefix_folder.set_subtitle(&config.game.wine.prefix);
|
||||||
result.game_folder.set_subtitle(&config.game.path);
|
result.game_folder.set_subtitle(&config.game.path);
|
||||||
|
result.patch_folder.set_subtitle(&config.patch.path);
|
||||||
result.temp_folder.set_subtitle(&match config.launcher.temp {
|
result.temp_folder.set_subtitle(&match config.launcher.temp {
|
||||||
Some(temp) => temp,
|
Some(temp) => temp,
|
||||||
None => String::from("/tmp")
|
None => String::from("/tmp")
|
||||||
|
@ -89,6 +95,7 @@ impl Page {
|
||||||
result.connect_activated(&result.dxvk_folder);
|
result.connect_activated(&result.dxvk_folder);
|
||||||
result.connect_activated(&result.prefix_folder);
|
result.connect_activated(&result.prefix_folder);
|
||||||
result.connect_activated(&result.game_folder);
|
result.connect_activated(&result.game_folder);
|
||||||
|
result.connect_activated(&result.patch_folder);
|
||||||
result.connect_activated(&result.temp_folder);
|
result.connect_activated(&result.temp_folder);
|
||||||
|
|
||||||
Ok(result)
|
Ok(result)
|
||||||
|
@ -99,7 +106,9 @@ impl Page {
|
||||||
let (sender, receiver) = glib::MainContext::channel::<String>(glib::PRIORITY_DEFAULT);
|
let (sender, receiver) = glib::MainContext::channel::<String>(glib::PRIORITY_DEFAULT);
|
||||||
|
|
||||||
choose_dir(row.subtitle().unwrap().to_string(), &window).then(move |path| {
|
choose_dir(row.subtitle().unwrap().to_string(), &window).then(move |path| {
|
||||||
|
if let Some(path) = path {
|
||||||
sender.send(path.clone()).unwrap();
|
sender.send(path.clone()).unwrap();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let row = row.clone();
|
let row = row.clone();
|
||||||
|
@ -117,6 +126,7 @@ impl Page {
|
||||||
config.game.dxvk.builds = self.dxvk_folder.subtitle().unwrap().to_string();
|
config.game.dxvk.builds = self.dxvk_folder.subtitle().unwrap().to_string();
|
||||||
config.game.wine.prefix = self.prefix_folder.subtitle().unwrap().to_string();
|
config.game.wine.prefix = self.prefix_folder.subtitle().unwrap().to_string();
|
||||||
config.game.path = self.game_folder.subtitle().unwrap().to_string();
|
config.game.path = self.game_folder.subtitle().unwrap().to_string();
|
||||||
|
config.patch.path = self.patch_folder.subtitle().unwrap().to_string();
|
||||||
config.launcher.temp = Some(self.temp_folder.subtitle().unwrap().to_string());
|
config.launcher.temp = Some(self.temp_folder.subtitle().unwrap().to_string());
|
||||||
|
|
||||||
config
|
config
|
||||||
|
|
|
@ -474,7 +474,9 @@ impl App {
|
||||||
LauncherState::GameUpdateAvailable(diff) |
|
LauncherState::GameUpdateAvailable(diff) |
|
||||||
LauncherState::GameNotInstalled(diff) => {
|
LauncherState::GameNotInstalled(diff) => {
|
||||||
let (sender, receiver) = glib::MainContext::channel::<InstallerUpdate>(glib::PRIORITY_DEFAULT);
|
let (sender, receiver) = glib::MainContext::channel::<InstallerUpdate>(glib::PRIORITY_DEFAULT);
|
||||||
|
|
||||||
let this = this.clone();
|
let this = this.clone();
|
||||||
|
let this_copy = this.clone();
|
||||||
|
|
||||||
this.update(Actions::ShowProgressBar).unwrap();
|
this.update(Actions::ShowProgressBar).unwrap();
|
||||||
|
|
||||||
|
@ -516,9 +518,15 @@ impl App {
|
||||||
|
|
||||||
// Download diff in separate thread to not to freeze the main one
|
// Download diff in separate thread to not to freeze the main one
|
||||||
std::thread::spawn(move || {
|
std::thread::spawn(move || {
|
||||||
diff.install_to_by(config.game.path, config.launcher.temp, move |state| {
|
let result = diff.install_to_by(config.game.path, config.launcher.temp, move |state| {
|
||||||
sender.send(state).unwrap();
|
sender.send(state).unwrap();
|
||||||
}).unwrap();
|
});
|
||||||
|
|
||||||
|
if let Err(err) = result {
|
||||||
|
this_copy.update(Actions::Toast(Rc::new((
|
||||||
|
String::from("Downloading failed"), err.into()
|
||||||
|
)))).unwrap();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue