diff --git a/razer_control_gui/src/lib.rs b/razer_control_gui/src/lib.rs index 475fad7..16f315f 100644 --- a/razer_control_gui/src/lib.rs +++ b/razer_control_gui/src/lib.rs @@ -12,3 +12,15 @@ pub struct SupportedDevice { pub features: Vec, pub fan: Vec, } + +impl SupportedDevice { + + pub fn has_feature(&self, feature: &str) -> bool { + self.features.iter().any(|f| f == feature) + } + + pub fn can_boost(&self) -> bool { + self.has_feature("boost") + } + +} diff --git a/razer_control_gui/src/razer-settings/razer-settings.rs b/razer_control_gui/src/razer-settings/razer-settings.rs index 3eac520..6b18b3e 100644 --- a/razer_control_gui/src/razer-settings/razer-settings.rs +++ b/razer_control_gui/src/razer-settings/razer-settings.rs @@ -408,7 +408,7 @@ fn make_page(ac: bool, device: SupportedDevice) -> SettingsPage { cpu_boost.append_text("Low"); cpu_boost.append_text("Medium"); cpu_boost.append_text("High"); - cpu_boost.append_text("Boost"); + if device.can_boost() { cpu_boost.append_text("Boost") }; cpu_boost.set_active(Some(power.1 as u32)); cpu_boost.set_width_request(100); let row = SettingsRow::new(&label, &cpu_boost);