Back to index

unity  6.0.0
Defines | Functions | Variables
panel-a11y.c File Reference
#include <gio/gio.h>
#include "panel-a11y.h"
#include "panel-util-accessible.h"

Go to the source code of this file.

Defines

#define INIT_METHOD   "gnome_accessibility_module_init"
#define DESKTOP_SCHEMA   "org.gnome.desktop.interface"
#define ACCESSIBILITY_ENABLED_KEY   "toolkit-accessibility"
#define AT_SPI_SCHEMA   "org.a11y.atspi"
#define ATK_BRIDGE_LOCATION_KEY   "atk-bridge-location"

Functions

static gboolean has_gsettings_schema (const gchar *schema)
static gboolean should_enable_a11y (void)
static gchar * get_atk_bridge_path (void)
static gboolean a11y_invoke_module (const char *module_path)
void panel_a11y_init (void)

Variables

static gboolean a11y_initialized = FALSE

Define Documentation

#define ACCESSIBILITY_ENABLED_KEY   "toolkit-accessibility"

Definition at line 28 of file panel-a11y.c.

#define AT_SPI_SCHEMA   "org.a11y.atspi"

Definition at line 29 of file panel-a11y.c.

#define ATK_BRIDGE_LOCATION_KEY   "atk-bridge-location"

Definition at line 30 of file panel-a11y.c.

#define DESKTOP_SCHEMA   "org.gnome.desktop.interface"

Definition at line 27 of file panel-a11y.c.

#define INIT_METHOD   "gnome_accessibility_module_init"

Definition at line 26 of file panel-a11y.c.


Function Documentation

static gboolean a11y_invoke_module ( const char *  module_path) [static]

Definition at line 93 of file panel-a11y.c.

{
  GModule    *handle;
  void      (*invoke_fn) (void);

  if (!module_path)
    {
      g_warning ("Accessibility: invalid module path (NULL)");

      return FALSE;
    }

  if (!(handle = g_module_open (module_path, (GModuleFlags)0)))
    {
      g_warning ("Accessibility: failed to load module '%s': '%s'",
                 module_path, g_module_error ());

      return FALSE;
    }

  if (!g_module_symbol (handle, INIT_METHOD, (gpointer *)&invoke_fn))
    {
      g_warning ("Accessibility: error library '%s' does not include "
                 "method '%s' required for accessibility support",
                 module_path, INIT_METHOD);
      g_module_close (handle);

      return FALSE;
    }

  invoke_fn ();

  return TRUE;
}

Here is the caller graph for this function:

static gchar* get_atk_bridge_path ( void  ) [static]

Definition at line 73 of file panel-a11y.c.

{
  GSettings *atspi_settings = NULL;
  GVariant *variant = NULL;
  char *value = NULL;

  if (!has_gsettings_schema (AT_SPI_SCHEMA))
    return NULL;

  atspi_settings = g_settings_new(AT_SPI_SCHEMA);
  variant = g_settings_get_value (atspi_settings, ATK_BRIDGE_LOCATION_KEY);
  value = g_variant_dup_bytestring (variant, NULL);

  g_variant_unref (variant);
  g_object_unref (atspi_settings);

  return value;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static gboolean has_gsettings_schema ( const gchar *  schema) [static]

Definition at line 36 of file panel-a11y.c.

{
  const char * const *list_schemas = NULL;
  gboolean found = FALSE;
  int i = 0;

  list_schemas = g_settings_list_schemas ();
  for (i = 0; list_schemas [i]; i++)
    {
      if (!g_strcmp0 (list_schemas[i], schema))
        {
          found = TRUE;
          break;
        }
    }

  return found;
}

Here is the caller graph for this function:

void panel_a11y_init ( void  )

Definition at line 129 of file panel-a11y.c.

{
  gchar *bridge_path = NULL;

  if (a11y_initialized)
    return;

  /* Restore environment to load AT bridge */
  g_unsetenv ("NO_AT_BRIDGE");
  g_unsetenv ("NO_GAIL");

  if (!should_enable_a11y ())
    return;

  /* Load PanelUtilAccessible class */
  g_type_class_unref (g_type_class_ref (PANEL_TYPE_UTIL_ACCESSIBLE));

  bridge_path = get_atk_bridge_path ();
  if (a11y_invoke_module (bridge_path))
    {
      g_debug ("Unity accessibility started, using bridge on %s", bridge_path);
    }

  g_free (bridge_path);
  atk_get_root ();

  a11y_initialized = TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static gboolean should_enable_a11y ( void  ) [static]

Definition at line 56 of file panel-a11y.c.

{
  GSettings *desktop_settings = NULL;
  gboolean value = FALSE;

  if (!has_gsettings_schema (DESKTOP_SCHEMA))
    return FALSE;

  desktop_settings = g_settings_new (DESKTOP_SCHEMA);
  value = g_settings_get_boolean (desktop_settings, ACCESSIBILITY_ENABLED_KEY);

  g_object_unref (desktop_settings);

  return value;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

gboolean a11y_initialized = FALSE [static]

Definition at line 24 of file panel-a11y.c.