[orca/new-settings] Fixed the checking for the first start so Orca launch the preferences gui just the first start



commit 667e66f2922d6b964c8c95bc53ee9580b1ed4c44
Author: Juanje Ojeda <jojeda emergya es>
Date:   Tue Oct 19 17:59:52 2010 +0200

    Fixed the checking for the first start so Orca launch the preferences gui just the first start

 src/orca/backends/gconf_backend.py |   13 +++++++++++++
 src/orca/orca.py                   |    4 +++-
 src/orca/settings_manager.py       |   16 ++++++++++++++++
 3 files changed, 32 insertions(+), 1 deletions(-)
---
diff --git a/src/orca/backends/gconf_backend.py b/src/orca/backends/gconf_backend.py
index 0348e9e..12ccc09 100644
--- a/src/orca/backends/gconf_backend.py
+++ b/src/orca/backends/gconf_backend.py
@@ -750,6 +750,7 @@ class OrcaPrefs():
         defaultValue = ['Default', 'default']
         if not self.prefsDict.get('activeProfile'):
             self.prefsDict['activeProfile'] = defaultValue
+            self._client.set_bool('/apps/gnome-orca/firstStart', True)
         if not self.prefsDict.get('startingProfile'):
             self.prefsDict['startingProfile'] = defaultValue
 
@@ -1019,3 +1020,15 @@ def availableProfiles():
         profiles.append(profile)
 
     return profiles 
+
+def isFirstStart():
+    """Check if the firstStart key is True or false"""
+    client = gconf.client_get_default()
+    return client.get_bool('/apps/gnome-orca/firstStart')
+
+def setFirstStart():
+    """Set firstStart key to false
+    This means the profile is being stored and it isn't a first start
+    anymore."""
+    client = gconf.client_get_default()
+    client.set_bool('/apps/gnome-orca/firstStart', False)
diff --git a/src/orca/orca.py b/src/orca/orca.py
index 114e67f..c638cc4 100644
--- a/src/orca/orca.py
+++ b/src/orca/orca.py
@@ -2235,7 +2235,8 @@ def main():
     if setupRequested and (not bypassSetup) and showGUI:
         showPreferencesGUI()
     elif (not _userSettings) and (not bypassSetup) or \
-         (not _settingsManager.isClassic()) and (not bypassSetup):
+         (not _settingsManager.isClassic()) and \
+          (not bypassSetup) and _settingsManager.isFirstStart():
         if desktopRunning:
             if not os.path.exists(userprefs):
                 # Hack to work around b.g.o. 601657.
@@ -2247,6 +2248,7 @@ def main():
             showPreferencesGUI()
         else:
             _showPreferencesConsole()
+        _settingsManager.setFirstStart()
 
     try:
         start(pyatspi.Registry) # waits until we stop the registry
diff --git a/src/orca/settings_manager.py b/src/orca/settings_manager.py
index ca3268d..72b9cdd 100644
--- a/src/orca/settings_manager.py
+++ b/src/orca/settings_manager.py
@@ -64,6 +64,20 @@ class SettingsManager(Singleton):
         else:
             return False
 
+    def isFirstStart(self):
+        """Check if the firstStart key is True or false"""
+        if self.isClassic():
+            return False
+        else:
+            return self.backendModule.isFirstStart()
+
+    def setFirstStart(self):
+        """Set firstStart key to false
+        This means the profile is being stored and it isn't a first start
+        anymore."""
+        if not self.isClassic():
+            self.backendModule.setFirstStart()
+
     def loadBackend(self):
         """Load specific backend for manage user settings"""
 
@@ -71,8 +85,10 @@ class SettingsManager(Singleton):
             self.backendModule = __import__('backends.%s' % self.backend, \
                                          globals(), locals(), self.backend)
             print '\nimporting %s backend OK!' % self.backend
+            return True
         except:
             print '\nUnable to load %s backend' % self.backend
+            return False
 
     def loadSettings(self):
         """Load settings from active backend"""



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]