fix: unexpected behavior on gpu profile refresh button

This commit is contained in:
Gabriele Musco 2023-09-09 17:41:07 +02:00
parent a71359e800
commit a58f920d3b
No known key found for this signature in database
GPG key ID: 1068D795C80E51DE

View file

@ -30,6 +30,7 @@ pub struct MainView {
xrservice_active: bool,
enable_debug_view: bool,
profiles: Vec<Profile>,
#[no_eq]
selected_profile: Profile,
#[tracker::do_not_track]
profiles_dropdown: Option<gtk::DropDown>,
@ -60,7 +61,6 @@ pub enum MainViewMsg {
SetSelectedProfile(u32),
ProfileSelected(u32),
UpdateSelectedProfile(Profile),
MarkChanged,
EditProfile,
CreateProfile,
DeleteProfile,
@ -384,8 +384,8 @@ impl SimpleComponent for MainView {
set_margin_end: 12,
set_halign: gtk::Align::Start,
set_label: "Refresh",
connect_clicked[sender] => move |_| {
sender.input(Self::Input::MarkChanged);
connect_clicked[sender, profiles_dropdown] => move |_| {
sender.input(Self::Input::SetSelectedProfile(profiles_dropdown.selected()));
}
},
},
@ -562,9 +562,6 @@ impl SimpleComponent for MainView {
.sender()
.emit(InstallWivrnBoxMsg::UpdateSelectedProfile(prof.clone()));
}
Self::Input::MarkChanged => {
self.mark_all_changed();
}
Self::Input::UpdateProfiles(profiles, config) => {
self.set_profiles(profiles);
// why send another message to set the dropdown selection?