[orca] Fix for bug #646288 - Orca needs to respond to the appropriate gsettings keys



commit 74aca68c45b22cacfb07520d46a302e6b55cabd1
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date:   Thu Jun 9 13:25:48 2011 -0400

    Fix for bug #646288 - Orca needs to respond to the appropriate gsettings keys

 src/orca/orca.in             |    3 ++-
 src/orca/orca.py             |   20 +++++++++++++++++++-
 src/orca/settings_manager.py |   23 ++++++-----------------
 3 files changed, 27 insertions(+), 19 deletions(-)
---
diff --git a/src/orca/orca.in b/src/orca/orca.in
index 527141c..2187cef 100644
--- a/src/orca/orca.in
+++ b/src/orca/orca.in
@@ -133,7 +133,8 @@ runOrca()
 if [ "x$LOGNAME" != "xgdm" ] ; then
     ACCESSIBILITY_ENABLED=`gsettings \
         get org.gnome.desktop.interface toolkit-accessibility`
-    if [ "x$ACCESSIBILITY_ENABLED" != "xtrue" ] ; then
+    if [[ "x$ACCESSIBILITY_ENABLED" != "xtrue" && \
+          `echo $ARGS | grep -c "no-setup"` -eq 0 ]]; then
         # Because we will be running Orca in text-setup mode, we want to
         # make sure it is run in a terminal window.  If we're already in
         # a terminal, this is great.  If not, we spawn a gnome-terminal
diff --git a/src/orca/orca.py b/src/orca/orca.py
index b208357..349cea6 100644
--- a/src/orca/orca.py
+++ b/src/orca/orca.py
@@ -35,6 +35,22 @@ import time
 import unicodedata
 import shutil
 
+# This must happen BEFORE we import gtk (until we start using
+# introspection).
+from gi.repository.Gio import Settings
+a11yAppSettings = Settings('org.gnome.desktop.a11y.applications')
+
+def getOrcaEnabled(gsetting, key):
+    return gsetting.get_boolean(key)
+
+def onEnabledChanged(gsetting, key):
+    if not key == 'screen-reader-enabled':
+        return
+
+    enabled = getOrcaEnabled(gsetting, key)
+    if not enabled:
+        shutdown()
+
 # We're going to force the name of the app to "orca" so pygtk
 # will end up showing us as "orca" to the AT-SPI.  If we don't
 # do this, the name can end up being "-c".  See bug 364452 at
@@ -1963,7 +1979,8 @@ def init(registry):
     global _initialized
     global _keyBindings
 
-    if _initialized:
+    if _initialized \
+       and getOrcaEnabled(a11yAppSettings, 'screen-reader-enabled'):
         return False
 
     # Do not hang on initialization if we can help it.
@@ -2007,6 +2024,7 @@ def init(registry):
         signal.alarm(0)
 
     _initialized = True
+    a11yAppSettings.connect('changed', onEnabledChanged)
     return True
 
 def start(registry):
diff --git a/src/orca/settings_manager.py b/src/orca/settings_manager.py
index 5f9747e..6760b16 100644
--- a/src/orca/settings_manager.py
+++ b/src/orca/settings_manager.py
@@ -37,11 +37,9 @@ from keybindings import KeyBinding
 import settings
 import pronunciation_dict
 
-try:
-    import gconf
-    gconfClient = gconf.client_get_default()
-except:
-    gconfClient = None
+from gi.repository.Gio import Settings
+a11yAppSettings = Settings('org.gnome.desktop.interface')  
+
 
 class SettingsManager(object):
     """Settings backend manager. This class manages orca user's settings
@@ -303,20 +301,11 @@ class SettingsManager(object):
         return not alreadyEnabled
 
     def isAccessibilityEnabled(self):
-        try:
-            return gconfClient.get_bool(
-                "/desktop/gnome/interface/accessibility") \
-                or gconfClient.get_bool(
-                    "/desktop/gnome/interface/accessibility2")
-        except:
-            return False
+        return a11yAppSettings.get_boolean("toolkit-accessibility")
 
     def setAccessibility(self, enable):
-        try:
-            return gconfClient.set_bool(
-                "/desktop/gnome/interface/accessibility", enable)
-        except:
-            return False
+        return a11yAppSettings.set_boolean(
+            "toolkit-accessibility", enable)
 
     def setStartingProfile(self, profile=None):
         if profile is None:



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