[orca/gnome-3-0] Fix for bug #646288 - Orca needs to set and respond to the appropriate gsettings keys
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca/gnome-3-0] Fix for bug #646288 - Orca needs to set and respond to the appropriate gsettings keys
- Date: Tue, 5 Apr 2011 00:14:46 +0000 (UTC)
commit dfe3dbc698a963fb4164da958a069b8e495d0b37
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date: Mon Apr 4 13:51:15 2011 -0400
Fix for bug #646288 - Orca needs to set and respond to the appropriate gsettings keys
src/orca/orca.in | 3 ++-
src/orca/orca.py | 27 +++++++++++++++++++++++++--
src/orca/orca_quit.py | 2 +-
src/orca/settings_manager.py | 23 ++++++-----------------
4 files changed, 34 insertions(+), 21 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..636d55d 100644
--- a/src/orca/orca.py
+++ b/src/orca/orca.py
@@ -35,6 +35,26 @@ 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 setOrcaEnabled(gsetting, key, enabled):
+ gsetting = gsetting or a11yAppSettings
+ gsetting.set_boolean(key, enabled)
+
+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
@@ -1897,7 +1917,7 @@ def quitOrca(script=None, inputEvent=None):
"""
if settings.quitOrcaNoConfirmation:
- shutdown()
+ setOrcaEnabled(a11yAppSettings, 'screen-reader-enabled', False)
else:
try:
module = __import__(settings.quitModule,
@@ -1963,7 +1983,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 +2028,8 @@ def init(registry):
signal.alarm(0)
_initialized = True
+ setOrcaEnabled(a11yAppSettings, 'screen-reader-enabled', True)
+ a11yAppSettings.connect('changed', onEnabledChanged)
return True
def start(registry):
diff --git a/src/orca/orca_quit.py b/src/orca/orca_quit.py
index b58cccc..d5ec6b1 100644
--- a/src/orca/orca_quit.py
+++ b/src/orca/orca_quit.py
@@ -91,7 +91,7 @@ class OrcaQuitGUI(orca_gtkbuilder.GtkBuilderWrapper):
- widget: the component that generated the signal.
"""
- orca.shutdown()
+ orca.setOrcaEnabled(None, 'screen-reader-enabled', False)
def quitDialogDestroyed(self, widget):
"""Signal handler for the "destroyed" signal for the quitDialog
diff --git a/src/orca/settings_manager.py b/src/orca/settings_manager.py
index c9576b7..0a9ad46 100644
--- a/src/orca/settings_manager.py
+++ b/src/orca/settings_manager.py
@@ -36,11 +36,9 @@ import debug
from keybindings import KeyBinding
import settings
-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
@@ -302,20 +300,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]