mirror of
https://github.com/rustdesk/rustdesk.git
synced 2024-12-04 11:59:18 +08:00
refactor tray uninstall service
This commit is contained in:
parent
1ad5d0b726
commit
644da37a4f
@ -1144,7 +1144,7 @@ pub fn uninstall_service(show_new_window: bool) -> bool {
|
||||
if show_new_window {
|
||||
run_me_with(2);
|
||||
}
|
||||
std::process::exit(0);
|
||||
true
|
||||
}
|
||||
|
||||
pub fn install_service() -> bool {
|
||||
|
@ -182,7 +182,7 @@ pub fn is_installed_daemon(prompt: bool) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
pub fn uninstall(show_new_window: bool) -> bool {
|
||||
pub fn uninstall_service(show_new_window: bool) -> bool {
|
||||
// to-do: do together with win/linux about refactory start/stop service
|
||||
if !is_installed_daemon(false) {
|
||||
return false;
|
||||
|
@ -2171,7 +2171,7 @@ pub fn uninstall_service(show_new_window: bool) -> bool {
|
||||
return true;
|
||||
}
|
||||
run_after_run_cmds(!show_new_window);
|
||||
std::process::exit(0);
|
||||
true
|
||||
}
|
||||
|
||||
pub fn install_service() -> bool {
|
||||
|
@ -91,10 +91,8 @@ pub fn make_tray() -> hbb_common::ResultType<()> {
|
||||
|
||||
if let Ok(event) = menu_channel.try_recv() {
|
||||
if event.id == quit_i.id() {
|
||||
#[cfg(target_os = "macos")]
|
||||
crate::platform::macos::uninstall(false);
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
crate::platform::uninstall_service(false);
|
||||
*control_flow = ControlFlow::Exit;
|
||||
} else if event.id == open_i.id() {
|
||||
open_func();
|
||||
}
|
||||
|
@ -274,7 +274,7 @@ pub fn set_option(key: String, value: String) {
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
let is_stop = value == "Y";
|
||||
if is_stop && crate::platform::macos::uninstall(true) {
|
||||
if is_stop && crate::platform::macos::uninstall_service(true) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -283,6 +283,7 @@ pub fn set_option(key: String, value: String) {
|
||||
if crate::platform::is_installed() {
|
||||
if value == "Y" {
|
||||
if crate::platform::uninstall_service(true) {
|
||||
std::process::exit(0);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user