mirror of
https://github.com/an-anime-team/an-anime-game-launcher.git
synced 2025-02-03 14:30:50 +03:00
Made proper voice packages processing in state getting
This commit is contained in:
parent
bc5b9d2b45
commit
a4df021a2d
3 changed files with 23 additions and 3 deletions
|
@ -1 +1 @@
|
|||
Subproject commit 8a0dd62b38a0e1c0847a2665fe49961d4ed2a25d
|
||||
Subproject commit 659ffce54f88c40af8cbef4100fbd68c754b4b44
|
|
@ -1,6 +1,8 @@
|
|||
use gtk4::{self as gtk, prelude::*};
|
||||
use libadwaita::{self as adw, prelude::*};
|
||||
|
||||
use std::io::{Error, ErrorKind};
|
||||
|
||||
use anime_game_core::prelude::*;
|
||||
|
||||
use crate::lib::config;
|
||||
|
@ -52,11 +54,25 @@ impl LauncherState {
|
|||
status_page.set_description(Some("Updating voice info..."));
|
||||
}
|
||||
|
||||
for voice_package in game.get_voice_packages()? {
|
||||
for voice_package in &config.game.voices {
|
||||
let mut voice_package = VoicePackage::with_locale(match VoiceLocale::from_str(voice_package) {
|
||||
Some(locale) => locale,
|
||||
None => return Err(Error::new(ErrorKind::Other, format!("Incorrect voice locale \"{}\" specified in the config", voice_package)))
|
||||
})?;
|
||||
|
||||
if let Some(status_page) = &status_page {
|
||||
status_page.set_description(Some(format!("Updating voice info ({})...", voice_package.locale().to_name()).as_str()));
|
||||
}
|
||||
|
||||
// Replace voice package struct with the one constructed in the game's folder
|
||||
// so it'll properly calculate its difference instead of saying "not installed"
|
||||
if voice_package.is_installed_in(&config.game.path) {
|
||||
voice_package = match VoicePackage::new(get_voice_package_path(&config.game.path, voice_package.locale())) {
|
||||
Some(locale) => locale,
|
||||
None => return Err(Error::new(ErrorKind::Other, format!("Failed to load {} voice package", voice_package.locale().to_name())))
|
||||
};
|
||||
}
|
||||
|
||||
let diff = voice_package.try_get_diff()?;
|
||||
|
||||
match diff {
|
||||
|
|
|
@ -143,7 +143,11 @@ impl App {
|
|||
result.widgets.status_page.set_visible(false);
|
||||
result.widgets.launcher_content.set_visible(true);
|
||||
},
|
||||
Err(err) => result.toast_error("Failed to get initial launcher state", err)
|
||||
Err(err) => {
|
||||
glib::MainContext::default().invoke(move || {
|
||||
result.toast_error("Failed to get initial launcher state", err);
|
||||
});
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue