mirror of
https://git.deluge-torrent.org/deluge
synced 2025-04-20 11:35:49 +00:00
Fix #528 make sure gtkui config file is written before exiting
This commit is contained in:
parent
43c8d0ead2
commit
790dcc49ca
2 changed files with 24 additions and 22 deletions
|
@ -1,6 +1,7 @@
|
|||
Deluge 1.0.5 (In Development)
|
||||
GtkUI:
|
||||
* Increase the per-torrent stop share ratio max to 99999.0
|
||||
* Fix #528 make sure gtkui config file is written before exiting
|
||||
|
||||
WebUi:
|
||||
* Javascript auto refresh for both templates.
|
||||
|
|
|
@ -2,19 +2,19 @@
|
|||
# gtkui.py
|
||||
#
|
||||
# Copyright (C) 2007 Andrew Resch ('andar') <andrewresch@gmail.com>
|
||||
#
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
|
@ -59,7 +59,7 @@ from connectionmanager import ConnectionManager
|
|||
from signals import Signals
|
||||
from pluginmanager import PluginManager
|
||||
from ipcinterface import IPCInterface
|
||||
|
||||
|
||||
from queuedtorrents import QueuedTorrents
|
||||
from addtorrentdialog import AddTorrentDialog
|
||||
from coreconfig import CoreConfig
|
||||
|
@ -108,13 +108,13 @@ class GtkUI:
|
|||
# Initialize gdk threading
|
||||
gtk.gdk.threads_init()
|
||||
gobject.threads_init()
|
||||
|
||||
|
||||
# Initialize gettext
|
||||
if deluge.common.windows_check() or deluge.common.osx_check():
|
||||
locale.setlocale(locale.LC_ALL, '')
|
||||
else:
|
||||
locale.setlocale(locale.LC_MESSAGES, '')
|
||||
locale.bindtextdomain("deluge",
|
||||
locale.bindtextdomain("deluge",
|
||||
pkg_resources.resource_filename(
|
||||
"deluge", "i18n"))
|
||||
locale.textdomain("deluge")
|
||||
|
@ -126,7 +126,7 @@ class GtkUI:
|
|||
gettext.install("deluge",
|
||||
pkg_resources.resource_filename(
|
||||
"deluge", "i18n"))
|
||||
|
||||
|
||||
# Setup signals
|
||||
try:
|
||||
import gnome.ui
|
||||
|
@ -148,7 +148,7 @@ class GtkUI:
|
|||
self.shutdown()
|
||||
return 1
|
||||
SetConsoleCtrlHandler(win_handler)
|
||||
|
||||
|
||||
# Make sure gtkui.conf has at least the defaults set
|
||||
self.config = deluge.configmanager.ConfigManager("gtkui.conf", DEFAULT_PREFS)
|
||||
|
||||
|
@ -169,21 +169,21 @@ class GtkUI:
|
|||
except Exception, e:
|
||||
log.error("Unable to find deluged: %s", e)
|
||||
self.config["classic_mode"] = False
|
||||
|
||||
|
||||
# We need to check on exit if it was started in classic mode to ensure we
|
||||
# shutdown the daemon.
|
||||
self.started_in_classic = self.config["classic_mode"]
|
||||
|
||||
|
||||
# Start the Dbus Interface before anything else.. Just in case we are
|
||||
# already running.
|
||||
self.queuedtorrents = QueuedTorrents()
|
||||
|
||||
self.ipcinterface = IPCInterface(args)
|
||||
|
||||
|
||||
# We make sure that the UI components start once we get a core URI
|
||||
client.connect_on_new_core(self._on_new_core)
|
||||
client.connect_on_no_core(self._on_no_core)
|
||||
|
||||
|
||||
# Initialize various components of the gtkui
|
||||
self.mainwindow = MainWindow()
|
||||
self.menubar = MenuBar()
|
||||
|
@ -199,15 +199,15 @@ class GtkUI:
|
|||
# Start the signal receiver
|
||||
self.signal_receiver = Signals()
|
||||
self.coreconfig = CoreConfig()
|
||||
|
||||
|
||||
# Initalize the plugins
|
||||
self.plugins = PluginManager()
|
||||
|
||||
|
||||
# Show the connection manager
|
||||
self.connectionmanager = ConnectionManager()
|
||||
if self.config["show_connection_manager_on_start"] and not self.config["classic_mode"]:
|
||||
self.connectionmanager.show()
|
||||
|
||||
|
||||
# Start the gtk main loop
|
||||
try:
|
||||
gtk.gdk.threads_enter()
|
||||
|
@ -215,15 +215,12 @@ class GtkUI:
|
|||
gtk.gdk.threads_leave()
|
||||
except KeyboardInterrupt:
|
||||
self.shutdown()
|
||||
else:
|
||||
else:
|
||||
self.shutdown()
|
||||
|
||||
def shutdown(self, *args, **kwargs):
|
||||
log.debug("gtkui shutting down..")
|
||||
|
||||
# Make sure the config is saved.
|
||||
self.config.save()
|
||||
|
||||
# Shutdown all components
|
||||
component.shutdown()
|
||||
if self.started_in_classic:
|
||||
|
@ -231,13 +228,17 @@ class GtkUI:
|
|||
client.shutdown()
|
||||
except:
|
||||
pass
|
||||
|
||||
# Make sure the config is saved.
|
||||
self.config.save()
|
||||
|
||||
try:
|
||||
gtk.main_quit()
|
||||
except RuntimeError:
|
||||
pass
|
||||
|
||||
|
||||
def _on_new_core(self, data):
|
||||
component.start()
|
||||
|
||||
|
||||
def _on_no_core(self, data):
|
||||
component.stop()
|
||||
|
|
Loading…
Add table
Reference in a new issue