Fix shutdown handler with GNOME session manager

This commit is contained in:
Andrew Resch 2009-08-01 00:15:05 +00:00
parent eef9345e8b
commit 838cef1c36
2 changed files with 10 additions and 4 deletions

View File

@ -17,6 +17,7 @@
* Fix #518 remove header in add torrent dialog to save vertical space * Fix #518 remove header in add torrent dialog to save vertical space
* Add a Cache preferences page to adjust cache settings and examine cache status * Add a Cache preferences page to adjust cache settings and examine cache status
* Add ability to rename files prior to adding them * Add ability to rename files prior to adding them
* Fix shutdown handler with GNOME session manager
==== ConsoleUI ==== ==== ConsoleUI ====
* Changed to use curses for a more interactive client * Changed to use curses for a more interactive client

View File

@ -159,10 +159,15 @@ class GtkUI(object):
# Setup signals # Setup signals
try: try:
import gnome.ui import gnome.ui
self.gnome_client = gnome.ui.Client() import gnome
self.gnome_client.connect("die", gtk.main_quit) self.gnome_prog = gnome.init("Deluge", deluge.common.get_version())
except: self.gnome_client = gnome.ui.master_client()
pass def on_die(*args):
gtk.main_quit()
self.gnome_client.connect("die", on_die)
log.debug("GNOME session 'die' handler registered!")
except Exception, e:
log.warning("Unable to register a 'die' handler with the GNOME session manager: %s", e)
if deluge.common.windows_check(): if deluge.common.windows_check():
from win32api import SetConsoleCtrlHandler from win32api import SetConsoleCtrlHandler