Rename BatteryTray to StatusTray

This commit is contained in:
Lennard Kittner
2025-03-22 12:24:26 +01:00
parent 00b47d86ea
commit cb6bd0c574
2 changed files with 9 additions and 9 deletions

View File

@@ -1,8 +1,8 @@
use std::sync::{Arc, RwLock}; use std::sync::{Arc, RwLock};
use std::time::Duration; use std::time::Duration;
mod battery_tray; mod status_tray;
use battery_tray::{BatteryTray, TrayHandler}; use status_tray::{StatusTray, TrayHandler};
use hyper_x_cloud_ii_wireless::devices::{connect_compatible_device, Device, DeviceError}; use hyper_x_cloud_ii_wireless::devices::{connect_compatible_device, Device, DeviceError};
fn handle_error(error: DeviceError) -> String { fn handle_error(error: DeviceError) -> String {
@@ -32,7 +32,7 @@ fn main() {
std::thread::sleep(Duration::from_secs(1)); std::thread::sleep(Duration::from_secs(1));
}; };
let tray_handler = TrayHandler::new(BatteryTray::new()); let tray_handler = TrayHandler::new(StatusTray::new());
// Run loop // Run loop
loop { loop {

View File

@@ -3,11 +3,11 @@ use ksni::{menu::StandardItem, Handle, MenuItem, ToolTip, Tray, TrayService};
use std::sync::{Arc, RwLock, RwLockReadGuard}; use std::sync::{Arc, RwLock, RwLockReadGuard};
pub struct TrayHandler { pub struct TrayHandler {
handle: Handle<BatteryTray>, handle: Handle<StatusTray>,
} }
impl TrayHandler { impl TrayHandler {
pub fn new(tray: BatteryTray) -> Self { pub fn new(tray: StatusTray) -> Self {
let tray_service = TrayService::new(tray); let tray_service = TrayService::new(tray);
let handle = tray_service.handle(); let handle = tray_service.handle();
tray_service.spawn(); tray_service.spawn();
@@ -28,21 +28,21 @@ impl TrayHandler {
} }
} }
pub struct BatteryTray { pub struct StatusTray {
device_name: Option<String>, device_name: Option<String>,
message: Option<String>, message: Option<String>,
} }
impl BatteryTray { impl StatusTray {
pub fn new() -> Self { pub fn new() -> Self {
BatteryTray { StatusTray {
device_name: None, device_name: None,
message: None, message: None,
} }
} }
} }
impl Tray for BatteryTray { impl Tray for StatusTray {
fn id(&self) -> String { fn id(&self) -> String {
env!("CARGO_PKG_NAME").into() env!("CARGO_PKG_NAME").into()
} }