Initialize accessibility support on clutter_init

Initialize the accessibility support calling cally_accessibility_init

Take into account that this is required to at least be sure that
CallyUtil class is available.

It also modifies cally_accessibility_module_init in order to return
if the initialization was fine (and the name, removing the module word).

It also removes the gnome accessibility hooks, as it is not anymore
module code.

Solves CB#2098
This commit is contained in:
Alejandro Piñeiro 2010-04-26 19:33:49 +02:00 committed by Emmanuele Bassi
parent 774541d71e
commit 8f8e88b692
4 changed files with 65 additions and 38 deletions

View File

@ -22,11 +22,18 @@
#include "cally.h"
#include "cally-actor.h"
#include "cally-group.h"
#include "cally-stage.h"
#include "cally-text.h"
#include "cally-texture.h"
#include "cally-rectangle.h"
#include "cally-clone.h"
#include "cally-factory.h"
#include "cally-util.h"
extern void gnome_accessibility_module_init (void);
extern void gnome_accessibility_module_shutdown (void);
#include "clutter-debug.h"
static int cally_initialized = FALSE;
@ -39,11 +46,21 @@ CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_TEXTURE, cally_texture, cally_texture_new)
CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_RECTANGLE, cally_rectangle, cally_rectangle_new)
CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_CLONE, cally_clone, cally_clone_new)
void
cally_accessibility_module_init(void)
/**
* cally_acccessibility_init:
*
* Initializes the accessibility support.
*
* Return value: %TRUE if accessibility support has been correctly
* initialized.
*
* Since: 1.4
*/
gboolean
cally_accessibility_init (void)
{
if (cally_initialized)
return;
return TRUE;
cally_initialized = TRUE;
@ -59,35 +76,22 @@ cally_accessibility_module_init(void)
/* Initialize the CallyUtility class */
g_type_class_unref (g_type_class_ref (CALLY_TYPE_UTIL));
g_message ("Clutter Accessibility Module initialized");
}
CLUTTER_NOTE (MISC, "Clutter Accessibility initialized");
/**
* gnome_accessibility_module_shutdown:
* @void:
*
* Common gnome hook to be used in order to activate the module
**/
void
gnome_accessibility_module_init (void)
{
cally_accessibility_module_init ();
return cally_initialized;
}
/**
* gnome_accessibility_module_shutdown:
* @void:
* cally_get_cally_initialized:
*
* Common gnome hook to be used in order to de-activate the module
**/
void
gnome_accessibility_module_shutdown (void)
* Returns if the accessibility support using cally is enabled.
*
* Return value: %TRUE if accessibility support has been correctly
* initialized.
*
* Since: 1.4
*/
gboolean cally_get_cally_initialized (void)
{
if (!cally_initialized)
return;
cally_initialized = FALSE;
g_message ("Clutter Accessibility Module shutdown");
return cally_initialized;
}

View File

@ -23,17 +23,12 @@
#ifndef __CALLY_H
#define __CALLY_H
#include "cally-actor.h"
#include "cally-group.h"
#include "cally-stage.h"
#include "cally-text.h"
#include "cally-texture.h"
#include "cally-rectangle.h"
#include "cally-clone.h"
#include <clutter/clutter.h>
G_BEGIN_DECLS
void cally_accessibility_module_init(void);
gboolean cally_get_cally_initialized (void);
gboolean cally_accessibility_init (void);
G_END_DECLS

View File

@ -114,6 +114,8 @@
#include "cogl/cogl.h"
#include "pango/cogl-pango.h"
#include "cally.h" /* For accessibility support */
/* main context */
static ClutterMainContext *ClutterCntx = NULL;
@ -128,6 +130,7 @@ static gboolean clutter_show_fps = FALSE;
static gboolean clutter_fatal_warnings = FALSE;
static gboolean clutter_disable_mipmap_text = FALSE;
static gboolean clutter_use_fuzzy_picking = FALSE;
static gboolean clutter_enable_accessibility = TRUE;
static guint clutter_default_fps = 60;
@ -203,6 +206,24 @@ clutter_get_show_fps (void)
return clutter_show_fps;
}
/**
* clutter_get_accessibility_enabled:
*
* Returns whether Clutter has accessibility support enabled. As
* least, a value of TRUE means that there are a proper AtkUtil
* implementation available
*
* Return value: %TRUE if Clutter has accessibility support enabled
*
* Since: 1.4
*/
gboolean
clutter_get_accessibility_enabled (void)
{
return cally_get_cally_initialized ();
}
void
_clutter_stage_maybe_relayout (ClutterActor *stage)
{
@ -1591,6 +1612,10 @@ clutter_init_real (GError **error)
clutter_is_initialized = TRUE;
ctx->is_initialized = TRUE;
/* Initialize a11y */
if (clutter_enable_accessibility)
cally_accessibility_init ();
return CLUTTER_INIT_SUCCESS;
}
@ -1622,6 +1647,8 @@ static GOptionEntry clutter_args[] = {
{ "clutter-no-profile", 0, 0, G_OPTION_ARG_CALLBACK, clutter_arg_no_profile_cb,
N_("Clutter profiling flags to unset"), "FLAGS" },
#endif /* CLUTTER_ENABLE_PROFILE */
{ "clutter-enable-accessibility", 0, 0, G_OPTION_ARG_NONE, &clutter_enable_accessibility,
N_("Enable accessibility"), NULL },
{ NULL, },
};

View File

@ -102,6 +102,7 @@ void clutter_do_event (ClutterEvent *event);
gboolean clutter_get_debug_enabled (void);
gboolean clutter_get_show_fps (void);
gulong clutter_get_timestamp (void);
gboolean clutter_get_accessibility_enabled (void);
/* Threading functions */
void clutter_threads_init (void);