libsaria: Don't immediately enable preference saving
We shouldn't need to save preferences during startup because at this point only the initial values have been set. If nothing is changed, then nothing needs to be saved and we can save some time. This should also prevent any problems caused by crashing during a save.
This commit is contained in:
parent
e812fbaee0
commit
802513c726
|
@ -58,6 +58,7 @@ def startup():
|
|||
audio.init()
|
||||
controls.init2()
|
||||
plugin.load_all()
|
||||
prefs.enable_save()
|
||||
event.start("POSTSTART")
|
||||
|
||||
|
||||
|
|
|
@ -224,20 +224,25 @@ class PrefTree(Tree):
|
|||
return val[0]
|
||||
|
||||
|
||||
save_prefs_enabled = False
|
||||
class PersPrefTree(PrefTree):
|
||||
def __init__(self, file = None):
|
||||
PrefTree.__init__(self)
|
||||
self.file = file
|
||||
|
||||
def enable_save(self):
|
||||
global save_prefs_enabled
|
||||
save_prefs_enabled = True
|
||||
|
||||
def init_pref(self, pref, value):
|
||||
val = PrefTree.init_pref(self, pref, value)
|
||||
if self.file != None:
|
||||
if self.file != None and save_prefs_enabled == True:
|
||||
files.save(self, self.file, ".tree")
|
||||
return val
|
||||
|
||||
def set_pref(self, pref, value):
|
||||
PrefTree.set_pref(self, pref, value)
|
||||
if self.file != None:
|
||||
if self.file != None and save_prefs_enabled == True:
|
||||
files.save(self, self.file, ".tree")
|
||||
|
||||
def get_pref_tree(file):
|
||||
|
|
Loading…
Reference in New Issue
Block a user