Optimize code format

This commit is contained in:
Tlntin
2023-04-08 10:49:21 +08:00
parent 43e547a4cc
commit b41a7e4e8e
3 changed files with 5 additions and 7 deletions

View File

@@ -30,9 +30,9 @@ pub fn open_browser(app: AppHandle, url: String) {
#[command]
pub async fn download_file(app: AppHandle, params: DownloadFileParams) -> Result<(), String> {
let window: Window = app.get_window("pake").unwrap().clone();
let window: Window = app.get_window("pake").unwrap();
let output_path = api::path::download_dir().unwrap().join(params.filename);
let file_path = check_file_or_append(&output_path.to_str().unwrap());
let file_path = check_file_or_append(output_path.to_str().unwrap());
let download = Download::new(&params.url, Some(&file_path), None);
match download.download() {
Ok(_) => {

View File

@@ -32,10 +32,8 @@ pub fn get_menu() -> Menu {
}
pub fn menu_event_handle(event: WindowMenuEvent) {
match event.menu_item_id() {
// default close to minimize
"close" => event.window().minimize().expect("can't minimize window"),
_ => {}
if event.menu_item_id() == "close" {
event.window().minimize().expect("can't minimize window");
}
}