[orca] Use dbus rather than gsettings when checking if accessibility support and screen reader are enabled
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Use dbus rather than gsettings when checking if accessibility support and screen reader are enabled
- Date: Fri, 10 Feb 2012 12:06:00 +0000 (UTC)
commit 852bfe5ee6ceab3528a13efdc4118ed49e8376c0
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Fri Feb 10 07:02:58 2012 -0500
Use dbus rather than gsettings when checking if accessibility support and screen reader are enabled
configure.ac | 2 +-
src/orca/orca.py | 16 +++++++++++-----
src/orca/settings_manager.py | 21 +++++++++++++++------
3 files changed, 27 insertions(+), 12 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index bfb997f..79c1fe4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6,7 +6,7 @@ m4_define([orca_version],
m4_define(gtk_required_version, 3.1.91)
m4_define(pygobject_required_version, 3.0.2)
-m4_define(atspi_required_version, 2.1.92)
+m4_define(atspi_required_version, 2.3.5)
AC_INIT([orca],
[orca_version],
diff --git a/src/orca/orca.py b/src/orca/orca.py
index 14e5048..9e6d72f 100644
--- a/src/orca/orca.py
+++ b/src/orca/orca.py
@@ -36,8 +36,11 @@ import sys
import time
import shutil
-from gi.repository.Gio import Settings
-a11yAppSettings = Settings('org.gnome.desktop.a11y.applications')
+try:
+ from gi.repository.Gio import Settings
+ a11yAppSettings = Settings('org.gnome.desktop.a11y.applications')
+except:
+ a11yAppSettings = None
# We're going to force the name of the app to "orca" so we
# will end up showing us as "orca" to the AT-SPI. If we don't
@@ -1452,8 +1455,7 @@ def init(registry):
global _initialized
- if _initialized \
- and a11yAppSettings.get_boolean('screen-reader-enabled'):
+ if _initialized and _settingsManager.isScreenReaderServiceEnabled():
return False
# Do not hang on initialization if we can help it.
@@ -1469,7 +1471,11 @@ def init(registry):
signal.alarm(0)
_initialized = True
- a11yAppSettings.connect('changed', onEnabledChanged)
+ # In theory, we can do this through dbus. In practice, it fails to
+ # work sometimes. Until we know why, we need to leave this as-is
+ # so that we respond when gnome-control-center is used to stop Orca.
+ if a11yAppSettings:
+ a11yAppSettings.connect('changed', onEnabledChanged)
return True
def start(registry):
diff --git a/src/orca/settings_manager.py b/src/orca/settings_manager.py
index 68e8bb0..a8cc33f 100644
--- a/src/orca/settings_manager.py
+++ b/src/orca/settings_manager.py
@@ -28,6 +28,7 @@ __date__ = "$Date$"
__copyright__ = "Copyright (c) 2010 Consorcio Fernando de los Rios."
__license__ = "LGPL"
+import dbus
import os
import imp
from json import load
@@ -37,9 +38,10 @@ from keybindings import KeyBinding
import settings
import pronunciation_dict
-from gi.repository.Gio import Settings
-a11yAppSettings = Settings('org.gnome.desktop.interface')
-
+_bus = dbus.SessionBus()
+_proxy = _bus.get_object("org.a11y.Bus", "/org/a11y/bus")
+_desktopProps = \
+ dbus.Interface(_proxy, dbus_interface='org.freedesktop.DBus.Properties')
class SettingsManager(object):
"""Settings backend manager. This class manages orca user's settings
@@ -300,11 +302,18 @@ class SettingsManager(object):
return not alreadyEnabled
def isAccessibilityEnabled(self):
- return a11yAppSettings.get_boolean("toolkit-accessibility")
+ return bool(_desktopProps.Get('org.a11y.Status', 'IsEnabled'))
def setAccessibility(self, enable):
- return a11yAppSettings.set_boolean(
- "toolkit-accessibility", enable)
+ _desktopProps.Set('org.a11y.Status', 'IsEnabled', enable)
+ return True
+
+ def isScreenReaderServiceEnabled(self):
+ """Returns True if the screen reader service is enabled. Note that
+ this does not necessarily mean that Orca (or any other screen reader)
+ is running at the moment."""
+
+ return bool(_desktopProps.Get('org.a11y.Status', 'ScreenReaderEnabled'))
def setStartingProfile(self, profile=None):
if profile is None:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]