summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/config/leapsettings.py
diff options
context:
space:
mode:
authorIvan Alejandro <ivanalejandro0@gmail.com>2013-08-27 09:52:53 -0300
committerIvan Alejandro <ivanalejandro0@gmail.com>2013-08-27 10:53:14 -0300
commit4889a723c05482b76c1ce830d1373ad48b39102f (patch)
tree81c51616429867f86adf83dce0fc78fb5770e621 /src/leap/bitmask/config/leapsettings.py
parent99b5facaa9c69386ebe15f0c1bf3d0e18ae68af5 (diff)
Move configured providers getter to LeapSettings.
Diffstat (limited to 'src/leap/bitmask/config/leapsettings.py')
-rw-r--r--src/leap/bitmask/config/leapsettings.py29
1 files changed, 24 insertions, 5 deletions
diff --git a/src/leap/bitmask/config/leapsettings.py b/src/leap/bitmask/config/leapsettings.py
index 35010280..6aab84e4 100644
--- a/src/leap/bitmask/config/leapsettings.py
+++ b/src/leap/bitmask/config/leapsettings.py
@@ -75,11 +75,10 @@ class LeapSettings(object):
the config
:type standalone: bool
"""
-
- settings_path = os.path.join(get_platform_prefixer()
- .get_path_prefix(standalone=standalone),
- "leap",
- self.CONFIG_NAME)
+ self._path_prefix = get_platform_prefixer().get_path_prefix(
+ standalone=standalone)
+ settings_path = os.path.join(
+ self._path_prefix, "leap", self.CONFIG_NAME)
self._settings = QtCore.QSettings(settings_path,
QtCore.QSettings.IniFormat)
@@ -119,6 +118,26 @@ class LeapSettings(object):
leap_assert(windowstate, "We need a window state")
self._settings.setValue(self.WINDOWSTATE_KEY, windowstate)
+ def get_configured_providers(self):
+ """
+ Returns the configured providers based on the file structure in the
+ settings directory.
+
+ :rtype: list of str
+ """
+ # TODO: check which providers have a valid certificate among
+ # other things, not just the directories
+ providers = []
+ try:
+ providers_path = os.path.join(
+ self._path_prefix, "leap", "providers")
+ providers = os.listdir(providers_path)
+ except Exception as e:
+ logger.debug("Error listing providers, assume there are none. %r"
+ % (e,))
+
+ return providers
+
def get_enabled_services(self, provider):
"""
Returns a list of enabled services for the given provider