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