From e720994f5f4ab6bcee3f83bddf102451b8afe17d Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Sun, 17 Aug 2008 04:51:28 +0000 Subject: [PATCH] Fix properly shutting Deluge down when system shuts down --- deluge/core/core.py | 4 +++- deluge/ui/gtkui/gtkui.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/deluge/core/core.py b/deluge/core/core.py index 7c2812ae8..1ff7b725d 100644 --- a/deluge/core/core.py +++ b/deluge/core/core.py @@ -195,9 +195,11 @@ class Core( else: from win32api import SetConsoleCtrlHandler from win32con import CTRL_CLOSE_EVENT + from win32con import CTRL_SHUTDOWN_EVENT result = 0 def win_handler(ctrl_type): - if ctrl_type == CTRL_CLOSE_EVENT: + log.debug("ctrl_type: %s", ctrl_type) + if ctrl_type == CTRL_CLOSE_EVENT or ctrl_type == CTRL_SHUTDOWN_EVENT: self._shutdown() result = 1 return result diff --git a/deluge/ui/gtkui/gtkui.py b/deluge/ui/gtkui/gtkui.py index aacdc33bb..e25c6b102 100644 --- a/deluge/ui/gtkui/gtkui.py +++ b/deluge/ui/gtkui/gtkui.py @@ -151,9 +151,11 @@ class GtkUI: if deluge.common.windows_check(): from win32api import SetConsoleCtrlHandler from win32con import CTRL_CLOSE_EVENT + from win32con import CTRL_SHUTDOWN_EVENT result = 0 def win_handler(ctrl_type): - if ctrl_type == CTRL_CLOSE_EVENT: + log.debug("ctrl_type: %s", ctrl_type) + if ctrl_type == CTRL_CLOSE_EVENT or ctrl_type == CTRL_SHUTDOWN_EVENT: self.shutdown() return 1 SetConsoleCtrlHandler(win_handler)