refactor: correct event name, should be ShowWindow not ToggleWindow after… (#3912)

… PR 3769

Accidentally had the branch name as `docs` but it's more of a
`refactor`.
This commit is contained in:
Reactor Scram
2024-03-04 11:42:21 -06:00
committed by GitHub
parent fc01a3c2d0
commit 74c74b5d3c
2 changed files with 6 additions and 8 deletions

View File

@@ -634,9 +634,7 @@ impl Controller {
self.sign_out()?;
}
}
Req::SystemTrayMenu(TrayMenuEvent::ToggleWindow(window)) => {
self.toggle_window(window)?
}
Req::SystemTrayMenu(TrayMenuEvent::ShowWindow(window)) => self.show_window(window)?,
Req::SystemTrayMenu(TrayMenuEvent::Resource { id }) => self
.copy_resource(&id)
.context("Couldn't copy resource to clipboard")?,
@@ -746,7 +744,7 @@ impl Controller {
Ok(())
}
fn toggle_window(&self, window: system_tray_menu::Window) -> Result<()> {
fn show_window(&self, window: system_tray_menu::Window) -> Result<()> {
let id = match window {
system_tray_menu::Window::About => "about",
system_tray_menu::Window::Settings => "settings",

View File

@@ -13,7 +13,7 @@ pub(crate) enum Event {
Resource { id: String },
SignIn,
SignOut,
ToggleWindow(Window),
ShowWindow(Window),
Quit,
}
@@ -34,9 +34,9 @@ impl FromStr for Event {
fn from_str(s: &str) -> Result<Self, Error> {
Ok(match s {
"/about" => Self::ToggleWindow(Window::About),
"/about" => Self::ShowWindow(Window::About),
"/cancel_sign_in" => Self::CancelSignIn,
"/settings" => Self::ToggleWindow(Window::Settings),
"/settings" => Self::ShowWindow(Window::Settings),
"/sign_in" => Self::SignIn,
"/sign_out" => Self::SignOut,
"/quit" => Self::Quit,
@@ -109,7 +109,7 @@ mod tests {
fn systray_parse() {
assert_eq!(
Event::from_str("/about").unwrap(),
Event::ToggleWindow(Window::About)
Event::ShowWindow(Window::About)
);
assert_eq!(
Event::from_str("/resource/1234").unwrap(),