Skip to content

Commit

Permalink
fix: hide unavailable clock/voltage rows
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriele Musco committed Dec 9, 2023
1 parent 28a61fb commit ad3b1f9
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions lact-gui/src/app/root_stack/oc_page/clocks_frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,9 +324,13 @@ impl ClocksFrame {
}

fn set_configuration_mode(&self, advanced: bool) {
self.min_sclk_adjustment.2.set_visible(advanced);
self.min_mclk_adjustment.2.set_visible(advanced);
self.min_voltage_adjustment.2.set_visible(advanced);
for (adj, _, w) in [
&self.min_sclk_adjustment,
&self.min_mclk_adjustment,
&self.min_voltage_adjustment,
] {
w.set_visible(advanced && adj.upper() > 0.0)
}
}
}

Expand Down Expand Up @@ -366,10 +370,11 @@ fn oc_adjustment(title: &'static str, listbox: &ListBox) -> (Adjustment, Rc<Atom
changed.store(true, Ordering::SeqCst);
}));

adjustment.connect_changed(clone!(@strong value_selector => move |adjustment| {
value_selector.set_sensitive(adjustment.upper() == 0.0);
}
));
adjustment.connect_changed(clone!(@strong row => move |adjustment| {
let active = adjustment.upper() > 0.0;
row.set_visible(active);
row.set_sensitive(active);
}));

(adjustment, changed, row.upcast::<Widget>())
}
Expand Down

0 comments on commit ad3b1f9

Please sign in to comment.