mirror of
https://github.com/an-anime-team/sleepy-launcher.git
synced 2025-03-15 14:38:29 +03:00
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]]
|
||||
name = "anime-game-core"
|
||||
version = "0.3.2"
|
||||
version = "0.3.4"
|
||||
dependencies = [
|
||||
"bzip2",
|
||||
"curl",
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 7c1279a6c3df8ea1eda70064aaa5b7b340aef4ce
|
||||
Subproject commit ea6d8638d8167badf2ef1753621560003412e3c8
|
|
@ -9,7 +9,6 @@ Gtk.Box page {
|
|||
Adw.PreferencesGroup {
|
||||
Gtk.Label {
|
||||
label: "Set default paths";
|
||||
margin-top: 16;
|
||||
|
||||
styles ["title-1"]
|
||||
}
|
||||
|
@ -39,6 +38,11 @@ Gtk.Box page {
|
|||
activatable: true;
|
||||
}
|
||||
|
||||
Adw.ActionRow patch_folder {
|
||||
title: "Patch storing folder";
|
||||
activatable: true;
|
||||
}
|
||||
|
||||
Adw.ActionRow temp_folder {
|
||||
title: "Temp data saving folder";
|
||||
activatable: true;
|
||||
|
|
|
@ -9,7 +9,7 @@ use wait_not_await::Await;
|
|||
use crate::lib::config;
|
||||
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(
|
||||
Some("Select folder"),
|
||||
Some(parent),
|
||||
|
@ -32,7 +32,10 @@ pub fn choose_dir<T: IsA<gtk::Window>>(current_folder: String, parent: &T) -> Aw
|
|||
dialogue.show();
|
||||
|
||||
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 prefix_folder: adw::ActionRow,
|
||||
pub game_folder: adw::ActionRow,
|
||||
pub patch_folder: adw::ActionRow,
|
||||
pub temp_folder: adw::ActionRow,
|
||||
|
||||
pub continue_button: gtk::Button,
|
||||
|
@ -63,6 +67,7 @@ impl Page {
|
|||
dxvk_folder: get_object(&builder, "dxvk_folder")?,
|
||||
prefix_folder: get_object(&builder, "prefix_folder")?,
|
||||
game_folder: get_object(&builder, "game_folder")?,
|
||||
patch_folder: get_object(&builder, "patch_folder")?,
|
||||
temp_folder: get_object(&builder, "temp_folder")?,
|
||||
|
||||
continue_button: get_object(&builder, "continue_button")?,
|
||||
|
@ -79,6 +84,7 @@ impl Page {
|
|||
result.dxvk_folder.set_subtitle(&config.game.dxvk.builds);
|
||||
result.prefix_folder.set_subtitle(&config.game.wine.prefix);
|
||||
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 {
|
||||
Some(temp) => temp,
|
||||
None => String::from("/tmp")
|
||||
|
@ -89,6 +95,7 @@ impl Page {
|
|||
result.connect_activated(&result.dxvk_folder);
|
||||
result.connect_activated(&result.prefix_folder);
|
||||
result.connect_activated(&result.game_folder);
|
||||
result.connect_activated(&result.patch_folder);
|
||||
result.connect_activated(&result.temp_folder);
|
||||
|
||||
Ok(result)
|
||||
|
@ -99,7 +106,9 @@ impl Page {
|
|||
let (sender, receiver) = glib::MainContext::channel::<String>(glib::PRIORITY_DEFAULT);
|
||||
|
||||
choose_dir(row.subtitle().unwrap().to_string(), &window).then(move |path| {
|
||||
sender.send(path.clone()).unwrap();
|
||||
if let Some(path) = path {
|
||||
sender.send(path.clone()).unwrap();
|
||||
}
|
||||
});
|
||||
|
||||
let row = row.clone();
|
||||
|
@ -117,6 +126,7 @@ impl Page {
|
|||
config.game.dxvk.builds = self.dxvk_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.patch.path = self.patch_folder.subtitle().unwrap().to_string();
|
||||
config.launcher.temp = Some(self.temp_folder.subtitle().unwrap().to_string());
|
||||
|
||||
config
|
||||
|
|
|
@ -474,7 +474,9 @@ impl App {
|
|||
LauncherState::GameUpdateAvailable(diff) |
|
||||
LauncherState::GameNotInstalled(diff) => {
|
||||
let (sender, receiver) = glib::MainContext::channel::<InstallerUpdate>(glib::PRIORITY_DEFAULT);
|
||||
|
||||
let this = this.clone();
|
||||
let this_copy = this.clone();
|
||||
|
||||
this.update(Actions::ShowProgressBar).unwrap();
|
||||
|
||||
|
@ -516,9 +518,15 @@ impl App {
|
|||
|
||||
// Download diff in separate thread to not to freeze the main one
|
||||
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();
|
||||
}).unwrap();
|
||||
});
|
||||
|
||||
if let Err(err) = result {
|
||||
this_copy.update(Actions::Toast(Rc::new((
|
||||
String::from("Downloading failed"), err.into()
|
||||
)))).unwrap();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue