mirror of
https://github.com/an-anime-team/an-anime-game-launcher.git
synced 2024-11-21 20:36:01 +03:00
feat(core): updated Relm4 to 0.6.0-beta.1
This commit is contained in:
parent
3d036e6a97
commit
a122acb0b8
7 changed files with 25 additions and 37 deletions
8
Cargo.lock
generated
8
Cargo.lock
generated
|
@ -2065,9 +2065,9 @@ checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848"
|
|||
|
||||
[[package]]
|
||||
name = "relm4"
|
||||
version = "0.6.0-alpha.2"
|
||||
version = "0.6.0-beta.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7acc5e3ddd682eeb0ca33da36b821fc907017c6d7758b09ce280247b0b0ea8cd"
|
||||
checksum = "f169f698ce2e487eed2306898fcf262224a287d0e81480db4190e74cfec412cf"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"flume",
|
||||
|
@ -2083,9 +2083,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "relm4-macros"
|
||||
version = "0.6.0-alpha.2"
|
||||
version = "0.6.0-beta.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c8525ce12dcd7d2a9e9070d84b8b885600eccd0a143df6712ce34a87d001a8b7"
|
||||
checksum = "7fa06febb3685960e7c1c44e21e44a3829325940b31d1e91391a43c32020c201"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
|
|
@ -23,7 +23,7 @@ features = ["all", "genshin"]
|
|||
# path = "../anime-launcher-sdk" # ! for dev purposes only
|
||||
|
||||
[dependencies]
|
||||
relm4 = { version = "0.6.0-alpha.2", features = ["macros", "libadwaita"] }
|
||||
relm4 = { version = "0.6.0-beta.1", features = ["macros", "libadwaita"] }
|
||||
gtk = { package = "gtk4", version = "0.6", features = ["v4_8"] }
|
||||
adw = { package = "libadwaita", version = "0.3", features = ["v1_2"] }
|
||||
|
||||
|
|
|
@ -557,11 +557,11 @@ impl SimpleComponent for App {
|
|||
.detach());
|
||||
}
|
||||
|
||||
let group = RelmActionGroup::<WindowActionGroup>::new();
|
||||
let mut group = RelmActionGroup::<WindowActionGroup>::new();
|
||||
|
||||
// TODO: reduce code somehow
|
||||
|
||||
group.add_action::<LauncherFolder>(&RelmAction::new_stateless(clone!(@strong sender => move |_| {
|
||||
group.add_action::<LauncherFolder>(RelmAction::new_stateless(clone!(@strong sender => move |_| {
|
||||
if let Err(err) = open::that(LAUNCHER_FOLDER.as_path()) {
|
||||
sender.input(AppMsg::Toast {
|
||||
title: tr("launcher-folder-opening-error"),
|
||||
|
@ -572,7 +572,7 @@ impl SimpleComponent for App {
|
|||
}
|
||||
})));
|
||||
|
||||
group.add_action::<GameFolder>(&RelmAction::new_stateless(clone!(@strong sender => move |_| {
|
||||
group.add_action::<GameFolder>(RelmAction::new_stateless(clone!(@strong sender => move |_| {
|
||||
let path = match Config::get() {
|
||||
Ok(config) => config.game.path.for_edition(config.launcher.edition).to_path_buf(),
|
||||
Err(_) => CONFIG.game.path.for_edition(CONFIG.launcher.edition).to_path_buf(),
|
||||
|
@ -588,7 +588,7 @@ impl SimpleComponent for App {
|
|||
}
|
||||
})));
|
||||
|
||||
group.add_action::<ConfigFile>(&RelmAction::new_stateless(clone!(@strong sender => move |_| {
|
||||
group.add_action::<ConfigFile>(RelmAction::new_stateless(clone!(@strong sender => move |_| {
|
||||
if let Ok(file) = config_file() {
|
||||
if let Err(err) = open::that(file) {
|
||||
sender.input(AppMsg::Toast {
|
||||
|
@ -601,7 +601,7 @@ impl SimpleComponent for App {
|
|||
}
|
||||
})));
|
||||
|
||||
group.add_action::<DebugFile>(&RelmAction::new_stateless(clone!(@strong sender => move |_| {
|
||||
group.add_action::<DebugFile>(RelmAction::new_stateless(clone!(@strong sender => move |_| {
|
||||
if let Err(err) = open::that(crate::DEBUG_FILE.as_os_str()) {
|
||||
sender.input(AppMsg::Toast {
|
||||
title: tr("debug-file-opening-error"),
|
||||
|
@ -612,7 +612,7 @@ impl SimpleComponent for App {
|
|||
}
|
||||
})));
|
||||
|
||||
group.add_action::<WishUrl>(&RelmAction::new_stateless(clone!(@strong sender => move |_| {
|
||||
group.add_action::<WishUrl>(RelmAction::new_stateless(clone!(@strong sender => move |_| {
|
||||
std::thread::spawn(clone!(@strong sender => move || {
|
||||
let config = Config::get().unwrap_or_else(|_| CONFIG.clone());
|
||||
|
||||
|
@ -672,7 +672,7 @@ impl SimpleComponent for App {
|
|||
}));
|
||||
})));
|
||||
|
||||
group.add_action::<About>(&RelmAction::new_stateless(move |_| {
|
||||
group.add_action::<About>(RelmAction::new_stateless(move |_| {
|
||||
about_dialog_broker.send(AboutDialogMsg::Show);
|
||||
}));
|
||||
|
||||
|
|
|
@ -33,16 +33,12 @@ impl AsyncFactoryComponent for Variable {
|
|||
set_valign: gtk::Align::Center,
|
||||
|
||||
connect_clicked[sender, index] => move |_| {
|
||||
sender.input(EnvironmentAppMsg::Remove(index.clone()));
|
||||
sender.output(EnvironmentAppMsg::Remove(index.clone()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn output_to_parent_input(output: Self::Output) -> Option<Self::ParentInput> {
|
||||
Some(output)
|
||||
}
|
||||
|
||||
async fn init_model(
|
||||
init: Self::Init,
|
||||
_index: &DynamicIndex,
|
||||
|
@ -54,8 +50,8 @@ impl AsyncFactoryComponent for Variable {
|
|||
}
|
||||
}
|
||||
|
||||
async fn update(&mut self, msg: Self::Input, sender: AsyncFactorySender<Self>) {
|
||||
sender.output(msg);
|
||||
fn forward_to_parent(output: Self::Output) -> Option<Self::ParentInput> {
|
||||
Some(output)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -38,16 +38,12 @@ impl AsyncFactoryComponent for GameSession {
|
|||
set_valign: gtk::Align::Center,
|
||||
|
||||
connect_clicked[sender, index] => move |_| {
|
||||
sender.input(GameAppMsg::RemoveSession(index.clone()));
|
||||
sender.output(GameAppMsg::RemoveSession(index.clone()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn output_to_parent_input(output: Self::Output) -> Option<Self::ParentInput> {
|
||||
Some(output)
|
||||
}
|
||||
|
||||
async fn init_model(
|
||||
init: Self::Init,
|
||||
_index: &DynamicIndex,
|
||||
|
@ -56,8 +52,8 @@ impl AsyncFactoryComponent for GameSession {
|
|||
init
|
||||
}
|
||||
|
||||
async fn update(&mut self, msg: Self::Input, sender: AsyncFactorySender<Self>) {
|
||||
sender.output(msg);
|
||||
fn forward_to_parent(output: Self::Output) -> Option<Self::ParentInput> {
|
||||
Some(output)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -84,10 +84,6 @@ impl AsyncFactoryComponent for VoicePackageComponent {
|
|||
}
|
||||
}
|
||||
|
||||
fn output_to_parent_input(output: Self::Output) -> Option<Self::ParentInput> {
|
||||
Some(output)
|
||||
}
|
||||
|
||||
async fn init_model(
|
||||
init: Self::Init,
|
||||
_index: &DynamicIndex,
|
||||
|
@ -105,6 +101,10 @@ impl AsyncFactoryComponent for VoicePackageComponent {
|
|||
|
||||
sender.output(msg);
|
||||
}
|
||||
|
||||
fn forward_to_parent(output: Self::Output) -> Option<Self::ParentInput> {
|
||||
Some(output)
|
||||
}
|
||||
}
|
||||
|
||||
pub struct GeneralApp {
|
||||
|
|
|
@ -41,16 +41,12 @@ macro_rules! impl_directory {
|
|||
set_valign: gtk::Align::Center,
|
||||
|
||||
connect_clicked[sender, index] => move |_| {
|
||||
sender.input($msg(index.clone()));
|
||||
sender.output($msg(index.clone()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn output_to_parent_input(output: Self::Output) -> Option<Self::ParentInput> {
|
||||
Some(output)
|
||||
}
|
||||
|
||||
async fn init_model(
|
||||
init: Self::Init,
|
||||
_index: &DynamicIndex,
|
||||
|
@ -62,8 +58,8 @@ macro_rules! impl_directory {
|
|||
}
|
||||
}
|
||||
|
||||
async fn update(&mut self, msg: Self::Input, sender: AsyncFactorySender<Self>) {
|
||||
sender.output(msg);
|
||||
fn forward_to_parent(output: Self::Output) -> Option<Self::ParentInput> {
|
||||
Some(output)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue