fix(ui): further GtkSwitch UI state fixes

This commit is contained in:
Observer KRypt0n_ 2024-03-24 12:18:29 +02:00
parent bd439cc941
commit 0f1f7b8a4a
No known key found for this signature in database
GPG key ID: 844DA47BA25FE1E2
4 changed files with 14 additions and 14 deletions

View file

@ -51,7 +51,7 @@ impl SimpleAsyncComponent for SelectVoiceoversApp {
#[local_ref]
add_suffix = english -> gtk::Switch {
set_valign: gtk::Align::Center,
set_state: true
set_active: true
}
},

View file

@ -135,12 +135,12 @@ impl SimpleAsyncComponent for SandboxPage {
add_suffix = &gtk::Switch {
set_valign: gtk::Align::Center,
set_state: CONFIG.sandbox.enabled,
set_active: CONFIG.sandbox.enabled,
connect_state_notify => |switch| {
if is_ready() {
if let Ok(mut config) = Config::get() {
config.sandbox.enabled = switch.state();
config.sandbox.enabled = switch.is_active();
Config::update(config);
}
@ -156,12 +156,12 @@ impl SimpleAsyncComponent for SandboxPage {
add_suffix = &gtk::Switch {
set_valign: gtk::Align::Center,
set_state: CONFIG.sandbox.isolate_home,
set_active: CONFIG.sandbox.isolate_home,
connect_state_notify => |switch| {
if is_ready() {
if let Ok(mut config) = Config::get() {
config.sandbox.isolate_home = switch.state();
config.sandbox.isolate_home = switch.is_active();
Config::update(config);
}

View file

@ -109,11 +109,11 @@ impl SimpleAsyncComponent for ComponentsPage {
set_valign: gtk::Align::Center,
#[block_signal(wine_recommended_notify)]
set_state: true,
set_active: true,
connect_state_notify[sender] => move |switch| {
if is_ready() {
sender.input(ComponentsPageMsg::WineRecommendedOnly(switch.state()));
sender.input(ComponentsPageMsg::WineRecommendedOnly(switch.is_active()));
}
} @wine_recommended_notify
}
@ -135,12 +135,12 @@ impl SimpleAsyncComponent for ComponentsPage {
set_valign: gtk::Align::Center,
#[block_signal(wine_shared_libraries_notify)]
set_state: CONFIG.game.wine.shared_libraries.wine,
set_active: CONFIG.game.wine.shared_libraries.wine,
connect_state_notify => |switch| {
if is_ready() {
if let Ok(mut config) = Config::get() {
config.game.wine.shared_libraries.wine = switch.state();
config.game.wine.shared_libraries.wine = switch.is_active();
Config::update(config);
}
@ -157,12 +157,12 @@ impl SimpleAsyncComponent for ComponentsPage {
set_valign: gtk::Align::Center,
#[block_signal(gstreamer_shared_libraries_notify)]
set_state: CONFIG.game.wine.shared_libraries.gstreamer,
set_active: CONFIG.game.wine.shared_libraries.gstreamer,
connect_state_notify => |switch| {
if is_ready() {
if let Ok(mut config) = Config::get() {
config.game.wine.shared_libraries.gstreamer = switch.state();
config.game.wine.shared_libraries.gstreamer = switch.is_active();
Config::update(config);
}
@ -221,11 +221,11 @@ impl SimpleAsyncComponent for ComponentsPage {
set_valign: gtk::Align::Center,
#[block_signal(dxvk_recommended_notify)]
set_state: true,
set_active: true,
connect_state_notify[sender] => move |switch| {
if is_ready() {
sender.input(ComponentsPageMsg::DxvkRecommendedOnly(switch.state()));
sender.input(ComponentsPageMsg::DxvkRecommendedOnly(switch.is_active()));
}
} @dxvk_recommended_notify
}

View file

@ -232,7 +232,7 @@ impl SimpleAsyncComponent for GeneralApp {
connect_state_notify => |switch| {
#[allow(unused_must_use)]
if switch.state() {
if switch.is_active() {
std::fs::remove_file(KEEP_BACKGROUND_FILE.as_path());
} else {
std::fs::write(KEEP_BACKGROUND_FILE.as_path(), "");