Merge feature/ticket39-close-main-closes-all-windows into develop
Fermeture des fenêtres auxiliaires à la fermeture de la fenêtre principale (#39). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@ -124,6 +124,8 @@ pub fn run() {
|
|||||||
let _ = model_servers.stop_on_app_exit().await;
|
let _ = model_servers.stop_on_app_exit().await;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
close_non_main_webview_windows(&handle);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -253,3 +255,39 @@ pub fn run() {
|
|||||||
.run(tauri::generate_context!())
|
.run(tauri::generate_context!())
|
||||||
.expect("error while running IdeA Tauri application");
|
.expect("error while running IdeA Tauri application");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn close_non_main_webview_windows(handle: &tauri::AppHandle) {
|
||||||
|
for (label, window) in handle.webview_windows() {
|
||||||
|
if !should_close_with_main_window(&label) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
let _ = window.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn should_close_with_main_window(label: &str) -> bool {
|
||||||
|
label != "main"
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::should_close_with_main_window;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn main_window_close_does_not_target_main_again() {
|
||||||
|
assert!(!should_close_with_main_window("main"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn main_window_close_targets_detached_view_windows() {
|
||||||
|
assert!(should_close_with_main_window(
|
||||||
|
"view-work-00000000-0000-0000-0000-000000000001"
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn main_window_close_targets_other_auxiliary_windows() {
|
||||||
|
assert!(should_close_with_main_window("settings"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user