~canonical-dx-team/unity/unity.fix-ql-losing-focus

« back to all changes in this revision

Viewing changes to src/unitya11y.cpp

Merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
#include <gio/gio.h>
21
21
#include <gmodule.h>
22
22
#include <stdio.h>
 
23
#include <gconf/gconf-client.h>
23
24
 
24
25
#include "unitya11y.h"
25
26
#include "unity-util-accessible.h"
43
44
 
44
45
static gboolean a11y_initialized = FALSE;
45
46
 
 
47
#define INIT_METHOD "gnome_accessibility_module_init"
 
48
#define A11Y_GCONF_KEY "/desktop/gnome/interface/accessibility"
 
49
#define AT_SPI_SCHEMA "org.a11y.atspi"
 
50
#define ATK_BRIDGE_LOCATION_KEY "atk-bridge-location"
 
51
 
46
52
static void
47
53
unity_a11y_restore_environment (void)
48
54
{
56
62
  g_type_class_unref (g_type_class_ref (UNITY_TYPE_UTIL_ACCESSIBLE));
57
63
}
58
64
 
59
 
#define INIT_METHOD "gnome_accessibility_module_init"
60
 
#define DESKTOP_SCHEMA "org.gnome.desktop.interface"
61
 
#define ACCESSIBILITY_ENABLED_KEY "toolkit-accessibility"
62
 
#define AT_SPI_SCHEMA "org.a11y.atspi"
63
 
#define ATK_BRIDGE_LOCATION_KEY "atk-bridge-location"
64
 
 
65
65
static gboolean
66
66
has_gsettings_schema (const gchar *schema)
67
67
{
87
87
static gboolean
88
88
should_enable_a11y (void)
89
89
{
90
 
  GSettings *desktop_settings = NULL;
 
90
  GConfClient *client = NULL;
91
91
  gboolean value = FALSE;
92
 
 
93
 
  if (g_getenv ("UNITY_A11Y_DISABLE"))
94
 
    return FALSE;
95
 
 
96
 
  if (!has_gsettings_schema (DESKTOP_SCHEMA))
97
 
    return FALSE;
98
 
   
99
 
  desktop_settings = g_settings_new (DESKTOP_SCHEMA);
100
 
  value = g_settings_get_boolean (desktop_settings, ACCESSIBILITY_ENABLED_KEY);
101
 
 
102
 
  g_object_unref (desktop_settings);
 
92
  GError *error = NULL;
 
93
 
 
94
  client = gconf_client_get_default ();
 
95
  value = gconf_client_get_bool (client, A11Y_GCONF_KEY, &error);
 
96
  if (error != NULL)
 
97
    {
 
98
      g_warning ("Error getting gconf variable %s, a11y disabled by default",
 
99
                 A11Y_GCONF_KEY);
 
100
      g_error_free (error);
 
101
    }
 
102
  g_object_unref (client);
103
103
 
104
104
  return value;
105
105
}
355
355
 
356
356
  unity_a11y_restore_environment ();
357
357
 
358
 
  /* FIXME: gsettings is causing some crashes checking if a11y is
359
 
     enabled, so we are move to gconf, meanwhile we require a sanity
360
 
     commit. */
361
 
  return;
362
 
 
363
358
  if (!should_enable_a11y ())
364
359
    return;
365
360