fix: unexpected behavior on gpu profile refresh button

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