mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 18:18:55 +00:00
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:
@@ -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",
|
||||
|
||||
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user