From fcc2b6b6a887d28d6c0c4add39778e77a4e4220b Mon Sep 17 00:00:00 2001 From: DYefremov Date: Sun, 15 Feb 2026 13:48:26 +0300 Subject: [PATCH] add app termination * Added app termination while background tasks are still running. --- app/ui/main.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/ui/main.py b/app/ui/main.py index aebe1d16..43eaa08e 100644 --- a/app/ui/main.py +++ b/app/ui/main.py @@ -1108,7 +1108,17 @@ class Application(Gtk.Application): GLib.idle_add(lambda: next(gen, False), priority=GLib.PRIORITY_LOW) return True else: - GLib.idle_add(self.quit) + if len(self._task_box): + msg = f"{translate('There are running background tasks!!')}\n\n\t{translate('Are you sure?')}" + if show_dialog(DialogType.QUESTION, self._main_window, msg) != Gtk.ResponseType.OK: + return True + log("Terminating the application...") + import signal + + os.kill(os.getpid(), signal.SIGTERM) + GLib.idle_add(self.quit, priority=GLib.PRIORITY_HIGH) + + return False def on_main_window_state(self, window, event): if event.new_window_state & Gdk.WindowState.FULLSCREEN or event.new_window_state & Gdk.WindowState.MAXIMIZED: