RCC: add tray enable/disable, move app settings to page

This commit is contained in:
Luke D. Jones
2023-07-03 15:02:25 +12:00
parent 98dec6403c
commit 14d043bbc3
13 changed files with 152 additions and 73 deletions

View File

@@ -2,7 +2,6 @@
//! commands over an MPSC channel.
use std::io::Write;
use std::sync::mpsc::{channel, Receiver};
use std::sync::{Arc, Mutex};
use std::time::Duration;
@@ -29,11 +28,6 @@ pub enum AppToTray {
DgpuStatus(GfxPower),
}
pub enum TrayToApp {
Open,
Quit,
}
pub struct RadioGroup(Vec<gtk::RadioMenuItem>);
impl RadioGroup {
@@ -418,13 +412,8 @@ impl ROGTray {
}
}
pub fn init_tray(
supported: SupportedFunctions,
states: Arc<Mutex<SystemState>>,
) -> Receiver<TrayToApp> {
let (send, recv) = channel();
let _send = Arc::new(Mutex::new(send));
/// The tray is controlled somewhat by `Arc<Mutex<SystemState>>`
pub fn init_tray(supported: SupportedFunctions, states: Arc<Mutex<SystemState>>) {
std::thread::spawn(move || {
let gtk_init = gtk::init().map_err(|e| {
error!("ROGTray: gtk init {e}");
@@ -538,6 +527,4 @@ pub fn init_tray(
trace!("Tray loop ticked");
}
});
recv
}