From 4ba1cbcddeda535d822b943f2057b43f742627b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ball=C3=B3=20Gy=C3=B6rgy?= Date: Sun, 19 Jul 2026 18:32:19 +0200 Subject: [PATCH] Add confirmation dialog when tray icon fails This allows the user to quit the window or cancel the operation. --- scc/gui/app.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/scc/gui/app.py b/scc/gui/app.py index c51555b3e..bd574d870 100644 --- a/scc/gui/app.py +++ b/scc/gui/app.py @@ -477,6 +477,27 @@ def on_window_delete_event(self, *a) -> bool: self.window.set_visible(False) else: log.error("Tray icon not available/active, refusing to close window!") + dialog = Gtk.MessageDialog( + transient_for=self.window, + modal=True, + message_type=Gtk.MessageType.WARNING, + buttons=Gtk.ButtonsType.NONE, + text=_("Unable to hide the window to the system tray"), + ) + dialog.format_secondary_text( + _("Do you want to quit the application instead?") + ) + dialog.add_buttons( + _("_Cancel"), Gtk.ResponseType.CANCEL, + _("_Quit"), Gtk.ResponseType.OK, + ) + dialog.set_default_response(Gtk.ResponseType.CANCEL) + + response = dialog.run() + dialog.destroy() + + if response == Gtk.ResponseType.OK: + self.on_mnuExit_activate() else: self.on_mnuExit_activate() return True # TRUE to stop other handlers from being invoked for the event. FALSE to propagate the event further.