~gordallott/unity/unity.background-color

« back to all changes in this revision

Viewing changes to services/panel-a11y.c

  • Committer: Gord Allott
  • Date: 2011-07-19 15:42:27 UTC
  • mfrom: (1255.1.35 trunk)
  • Revision ID: gord.allott@canonical.com-20110719154227-rs82r0e1hhw8hgd5
merged latest trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 * Authored by: Rodrigo Moya <rodrigo.moya@canonical.com>
17
17
 */
18
18
 
19
 
#include <gconf/gconf-client.h>
20
19
#include <gio/gio.h>
21
20
 
22
21
#include "panel-a11y.h"
25
24
static gboolean a11y_initialized = FALSE;
26
25
 
27
26
#define INIT_METHOD "gnome_accessibility_module_init"
28
 
#define A11Y_GCONF_KEY "/desktop/gnome/interface/accessibility"
 
27
#define DESKTOP_SCHEMA "org.gnome.desktop.interface"
 
28
#define ACCESSIBILITY_ENABLED_KEY "toolkit-accessibility"
29
29
#define AT_SPI_SCHEMA "org.a11y.atspi"
30
30
#define ATK_BRIDGE_LOCATION_KEY "atk-bridge-location"
31
31
 
 
32
 
 
33
/* This method is required because g_setting_new abort if the schema
 
34
   is not present. */
32
35
static gboolean
33
36
has_gsettings_schema (const gchar *schema)
34
37
{
36
39
  gboolean found = FALSE;
37
40
  int i = 0;
38
41
 
39
 
  /* we need to check if AT_SPI_SCHEMA is present as g_settings_new
40
 
     could abort if the schema is not here*/
41
42
  list_schemas = g_settings_list_schemas ();
42
43
  for (i = 0; list_schemas [i]; i++)
43
44
    {
54
55
static gboolean
55
56
should_enable_a11y (void)
56
57
{
57
 
  GConfClient *client = NULL;
 
58
  GSettings *desktop_settings = NULL;
58
59
  gboolean value = FALSE;
59
 
  GError *error = NULL;
60
 
 
61
 
  client = gconf_client_get_default ();
62
 
  value = gconf_client_get_bool (client, A11Y_GCONF_KEY, &error);
63
 
  if (error != NULL)
64
 
    {
65
 
      g_warning ("Error getting gconf variable %s, a11y disabled by default",
66
 
                 A11Y_GCONF_KEY);
67
 
      g_error_free (error);
68
 
    }
69
 
  g_object_unref (client);
 
60
 
 
61
  if (!has_gsettings_schema (DESKTOP_SCHEMA))
 
62
    return FALSE;
 
63
 
 
64
  desktop_settings = g_settings_new (DESKTOP_SCHEMA);
 
65
  value = g_settings_get_boolean (desktop_settings, ACCESSIBILITY_ENABLED_KEY);
 
66
 
 
67
  g_object_unref (desktop_settings);
70
68
 
71
69
  return value;
72
70
}