[orca] Don't load user settings until after the settings manager has been initialized
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Don't load user settings until after the settings manager has been initialized
- Date: Fri, 18 May 2012 20:10:27 +0000 (UTC)
commit c5008f568e5a3779ee547053d73e6f6f18966d4f
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Fri May 18 16:10:26 2012 -0400
Don't load user settings until after the settings manager has been initialized
src/orca/orca.py | 3 ++-
src/orca/settings_manager.py | 27 +++++++++++++++++----------
2 files changed, 19 insertions(+), 11 deletions(-)
---
diff --git a/src/orca/orca.py b/src/orca/orca.py
index 2408e9d..2dacbd4 100644
--- a/src/orca/orca.py
+++ b/src/orca/orca.py
@@ -237,7 +237,8 @@ options.validate()
# You have been warned.
#
from .settings_manager import SettingsManager
-_settingsManager = SettingsManager(prefsDir=options.userPrefsDir)
+_settingsManager = SettingsManager()
+_settingsManager.activate(options.userPrefsDir)
if _settingsManager is None:
print("Could not load the settings manager. Exiting.")
sys.exit(1)
diff --git a/src/orca/settings_manager.py b/src/orca/settings_manager.py
index 3c13913..e3f3ac2 100644
--- a/src/orca/settings_manager.py
+++ b/src/orca/settings_manager.py
@@ -60,7 +60,7 @@ class SettingsManager(object):
cls.__instance = object.__new__(cls, *args, **kwargs)
return cls.__instance
- def __init__(self, backend='json', prefsDir=None):
+ def __init__(self, backend='json'):
"""Initialize a SettingsManager Object.
If backend isn't defined then uses default backend, in this
case json-backend.
@@ -74,8 +74,7 @@ class SettingsManager(object):
self._backend = None
self.profile = None
self.backendName = backend
- self._prefsDir = prefsDir \
- or os.path.join(GLib.get_user_data_dir(), "orca")
+ self._prefsDir = None
# Dictionaries for store the default values
# The keys and values are defined at orca.settings
@@ -102,11 +101,23 @@ class SettingsManager(object):
self.keybindings = {}
if not self._loadBackend():
- raise Exception('SettingsManager::_loadBackend fails.')
+ raise Exception('SettingsManager._loadBackend failed.')
self.customizedSettings = {}
self._customizationCompleted = False
+ # For handling the currently-"classic" application settings
+ self.settingsPackages = ["app-settings"]
+ self._knownAppSettings = {}
+
+ debug.println(debug.LEVEL_FINEST, 'INFO: Settings manager initialized')
+
+ def activate(self, prefsDir=None):
+ debug.println(debug.LEVEL_FINEST, 'INFO: Activating settings manager')
+
+ self._prefsDir = prefsDir \
+ or os.path.join(GLib.get_user_data_dir(), "orca")
+
# Load the backend and the default values
self._backend = self.backendModule.Backend(self._prefsDir)
self._setDefaultGeneral()
@@ -125,17 +136,13 @@ class SettingsManager(object):
#
self._createDefaults()
+ debug.println(debug.LEVEL_FINEST, 'INFO: Settings manager activated')
+
# Set the active profile and load its stored settings
if self.profile is None:
self.profile = self.general.get('startingProfile')[1]
self.setProfile(self.profile)
- # For handling the currently-"classic" application settings
- self.settingsPackages = ["app-settings"]
- self._knownAppSettings = {}
-
- debug.println(debug.LEVEL_FINEST, 'INFO: Settings manager initialized')
-
def _loadBackend(self):
"""Load specific backend for manage user settings"""
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]