Skip to content

Commit

Permalink
Set Cachesize in preferences too
Browse files Browse the repository at this point in the history
Only sent the data to the backend and never notified the ui_data
of any changes. Therefore this preference was always saved in it's
default state.
This is now fixed.
  • Loading branch information
Turun committed Aug 17, 2023
1 parent fe36626 commit d522d09
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/view/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use crate::view::dropdownbox::DropDownBox;
use crate::view::state::State;
use crate::VERSION;

use self::preferences::DarkModePref;
use self::preferences::{CacheSize, DarkModePref};

pub struct View {
ui_state: State,
Expand Down Expand Up @@ -201,20 +201,23 @@ impl View {
}
ui.separator();
if ui.button("No Cache").clicked() {
self.ui_data.preferences.cache_size = CacheSize::None;
self.channel_presenter_tx
.send(MessageToModel::MaxCacheSize(preferences::CacheSize::None))
.send(MessageToModel::MaxCacheSize(CacheSize::None))
.expect("Failed to send MaxCacheSize message to backend");
ui.close_menu();
}
if ui.button("Normal Cache").clicked() {
self.ui_data.preferences.cache_size = CacheSize::Normal;
self.channel_presenter_tx
.send(MessageToModel::MaxCacheSize(preferences::CacheSize::Normal))
.send(MessageToModel::MaxCacheSize(CacheSize::Normal))
.expect("Failed to send MaxCacheSize message to backend");
ui.close_menu();
}
if ui.button("Large Cache").clicked() {
self.ui_data.preferences.cache_size = CacheSize::Large;
self.channel_presenter_tx
.send(MessageToModel::MaxCacheSize(preferences::CacheSize::Large))
.send(MessageToModel::MaxCacheSize(CacheSize::Large))
.expect("Failed to send MaxCacheSize message to backend");
ui.close_menu();
}
Expand Down

0 comments on commit d522d09

Please sign in to comment.