Fix saving config on exit of UI.
This commit is contained in:
parent
cc155d9473
commit
30ed1f2d86
|
@ -61,10 +61,11 @@ class _ConfigManager:
|
|||
|
||||
def get_config(self, config_file, defaults=None):
|
||||
"""Get a reference to the Config object for this filename"""
|
||||
log.debug("Getting config '%s'", config_file)
|
||||
# Create the config object if not already created
|
||||
if config_file not in self.config_files.keys():
|
||||
self.config_files[config_file] = Config(config_file, defaults)
|
||||
|
||||
|
||||
return self.config_files[config_file]
|
||||
|
||||
# Singleton functions
|
||||
|
|
|
@ -83,4 +83,5 @@ class AddTorrentDialog:
|
|||
result = None
|
||||
|
||||
self.chooser.destroy()
|
||||
del self.config
|
||||
return result
|
||||
|
|
|
@ -60,10 +60,10 @@ DEFAULT_PREFS = {
|
|||
"send_info": False,
|
||||
"default_load_path": None,
|
||||
"window_maximized": False,
|
||||
"window_x_pos": -1,
|
||||
"window_y_pos": -1,
|
||||
"window_width": -1,
|
||||
"window_height": -1
|
||||
"window_x_pos": 0,
|
||||
"window_y_pos": 0,
|
||||
"window_width": 640,
|
||||
"window_height": 480
|
||||
}
|
||||
|
||||
class GtkUI:
|
||||
|
@ -84,8 +84,7 @@ class GtkUI:
|
|||
|
||||
# Make sure gtkui.conf has at least the defaults set
|
||||
config = ConfigManager("gtkui.conf", DEFAULT_PREFS)
|
||||
del config
|
||||
|
||||
|
||||
# Initialize the main window
|
||||
self.mainwindow = MainWindow()
|
||||
|
||||
|
@ -100,12 +99,15 @@ class GtkUI:
|
|||
|
||||
# Start the gtk main loop
|
||||
gtk.main()
|
||||
|
||||
|
||||
log.debug("gtkui shutting down..")
|
||||
|
||||
# Make sure the config is saved.
|
||||
config.save()
|
||||
del config
|
||||
|
||||
# Clean-up
|
||||
del self.mainwindow
|
||||
del self.signal_receiver
|
||||
del self.plugins
|
||||
# Make sure the config file is closed and saved to disk.
|
||||
deluge.configmanager.close("gtkui.conf")
|
||||
del deluge.configmanager
|
||||
|
|
|
@ -52,6 +52,7 @@ class Preferences:
|
|||
self.treeview = self.glade.get_widget("treeview")
|
||||
self.notebook = self.glade.get_widget("notebook")
|
||||
self.core = functions.get_core()
|
||||
self.gtkui_config = ConfigManager("gtkui.conf")
|
||||
# Setup the liststore for the categories (tab pages)
|
||||
self.liststore = gtk.ListStore(int, str)
|
||||
self.treeview.set_model(self.liststore)
|
||||
|
@ -88,7 +89,6 @@ class Preferences:
|
|||
|
||||
def show(self):
|
||||
self.core_config = functions.get_config(self.core)
|
||||
self.gtkui_config = ConfigManager("gtkui.conf")
|
||||
# Update the preferences dialog to reflect current config settings
|
||||
|
||||
## Downloads tab ##
|
||||
|
|
Loading…
Reference in New Issue