* AT-SPI - Assistive Technology Service Provider Interface
* (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
*
- * Copyright 2008 Codethink Ltd.
+ * Copyright 2008, 2009 Codethink Ltd.
* Copyright 2001, 2002, 2003 Sun Microsystems Inc.,
* Copyright 2001, 2002, 2003 Ximian, Inc.
*
#include <X11/Xlib.h>
#include <X11/Xatom.h>
-#include <string.h>
-#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdarg.h>
#include <atk/atk.h>
-#include <atk/atkobject.h>
-#include <atk/atknoopobject.h>
#include <droute/droute.h>
#include "bridge.h"
#include "event.h"
-#include "atk-dbus.h"
+#include "accessible-register.h"
+#include "adaptors.h"
-#include "spi-common/spi-dbus.h"
+#include "common/spi-dbus.h"
/*
* Provides the path for the introspection directory.
message = dbus_message_new_method_call (SPI_DBUS_NAME_REGISTRY,
SPI_DBUS_PATH_REGISTRY,
SPI_DBUS_INTERFACE_REGISTRY,
- "registerApplication");
+ "RegisterApplication");
dbus_message_set_no_reply (message, TRUE);
uname = dbus_bus_get_unique_name(app->bus);
message = dbus_message_new_method_call (SPI_DBUS_NAME_REGISTRY,
SPI_DBUS_PATH_REGISTRY,
SPI_DBUS_INTERFACE_REGISTRY,
- "deregisterApplication");
+ "DeregisterApplication");
dbus_message_set_no_reply (message, TRUE);
uname = dbus_bus_get_unique_name(app->bus);
GError *err = NULL;
DBusError error;
DBusConnection *bus;
+ AtkObject *root;
gchar *introspection_directory;
+ static gboolean inited = FALSE;
+
+ if (inited)
+ return 0;
+
+ inited = TRUE;
DRoutePath *treepath, *accpath;
+ root = atk_get_root ();
+ g_return_val_if_fail (root, 0);
+
/* Parse command line options */
opt = g_option_context_new(NULL);
g_option_context_add_main_entries(opt, atspi_option_entries, NULL);
/* Allocate global data and do ATK initializations */
atk_adaptor_app_data = g_new0 (SpiAppData, 1);
atk_misc = atk_misc_get_instance ();
- atk_adaptor_app_data->root = atk_get_root();
+ atk_adaptor_app_data->root = root;
/* Set up D-Bus connection and register bus name */
dbus_error_init (&error);
accpath = droute_add_many (atk_adaptor_app_data->droute,
"/org/freedesktop/atspi/accessible",
NULL,
- (DRouteGetDatumFunction) atk_dbus_path_to_object);
+ (DRouteGetDatumFunction) atk_dbus_path_to_gobject);
/* Register all interfaces with droute and set up application accessible db */
spi_initialize_tree (treepath);
spi_initialize_accessible (accpath);
+ spi_initialize_application (accpath);
spi_initialize_action(accpath);
spi_initialize_collection (accpath);
spi_initialize_component (accpath);
spi_initialize_text (accpath);
spi_initialize_value (accpath);
- /* Register methods to send D-Bus signals on certain ATK events */
- spi_atk_register_event_listeners ();
-
/* Initialize the AtkObject registration */
atk_dbus_initialize (atk_adaptor_app_data->root);
+ /* Register methods to send D-Bus signals on certain ATK events */
+ spi_atk_register_event_listeners ();
+
/* Register this app by sending a signal out to AT-SPI registry daemon */
register_application (atk_adaptor_app_data);
int
gtk_module_init (gint *argc, gchar **argv[])
{
- return adaptor_init (argc, argv);
+ const gchar *load_bridge = g_getenv ("NO_AT_BRIDGE");
+
+ if (!load_bridge || g_ascii_strtod (load_bridge, NULL) == 0)
+ {
+ return adaptor_init (argc, argv);
+ }
+ return 0;
}
+void
+gnome_accessibility_module_init (void)
+{
+ const gchar *load_bridge = g_getenv ("NO_AT_BRIDGE");
+
+ if (!load_bridge || g_ascii_strtod (load_bridge, NULL) == 0)
+ {
+ adaptor_init (NULL, NULL);
+
+ if (g_getenv ("AT_SPI_DEBUG"))
+ {
+ g_print("Atk Accessibility bridge initialized\n");
+ }
+ }
+}
+
+void
+gnome_accessibility_module_shutdown (void)
+{
+ spi_atk_deregister_event_listeners ();
+ exit_func ();
+}
/*END------------------------------------------------------------------------*/