From 9c9d1f2f4c62d2ae918c8011ef236e0de3db9faf Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Fri, 1 Jul 2022 18:36:05 -0700 Subject: [PATCH] battery: Remove power profiles I guess in the current design this is a seperate applet. --- applets/cosmic-applet-battery/src/main.rs | 63 ----------------------- 1 file changed, 63 deletions(-) diff --git a/applets/cosmic-applet-battery/src/main.rs b/applets/cosmic-applet-battery/src/main.rs index b5e6f1f8..09d06f7a 100644 --- a/applets/cosmic-applet-battery/src/main.rs +++ b/applets/cosmic-applet-battery/src/main.rs @@ -44,35 +44,6 @@ fn format_duration(duration: Duration) -> String { } } -#[derive(Copy, Clone)] -enum Graphics { - Compute, - Hybrid, - Integrated, - Nvidia, -} - -impl Graphics { - fn from_str(s: &str) -> Option { - match s { - "compute" => Some(Self::Compute), - "hybrid" => Some(Self::Hybrid), - "integrated" => Some(Self::Integrated), - "nvidia" => Some(Self::Nvidia), - _ => None, - } - } - - fn to_str(self) -> &'static str { - match self { - Self::Compute => "compute", - Self::Hybrid => "hybrid", - Self::Integrated => "integrated", - Self::Nvidia => "nvidia", - } - } -} - #[derive(Default)] struct AppModel { icon_name: String, @@ -84,7 +55,6 @@ struct AppModel { session: Option>, backlight: Option, kbd_backlight: Option>, - power_daemon: Option>, } enum AppMsg { @@ -93,7 +63,6 @@ enum AppMsg { SetDevice(DeviceProxy<'static>), SetSession(LogindSessionProxy<'static>), SetKbdBacklight(KbdBacklightProxy<'static>), - SetPowerDaemon(PowerDaemonProxy<'static>), UpdateProperties, UpdateKbdBrightness(f64), } @@ -148,11 +117,6 @@ impl SimpleComponent for AppModel { gtk4::Separator { }, - // Profiles - - gtk4::Separator { - }, - // Limit charging gtk4::Box { set_orientation: gtk4::Orientation::Horizontal, @@ -293,18 +257,6 @@ impl SimpleComponent for AppModel { } })); - glib::MainContext::default().spawn(glib::clone!(@strong sender => async move { - let proxy = async { - let connection = zbus::Connection::system().await?; - PowerDaemonProxy::builder(&connection).build().await - }.await; - match proxy { - Ok(power_daemon) => sender.input(AppMsg::SetPowerDaemon(power_daemon)), - Err(err) => eprintln!("Failed to open power daemon: {}", err), - } - - })); - ComponentParts { model, widgets } } @@ -391,21 +343,6 @@ impl SimpleComponent for AppModel { } })); } - AppMsg::SetPowerDaemon(power_daemon) => { - self.power_daemon = Some(power_daemon.clone()); - - // XXX detect change? - glib::MainContext::default().spawn(glib::clone!(@strong sender => async move { - async { - zbus::Result::Ok(if power_daemon.get_switchable().await? { - Some(power_daemon.get_graphics().await?) - } else { - None - }) - }; - })); - // XXX - } AppMsg::UpdateProperties => { if let Some(device) = self.device.as_ref() { if let Ok(Some(percentage)) = device.cached_percentage() {