gtkmoduledir = $(libdir)/$(GTK_MODULE_DIR)
gtkmodule_LTLIBRARIES = libspiatk.la
-libspiatk_la_CFLAGS = $(DBUS_GLIB_CFLAGS) $(ATK_CFLAGS) -I$(top_srcdir)
+libspiatk_la_CFLAGS = $(DBUS_GLIB_CFLAGS) $(ATK_CFLAGS) -I$(top_srcdir)\
+ -DATSPI_INTROSPECTION_PATH=\"$(pkgdatadir)/$(DEFAULT_ATSPI_INTROSPECTION_PATH)\"
libspiatk_la_LDFLAGS = -no-undefined \
-module \
atk-dbus.h \
image.c \
selection.c \
- spi-private.h \
table.c \
text.c \
- tree.c \
- util.c \
- value.c \
- introspectable.c
+ tree.c \
+ tree.h \
+ value.c
* Boston, MA 02111-1307, USA.
*/
-#include "accessible.h"
+#include <atk/atk.h>
+#include <droute/droute.h>
-#define get_object(message) atk_dbus_get_object(dbus_message_get_path(message))
-
-static AtkObject *
-get_object_from_path (const char *path, void *user_data)
-{
- return atk_dbus_get_object (path);
-}
+#include "atk-dbus.h"
+#include "spi-common/spi-dbus.h"
static dbus_bool_t
-impl_get_name (const char *path, DBusMessageIter * iter, void *user_data)
+impl_get_name (DBusMessageIter *iter, void *user_data)
{
- AtkObject *object = atk_dbus_get_object (path);
- if (!object)
- return FALSE;
+ AtkObject *object = (AtkObject *) user_data;
+
+ g_return_val_if_fail (ATK_IS_OBJECT (user_data), FALSE);
+
return droute_return_v_string (iter, atk_object_get_name (object));
}
static dbus_bool_t
-impl_set_name (const char *path, DBusMessageIter * iter, void *user_data)
+impl_set_name (DBusMessageIter *iter, void *user_data)
{
- AtkObject *object = atk_dbus_get_object (path);
+ AtkObject *object = (AtkObject *) user_data;
const char *name = droute_get_v_string (iter);
+
+ g_return_val_if_fail (ATK_IS_OBJECT (user_data), FALSE);
+
atk_object_set_name (object, name);
return TRUE;
}
static dbus_bool_t
-impl_get_description (const char *path, DBusMessageIter * iter,
- void *user_data)
+impl_get_description (DBusMessageIter *iter, void *user_data)
{
- AtkObject *object = atk_dbus_get_object (path);
- if (!object)
- return FALSE;
+ AtkObject *object = (AtkObject *) user_data;
+
+ g_return_val_if_fail (ATK_IS_OBJECT (user_data), FALSE);
+
return droute_return_v_string (iter, atk_object_get_description (object));
}
static dbus_bool_t
-impl_set_description (const char *path, DBusMessageIter * iter,
- void *user_data)
+impl_set_description (DBusMessageIter *iter, void *user_data)
{
- AtkObject *object = atk_dbus_get_object (path);
+ AtkObject *object = (AtkObject *) user_data;
const char *description = droute_get_v_string (iter);
+
+ g_return_val_if_fail (ATK_IS_OBJECT (user_data), FALSE);
+
atk_object_set_description (object, description);
return TRUE;
}
static dbus_bool_t
-impl_get_parent (const char *path, DBusMessageIter * iter, void *user_data)
+impl_get_parent (DBusMessageIter *iter, void *user_data)
{
- AtkObject *object = atk_dbus_get_object (path);
+ AtkObject *object = (AtkObject *) user_data;
+
+ g_return_val_if_fail (ATK_IS_OBJECT (user_data), FALSE);
- if (!object)
- return FALSE;
- return spi_dbus_return_v_object (iter, atk_object_get_parent (object),
- FALSE);
+ return spi_dbus_return_v_object (iter,
+ atk_object_get_parent (object),
+ FALSE);
}
static dbus_bool_t
-impl_get_childCount (const char *path, DBusMessageIter * iter,
- void *user_data)
+impl_get_childCount (DBusMessageIter *iter, void *user_data)
{
- AtkObject *object = atk_dbus_get_object (path);
+ AtkObject *object = (AtkObject *) user_data;
+
+ g_return_val_if_fail (ATK_IS_OBJECT (user_data), FALSE);
- if (!object)
- return FALSE;
return droute_return_v_int32 (iter,
- atk_object_get_n_accessible_children
- (object));
+ atk_object_get_n_accessible_children
+ (object));
}
static DBusMessage *
-impl_getChildAtIndex (DBusConnection * bus, DBusMessage * message,
- void *user_data)
+impl_getChildAtIndex (DBusConnection *bus,
+ DBusMessage *message,
+ void *user_data)
{
- AtkObject *object = get_object (message);
+ AtkObject *object = (AtkObject *) user_data;
+ DBusError error;
dbus_int32_t i;
AtkObject *child;
- if (!object)
- return spi_dbus_general_error (message);
- if (!dbus_message_get_args (message, NULL, DBUS_TYPE_INT32, &i, DBUS_TYPE_INVALID))
- return spi_dbus_general_error (message);
+ dbus_error_init (&error);
+ g_return_val_if_fail (ATK_IS_OBJECT (user_data),
+ droute_not_yet_handled_error (message));
+ if (!dbus_message_get_args (message, &error, DBUS_TYPE_INT32, &i, DBUS_TYPE_INVALID))
+ return spi_dbus_general_error (message);
child = atk_object_ref_accessible_child (object, i);
return spi_dbus_return_object (message, child, FALSE);
}
static DBusMessage *
-impl_getChildren (DBusConnection * bus, DBusMessage * message,
- void *user_data)
+impl_getChildren (DBusConnection *bus,
+ DBusMessage *message,
+ void *user_data)
{
- AtkObject *object = get_object (message);
+ AtkObject *object = (AtkObject *) user_data;
gint i;
gint count;
DBusMessage *reply;
DBusMessageIter iter, iter_array;
- if (!object)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_OBJECT (user_data),
+ droute_not_yet_handled_error (message));
count = atk_object_get_n_accessible_children (object);
reply = dbus_message_new_method_return (message);
if (!reply) goto oom;
}
static DBusMessage *
-impl_getIndexInParent (DBusConnection * bus, DBusMessage * message,
- void *user_data)
+impl_getIndexInParent (DBusConnection *bus,
+ DBusMessage *message,
+ void *user_data)
{
- AtkObject *object = get_object (message);
+ AtkObject *object = (AtkObject *) user_data;
dbus_uint32_t rv;
DBusMessage *reply;
- if (!object)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_OBJECT (user_data),
+ droute_not_yet_handled_error (message));
rv = atk_object_get_index_in_parent (object);
reply = dbus_message_new_method_return (message);
if (reply)
}
static DBusMessage *
-impl_getRelationSet (DBusConnection * bus, DBusMessage * message,
- void *user_data)
+impl_getRelationSet (DBusConnection *bus,
+ DBusMessage *message,
+ void *user_data)
{
- AtkObject *object = get_object (message);
+ AtkObject *object = (AtkObject *) user_data;
DBusMessage *reply;
AtkRelationSet *set;
DBusMessageIter iter, iter_array, iter_struct, iter_targets;
gint count;
gint i, j;
- if (!object)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_OBJECT (user_data),
+ droute_not_yet_handled_error (message));
reply = dbus_message_new_method_return (message);
if (!reply) return NULL;
set = atk_object_ref_relation_set (object);
}
static DBusMessage *
-impl_getRole (DBusConnection * bus, DBusMessage * message, void *user_data)
+impl_getRole (DBusConnection *bus, DBusMessage *message, void *user_data)
{
- AtkObject *object = get_object (message);
+ AtkObject *object = (AtkObject *) user_data;
gint role;
dbus_uint32_t rv;
DBusMessage *reply;
- if (!object)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_OBJECT (user_data),
+ droute_not_yet_handled_error (message));
role = atk_object_get_role (object);
rv = spi_accessible_role_from_atk_role (role);
reply = dbus_message_new_method_return (message);
}
static DBusMessage *
-impl_getRoleName (DBusConnection * bus, DBusMessage * message,
- void *user_data)
+impl_getRoleName (DBusConnection *bus,
+ DBusMessage *message,
+ void *user_data)
{
- AtkObject *object = get_object (message);
+ AtkObject *object = (AtkObject *) user_data;
gint role;
const char *role_name;
DBusMessage *reply;
- if (!object)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_OBJECT (user_data),
+ droute_not_yet_handled_error (message));
role = atk_object_get_role (object);
role_name = atk_role_get_name (role);
if (!role_name)
}
static DBusMessage *
-impl_getLocalizedRoleName (DBusConnection * bus, DBusMessage * message,
- void *user_data)
+impl_getLocalizedRoleName (DBusConnection *bus,
+ DBusMessage *message,
+ void *user_data)
{
- AtkObject *object = get_object (message);
+ AtkObject *object = (AtkObject *) user_data;
gint role;
const char *role_name;
DBusMessage *reply;
- if (!object)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_OBJECT (user_data),
+ droute_not_yet_handled_error (message));
role = atk_object_get_role (object);
role_name = atk_role_get_localized_name (role);
if (!role_name)
}
static DBusMessage *
-impl_getState (DBusConnection * bus, DBusMessage * message, void *user_data)
+impl_getState (DBusConnection *bus,
+ DBusMessage *message,
+ void *user_data)
{
- AtkObject *object = get_object (message);
+ AtkObject *object = (AtkObject *) user_data;
dbus_uint32_t rv[2];
dbus_uint32_t *array = rv;
DBusMessage *reply;
- if (!object)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_OBJECT (user_data),
+ droute_not_yet_handled_error (message));
spi_atk_state_to_dbus_array (object, rv);
reply = dbus_message_new_method_return (message);
if (reply)
}
static DBusMessage *
-impl_getAttributes (DBusConnection * bus, DBusMessage * message,
- void *user_data)
+impl_getAttributes (DBusConnection *bus,
+ DBusMessage *message,
+ void *user_data)
{
- AtkObject *object = get_object (message);
+ AtkObject *object = (AtkObject *) user_data;
DBusMessage *reply;
AtkAttributeSet *attributes;
AtkAttribute *attr = NULL;
gint n_attributes = 0;
gint i;
- if (!object)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_OBJECT (user_data),
+ droute_not_yet_handled_error (message));
attributes = atk_object_get_attributes (object);
if (attributes)
}
static DBusMessage *
-impl_getApplication (DBusConnection * bus, DBusMessage * message,
- void *user_data)
+impl_getApplication (DBusConnection *bus,
+ DBusMessage *message,
+ void *user_data)
{
AtkObject *root = atk_get_root ();
return spi_dbus_return_object (message, root, FALSE);
};
void
-spi_initialize_accessible (DRouteData * data)
+spi_initialize_accessible (DRoutePath *path)
{
- droute_add_interface (data, SPI_DBUS_INTERFACE_ACCESSIBLE,
- methods, properties,
- (DRouteGetDatumFunction) get_object_from_path, NULL);
+ droute_path_add_interface (path,
+ SPI_DBUS_INTERFACE_ACCESSIBLE,
+ methods,
+ properties);
};
#ifndef SPI_ACCESSIBLE_H_
#define SPI_ACCESSIBLE_H_
-#include <droute/droute.h>
-#include <spi-common/spi-dbus.h>
+#include <atk/atk.h>
#include <spi-common/spi-types.h>
-#include "atk/atk.h"
-
G_BEGIN_DECLS
Accessibility_Role spi_accessible_role_from_atk_role (AtkRole role);
-void spi_initialize_accessible(DRouteData *data);
-void spi_initialize_action(DRouteData *data);
-void spi_initialize_application(DRouteData *data);
-void spi_initialize_collection(DRouteData *data);
-void spi_initialize_component(DRouteData *data);
-void spi_initialize_document(DRouteData *data);
-void spi_initialize_editabletext(DRouteData *data);
-void spi_initialize_hyperlink(DRouteData *data);
-void spi_initialize_hypertext(DRouteData *data);
-void spi_initialize_image(DRouteData *data);
-void spi_initialize_selection(DRouteData *data);
-void spi_initialize_table(DRouteData *data);
-void spi_initialize_text(DRouteData *data);
-void spi_initialize_value(DRouteData *data);
-void spi_initialize_introspectable(DRouteData *data, DRouteGetDatumFunction verify_object);
-
-/* tree.c */
-void spi_register_tree_object(DBusConnection *bus, DRouteData *data, const char *path);
-
-dbus_bool_t spi_dbus_append_tree (DBusMessage * message, AtkObject * obj, DRouteData * data);
-
-void
-atk_tree_cache_needs_update(void);
-
-#include "atk-dbus.h"
-
G_END_DECLS
#endif /* SPI_ACCESSIBLE_H_ */
* Boston, MA 02111-1307, USA.
*/
-#include "accessible.h"
+#include <atk/atk.h>
+#include <droute/droute.h>
-static AtkAction *
-get_action (DBusMessage * message)
-{
- AtkObject *obj = atk_dbus_get_object (dbus_message_get_path (message));
- if (!obj)
- return NULL;
- return ATK_ACTION (obj);
-}
-
-static AtkAction *
-get_action_from_path (const char *path, void *user_data)
-{
- AtkObject *obj = atk_dbus_get_object (path);
- if (!obj || !ATK_IS_ACTION(obj))
- return NULL;
- return ATK_ACTION (obj);
-}
+#include "spi-common/spi-dbus.h"
static dbus_bool_t
-impl_get_nActions (const char *path, DBusMessageIter *iter, void *user_data)
+impl_get_nActions (DBusMessageIter *iter, void *user_data)
{
- AtkAction *action = get_action_from_path (path, user_data);
- if (!action)
- return FALSE;
+ AtkAction *action = (AtkAction *) user_data;
+
+ g_return_val_if_fail (ATK_IS_ACTION (user_data), FALSE);
return droute_return_v_int32 (iter, atk_action_get_n_actions (action));
}
static DBusMessage *
impl_get_description (DBusConnection *bus, DBusMessage *message, void *user_data)
{
+ AtkAction *action = (AtkAction *) user_data;
+ DBusError error;
DBusMessage *reply;
dbus_int32_t index;
const char *desc;
- AtkAction *action = get_action (message);
- if (!action) return spi_dbus_general_error (message);
- if (!dbus_message_get_args (message, NULL, DBUS_TYPE_INT32, &index, DBUS_TYPE_INVALID))
+ dbus_error_init (&error);
+ g_return_val_if_fail (ATK_IS_ACTION (user_data),
+ droute_not_yet_handled_error (message));
+ if (!dbus_message_get_args (message, &error, DBUS_TYPE_INT32, &index, DBUS_TYPE_INVALID))
{
return spi_dbus_general_error (message);
}
impl_get_name (DBusConnection *bus, DBusMessage *message, void *user_data)
{
DBusMessage *reply;
+ DBusError error;
dbus_int32_t index;
const char *name;
- AtkAction *action = get_action (message);
+ AtkAction *action = (AtkAction *) user_data;
- if (!action) return spi_dbus_general_error (message);
- if (!dbus_message_get_args (message, NULL, DBUS_TYPE_INT32, &index, DBUS_TYPE_INVALID))
+ dbus_error_init (&error);
+ g_return_val_if_fail (ATK_IS_ACTION (user_data),
+ droute_not_yet_handled_error (message));
+ if (!dbus_message_get_args (message, &error, DBUS_TYPE_INT32, &index, DBUS_TYPE_INVALID))
{
return spi_dbus_general_error (message);
}
impl_get_keybinding (DBusConnection *bus, DBusMessage *message, void *user_data)
{
DBusMessage *reply;
+ DBusError error;
dbus_int32_t index;
const char *kb;
- AtkAction *action = get_action (message);
+ AtkAction *action = (AtkAction *) user_data;
- if (!action) return spi_dbus_general_error (message);
- if (!dbus_message_get_args (message, NULL, DBUS_TYPE_INT32, &index, DBUS_TYPE_INVALID))
+ dbus_error_init (&error);
+ g_return_val_if_fail (ATK_IS_ACTION (user_data),
+ droute_not_yet_handled_error (message));
+ if (!dbus_message_get_args (message, &error, DBUS_TYPE_INT32, &index, DBUS_TYPE_INVALID))
{
return spi_dbus_general_error (message);
}
static DBusMessage *impl_getActions(DBusConnection *bus, DBusMessage *message, void *user_data)
{
- AtkAction *action = get_action(message);
+ AtkAction *action = (AtkAction *) user_data;
DBusMessage *reply;
gint count;
gint i;
DBusMessageIter iter, iter_array, iter_struct;
- if (!action)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_ACTION (user_data),
+ droute_not_yet_handled_error (message));
count = atk_action_get_n_actions(action);
reply = dbus_message_new_method_return (message);
if (!reply) goto oom;
static DBusMessage *impl_doAction(DBusConnection *bus, DBusMessage *message, void *user_data)
{
- AtkAction *action = get_action(message);
+ AtkAction *action = (AtkAction *) user_data;
DBusError error;
dbus_int32_t index;
dbus_bool_t rv;
DBusMessage *reply;
- if (!action)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_ACTION (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &index, DBUS_TYPE_INVALID))
};
void
-spi_initialize_action (DRouteData * data)
+spi_initialize_action (DRoutePath *path)
{
- droute_add_interface (data, SPI_DBUS_INTERFACE_ACTION,
- methods, properties,
- (DRouteGetDatumFunction) get_action_from_path,
- NULL);
+ droute_path_add_interface (path,
+ SPI_DBUS_INTERFACE_ACTION,
+ methods,
+ properties);
};
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
-#include "accessible.h"
+#include <atk/atk.h>
+#include <droute/droute.h>
+
+#include "spi-common/spi-dbus.h"
static dbus_bool_t
-impl_get_toolkitName (const char *path, DBusMessageIter * iter,
+impl_get_toolkitName (DBusMessageIter * iter,
void *user_data)
{
return droute_return_v_string (iter, atk_get_toolkit_name ());
}
static dbus_bool_t
-impl_get_version (const char *path, DBusMessageIter * iter, void *user_data)
+impl_get_version (DBusMessageIter * iter, void *user_data)
{
return droute_return_v_string (iter, atk_get_toolkit_version ());
}
static dbus_int32_t id;
static dbus_bool_t
-impl_get_id (const char *path, DBusMessageIter * iter, void *user_data)
+impl_get_id (DBusMessageIter * iter, void *user_data)
{
return droute_return_v_int32 (iter, id);
}
static dbus_bool_t
-impl_set_id (const char *path, DBusMessageIter * iter, void *user_data)
+impl_set_id (DBusMessageIter * iter, void *user_data)
{
id = droute_get_v_int32 (iter);
return TRUE;
{NULL, NULL, NULL}
};
-static long
+/*static long
obj_is_root (const char *path, void *user_data)
{
AtkObject *obj = atk_dbus_get_object (path);
return (obj == atk_get_root ());
-}
+}*/
void
-spi_initialize_application (DRouteData * data)
+spi_initialize_application (DRoutePath *path)
{
- droute_add_interface (data, SPI_DBUS_INTERFACE_APPLICATION,
- methods, properties,
- (DRouteGetDatumFunction) obj_is_root, NULL);
+ droute_path_add_interface (path,
+ SPI_DBUS_INTERFACE_APPLICATION,
+ methods,
+ properties);
};
#include <stdlib.h>
#include <string.h>
+#include "bridge.h"
#include "accessible.h"
-/* TODO
+/* TODO
* Need to add concurrency support.
*/
static guint counter = 1;
+/* Amazingly the ATK event callbacks dont have a user
+ * data parameter. Instead, with great sadness, we use
+ * some global data. Data is declared and initialized
+ * in bridge.c.
+ */
+extern SpiAppData *atk_adaptor_app_data;
+
/*---------------------------------------------------------------------------*/
/*
{
g_hash_table_remove(ref2ptr, GINT_TO_POINTER(ref));
/* Add to removal list */
- /*
+ /*
* TODO
* Pyatspi client side exceptions have occured indicating
* that an object has been removed twice.
g_hash_table_insert(remove_list, GINT_TO_POINTER(ref), NULL);
}
- atk_tree_cache_needs_update();
+ atk_tree_cache_needs_update(atk_adaptor_app_data->bus);
}
/*---------------------------------------------------------------------------*/
/* Add to update list */
g_hash_table_insert (update_list, GINT_TO_POINTER(reference), accessible);
- atk_tree_cache_needs_update();
+ atk_tree_cache_needs_update(atk_adaptor_app_data->bus);
return reference;
}
{
guint ref;
g_assert(ATK_IS_OBJECT(accessible));
-
+
if (!g_object_get_data (G_OBJECT (accessible), "dbus-id"))
{
register_accessible(accessible);
}
else
{
- ref = g_object_get_data (G_OBJECT (accessible), "dbus-id");
- g_hash_table_insert (update_list, ref, accessible);
- atk_tree_cache_needs_update();
+ ref = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (accessible), "dbus-id"));
+ g_hash_table_insert (update_list, GINT_TO_POINTER (ref), accessible);
+ atk_tree_cache_needs_update(atk_adaptor_app_data->bus);
}
}
index = GPOINTER_TO_INT(g_object_get_data (G_OBJECT (accessible), "dbus-id"));
if (!index)
- index = register_accessible(G_OBJECT(accessible));
+ index = register_accessible(accessible);
return g_strdup_printf(ATK_BRIDGE_OBJECT_REFERENCE_TEMPLATE, index);
}
* Initializes all of the required D-Bus interfaces.
*/
void
-atk_dbus_initialize (DRouteData * data)
+atk_dbus_initialize (AtkObject *root)
{
if (!ref2ptr)
ref2ptr = g_hash_table_new(g_direct_hash, g_direct_equal);
remove_list = g_hash_table_new(g_direct_hash, g_direct_equal);
/* Get the root accessible and add */
- atk_dbus_register_subtree(atk_get_root());
-
- spi_initialize_accessible (data);
- spi_initialize_action(data);
- spi_initialize_collection (data);
- spi_initialize_component (data);
- spi_initialize_document (data);
- spi_initialize_editabletext (data);
- spi_initialize_hyperlink (data);
- spi_initialize_hypertext (data);
- spi_initialize_image (data);
- spi_initialize_selection (data);
- spi_initialize_table (data);
- spi_initialize_text (data);
- spi_initialize_value (data);
- spi_initialize_introspectable(data, (DRouteGetDatumFunction) atk_dbus_get_object);
+ atk_dbus_register_subtree(root);
}
/*END------------------------------------------------------------------------*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-
-#include "accessible.h"
+#include <glib.h>
void
atk_dbus_foreach_registered(GHFunc func, gpointer data);
dbus_bool_t
spi_dbus_return_v_object (DBusMessageIter *iter, AtkObject *obj, int unref);
-void
-atk_dbus_initialize (DRouteData * data);
-
#endif /* __ATK_DBUS__ */
#include <atk/atk.h>
#include <atk/atkobject.h>
#include <atk/atknoopobject.h>
-#include "accessible.h"
+
+#include <droute/droute.h>
+
#include "bridge.h"
+#include "event.h"
#include "atk-dbus.h"
-void spi_atk_register_event_listeners (void);
-void spi_atk_deregister_event_listeners (void);
-void spi_atk_tidy_windows (void);
+#include "spi-common/spi-dbus.h"
+
+/*
+ * Provides the path for the introspection directory.
+ */
+#if !defined ATSPI_INTROSPECTION_PATH
+ #error "No introspection XML directory defined"
+#endif
/*---------------------------------------------------------------------------*/
-SpiAppData *app_data = NULL;
+SpiAppData *atk_adaptor_app_data = NULL;
static const AtkMisc *atk_misc = NULL;
"registerApplication");
dbus_message_set_no_reply (message, TRUE);
- uname = dbus_bus_get_unique_name(app->droute.bus);
+ uname = dbus_bus_get_unique_name(app->bus);
dbus_message_iter_init_append(message, &iter);
dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &uname);
- dbus_connection_send (app->droute.bus, message, NULL);
+ dbus_connection_send (app->bus, message, NULL);
if (message) dbus_message_unref (message);
}
"deregisterApplication");
dbus_message_set_no_reply (message, TRUE);
- uname = dbus_bus_get_unique_name(app->droute.bus);
+ uname = dbus_bus_get_unique_name(app->bus);
dbus_message_iter_init_append(message, &iter);
dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &uname);
- dbus_connection_send (app->droute.bus, message, NULL);
+ dbus_connection_send (app->bus, message, NULL);
if (message) dbus_message_unref (message);
}
static void
exit_func (void)
{
- if (!app_data)
+ if (!atk_adaptor_app_data)
{
return;
}
spi_atk_tidy_windows ();
spi_atk_deregister_event_listeners();
- deregister_application (app_data);
+ deregister_application (atk_adaptor_app_data);
- g_free(app_data);
- app_data = NULL;
+ g_free(atk_adaptor_app_data);
+ atk_adaptor_app_data = NULL;
/* Not currently creating an XDisplay */
#if 0
/*---------------------------------------------------------------------------*/
-static DBusObjectPathVTable droute_vtable =
-{
- NULL,
- &droute_message,
- NULL, NULL, NULL, NULL
-};
-
static gchar *atspi_dbus_name;
static gboolean atspi_no_register;
GOptionContext *opt;
GError *err = NULL;
DBusError error;
+ DBusConnection *bus;
+ gchar *introspection_directory;
- if (app_data != NULL)
- return 0;
+ DRoutePath *treepath, *accpath;
/* Parse command line options */
opt = g_option_context_new(NULL);
g_warning("AT-SPI Option parsing failed: %s\n", err->message);
/* Allocate global data and do ATK initializations */
- app_data = g_new0 (SpiAppData, 1);
+ atk_adaptor_app_data = g_new0 (SpiAppData, 1);
atk_misc = atk_misc_get_instance ();
+ atk_adaptor_app_data->root = atk_get_root();
- /* Get D-Bus connection, register D-Bus name*/
+ /* Set up D-Bus connection and register bus name */
dbus_error_init (&error);
- app_data->root = atk_get_root();
- app_data->droute.bus = dbus_bus_get (DBUS_BUS_SESSION, &error);
- if (!app_data->droute.bus)
+ atk_adaptor_app_data->bus = dbus_bus_get (DBUS_BUS_SESSION, &error);
+ if (!atk_adaptor_app_data->bus)
{
g_warning ("AT-SPI Couldn't connect to D-Bus: %s\n", error.message);
- g_free(app_data);
- app_data = NULL;
+ g_free(atk_adaptor_app_data);
+ atk_adaptor_app_data = NULL;
return 0;
}
if (atspi_dbus_name != NULL &&
- dbus_bus_request_name(app_data->droute.bus, atspi_dbus_name, 0, &error))
+ dbus_bus_request_name(atk_adaptor_app_data->bus, atspi_dbus_name, 0, &error))
{
g_print("AT-SPI Recieved D-Bus name - %s\n", atspi_dbus_name);
}
- /* Finish setting up D-Bus */
- dbus_connection_setup_with_g_main(app_data->droute.bus, g_main_context_default());
+ dbus_connection_setup_with_g_main(atk_adaptor_app_data->bus, g_main_context_default());
+
+ /* Get D-Bus introspection directory */
+ introspection_directory = (char *) g_getenv("ATSPI_INTROSPECTION_PATH");
+ if (introspection_directory == NULL)
+ introspection_directory = ATSPI_INTROSPECTION_PATH;
/* Register droute for routing AT-SPI messages */
- spi_register_tree_object(app_data->droute.bus, &app_data->droute, "/org/freedesktop/atspi/tree");
+ atk_adaptor_app_data->droute = droute_new (atk_adaptor_app_data->bus, introspection_directory);
- if (!dbus_connection_register_fallback (app_data->droute.bus,
- "/org/freedesktop/atspi/accessible",
- &droute_vtable,
- &app_data->droute))
- {
- g_warning("AT-SPI Couldn't register droute.\n");
- g_free(app_data);
- app_data = NULL;
- return 0;
- }
+ treepath = droute_add_one (atk_adaptor_app_data->droute,
+ "/org/freedesktop/atspi/tree",
+ NULL);
+
+ accpath = droute_add_many (atk_adaptor_app_data->droute,
+ "/org/freedesktop/atspi/accessible",
+ NULL,
+ (DRouteGetDatumFunction) atk_dbus_get_object);
/* Register all interfaces with droute and set up application accessible db */
- atk_dbus_initialize (&app_data->droute);
+ spi_initialize_tree (treepath);
+
+ spi_initialize_accessible (accpath);
+ spi_initialize_action(accpath);
+ spi_initialize_collection (accpath);
+ spi_initialize_component (accpath);
+ spi_initialize_document (accpath);
+ spi_initialize_editabletext (accpath);
+ spi_initialize_hyperlink (accpath);
+ spi_initialize_hypertext (accpath);
+ spi_initialize_image (accpath);
+ spi_initialize_selection (accpath);
+ spi_initialize_table (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 this app by sending a signal out to AT-SPI registry daemon */
- register_application (app_data);
+ register_application (atk_adaptor_app_data);
g_atexit (exit_func);
* Boston, MA 02111-1307, USA.
*/
+#ifndef SPI_BRIDGE_H_
+#define SPI_BRIDGE_H_
+
+#include <atk/atk.h>
+#include <droute/droute.h>
+
+G_BEGIN_DECLS
+
typedef struct _SpiAppData SpiAppData;
struct _SpiAppData
{
- AtkObject *root;
- DRouteData droute;
+ AtkObject *root;
+ DBusConnection *bus;
+ DRouteContext *droute;
};
+
+void spi_initialize_accessible (DRoutePath *path);
+void spi_initialize_action (DRoutePath *path);
+void spi_initialize_application (DRoutePath *path);
+void spi_initialize_collection (DRoutePath *path);
+void spi_initialize_component (DRoutePath *path);
+void spi_initialize_document (DRoutePath *path);
+void spi_initialize_editabletext (DRoutePath *path);
+void spi_initialize_hyperlink (DRoutePath *path);
+void spi_initialize_hypertext (DRoutePath *path);
+void spi_initialize_image (DRoutePath *path);
+void spi_initialize_selection (DRoutePath *path);
+void spi_initialize_table (DRoutePath *path);
+void spi_initialize_text (DRoutePath *path);
+void spi_initialize_value (DRoutePath *path);
+
+void spi_initialize_tree (DRoutePath *path);
+
+G_END_DECLS
+
+#endif /* SPI_BRIDGE_H_ */
/* collection.c: implements the Collection interface */
-#include "accessible.h"
-#include "spi-common/bitarray.h"
#include <string.h>
+#include <atk/atk.h>
+#include <droute/droute.h>
+
+#include "atk-dbus.h"
+
+#include "spi-common/bitarray.h"
+#include "spi-common/spi-dbus.h"
+
#define get_object(message) atk_dbus_get_object(dbus_message_get_path(message))
typedef struct _MatchRulePrivate MatchRulePrivate;
if (!dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "o", &iter_array)) goto oom;
for (item = ls; item; item = g_list_next(item))
{
- char *path = spi_dbus_get_path((AtkObject *)item->data);
+ char *path = (char *) spi_dbus_get_path((AtkObject *)item->data);
dbus_message_iter_append_basic(&iter_array, DBUS_TYPE_OBJECT_PATH, &path);
g_free(path);
}
static DRouteMethod methods[] = {
{ impl_getMatchesFrom, "getMatchesFrom" },
{ impl_getMatchesTo, "getMatchesTo" },
- {impl_getMatches, "getMatches" },
+ { impl_getMatches, "getMatches" },
{NULL, NULL}
};
void
-spi_initialize_collection (DRouteData * data)
+spi_initialize_collection (DRoutePath *path)
{
- droute_add_interface (data, SPI_DBUS_INTERFACE_COLLECTION,
- methods, NULL, NULL, NULL);
+ droute_path_add_interface (path,
+ SPI_DBUS_INTERFACE_COLLECTION,
+ methods,
+ NULL);
};
* Boston, MA 02111-1307, USA.
*/
-#include "accessible.h"
+#include <atk/atk.h>
+#include <droute/droute.h>
-static AtkComponent *
-get_component (DBusMessage * message)
-{
- AtkObject *obj = atk_dbus_get_object (dbus_message_get_path (message));
- if (!obj)
- return NULL;
- return ATK_COMPONENT (obj);
-}
-
-static AtkComponent *
-get_component_from_path (const char *path, void *user_data)
-{
- AtkObject *obj = atk_dbus_get_object (path);
- if (!obj || !ATK_IS_COMPONENT(obj))
- return NULL;
- return ATK_COMPONENT (obj);
-}
+#include "atk-dbus.h"
+#include "spi-common/spi-dbus.h"
static DBusMessage *
impl_contains (DBusConnection * bus, DBusMessage * message, void *user_data)
{
- AtkComponent *component = get_component (message);
+ AtkComponent *component = (AtkComponent *) user_data;
dbus_int32_t x, y;
dbus_int16_t coord_type;
DBusError error;
dbus_bool_t retval;
DBusMessage *reply;
- if (!component)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_COMPONENT (user_data),
+ droute_not_yet_handled_error (message));
+
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &x, DBUS_TYPE_INT32, &y,
impl_getAccessibleAtPoint (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkComponent *component = get_component (message);
+ AtkComponent *component = (AtkComponent *) user_data;
dbus_int32_t x, y;
dbus_int16_t coord_type;
DBusError error;
AtkObject *child;
- if (!component)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_COMPONENT (user_data),
+ droute_not_yet_handled_error (message));
+
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &x, DBUS_TYPE_INT32, &y,
static DBusMessage *
impl_getExtents (DBusConnection * bus, DBusMessage * message, void *user_data)
{
- AtkComponent *component = get_component (message);
+ AtkComponent *component = (AtkComponent *) user_data;
DBusError error;
dbus_int16_t coord_type;
gint ix, iy, iwidth, iheight;
- if (!component)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_COMPONENT (user_data),
+ droute_not_yet_handled_error (message));
+
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT16, &coord_type, DBUS_TYPE_INVALID))
impl_getPosition (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkComponent *component = get_component (message);
+ AtkComponent *component = (AtkComponent *) user_data;
DBusError error;
dbus_int16_t coord_type;
gint ix = 0, iy = 0;
dbus_int32_t x, y;
DBusMessage *reply;
- if (!component)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_COMPONENT (user_data),
+ droute_not_yet_handled_error (message));
+
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT16, &coord_type, DBUS_TYPE_INVALID))
static DBusMessage *
impl_getSize (DBusConnection * bus, DBusMessage * message, void *user_data)
{
- AtkComponent *component = get_component (message);
+ AtkComponent *component = (AtkComponent *) user_data;
gint iwidth = 0, iheight = 0;
dbus_int32_t width, height;
DBusMessage *reply;
- if (!component)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_COMPONENT (user_data),
+ droute_not_yet_handled_error (message));
+
atk_component_get_size (component, &iwidth, &iheight);
width = iwidth;
height = iheight;
static DBusMessage *
impl_getLayer (DBusConnection * bus, DBusMessage * message, void *user_data)
{
- AtkComponent *component = get_component (message);
+ AtkComponent *component = (AtkComponent *) user_data;
AtkLayer atklayer;
dbus_uint32_t rv;
DBusMessage *reply;
- if (!component)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_COMPONENT (user_data),
+ droute_not_yet_handled_error (message));
+
atklayer = atk_component_get_layer (component);
switch (atklayer)
impl_getMDIZOrder (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkComponent *component = get_component (message);
+ AtkComponent *component = (AtkComponent *) user_data;
dbus_int16_t rv;
DBusMessage *reply;
- if (!component)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_COMPONENT (user_data),
+ droute_not_yet_handled_error (message));
+
rv = atk_component_get_mdi_zorder (component);
reply = dbus_message_new_method_return (message);
if (reply)
static DBusMessage *
impl_grabFocus (DBusConnection * bus, DBusMessage * message, void *user_data)
{
- AtkComponent *component = get_component (message);
+ AtkComponent *component = (AtkComponent *) user_data;
dbus_bool_t rv;
DBusMessage *reply;
- if (!component)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_COMPONENT (user_data),
+ droute_not_yet_handled_error (message));
+
rv = atk_component_grab_focus (component);
reply = dbus_message_new_method_return (message);
if (reply)
static DBusMessage *
impl_getAlpha (DBusConnection * bus, DBusMessage * message, void *user_data)
{
- AtkComponent *component = get_component (message);
+ AtkComponent *component = (AtkComponent *) user_data;
double rv;
DBusMessage *reply;
- if (!component)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_COMPONENT (user_data),
+ droute_not_yet_handled_error (message));
+
rv = atk_component_get_alpha (component);
reply = dbus_message_new_method_return (message);
if (reply)
};
void
-spi_initialize_component (DRouteData * data)
+spi_initialize_component (DRoutePath *path)
{
- droute_add_interface (data, SPI_DBUS_INTERFACE_COMPONENT,
- methods, NULL,
- (DRouteGetDatumFunction) get_component_from_path,
- NULL);
+ droute_path_add_interface (path,
+ SPI_DBUS_INTERFACE_COMPONENT,
+ methods,
+ NULL);
};
* Boston, MA 02111-1307, USA.
*/
-#include "accessible.h"
+#include <atk/atk.h>
+#include <droute/droute.h>
-static AtkDocument *
-get_document (DBusMessage * message)
-{
- AtkObject *obj = atk_dbus_get_object (dbus_message_get_path (message));
- if (!obj)
- return NULL;
- return ATK_DOCUMENT (obj);
-}
-
-static AtkDocument *
-get_document_from_path (const char *path, void *user_data)
-{
- AtkObject *obj = atk_dbus_get_object (path);
- if (!obj || !ATK_IS_DOCUMENT(obj))
- return NULL;
- return ATK_DOCUMENT (obj);
-}
+#include "spi-common/spi-dbus.h"
static DBusMessage *
-impl_getLocale (DBusConnection * bus, DBusMessage * message, void *user_data)
+impl_getLocale (DBusConnection *bus,
+ DBusMessage *message,
+ void *user_data)
{
- AtkDocument *document = get_document (message);
+ AtkDocument *document = (AtkDocument *) user_data;
const gchar *lc;
DBusMessage *reply;
- if (!document)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_DOCUMENT (user_data),
+ droute_not_yet_handled_error (message));
lc = atk_document_get_locale (document);
if (!lc)
lc = "";
impl_getAttributeValue (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkDocument *document = get_document (message);
+ AtkDocument *document = (AtkDocument *) user_data;
DBusError error;
gchar *attributename;
const gchar *atr;
DBusMessage *reply;
- if (!document)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_DOCUMENT (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_STRING, &attributename, DBUS_TYPE_INVALID))
impl_getAttributes (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkDocument *document = get_document (message);
+ AtkDocument *document = (AtkDocument *) user_data;
DBusMessage *reply;
AtkAttributeSet *attributes;
AtkAttribute *attr = NULL;
gint n_attributes = 0;
gint i;
- if (!document)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_DOCUMENT (user_data),
+ droute_not_yet_handled_error (message));
attributes = atk_document_get_attributes (document);
if (attributes)
};
void
-spi_initialize_document (DRouteData * data)
+spi_initialize_document (DRoutePath *path)
{
- droute_add_interface (data, SPI_DBUS_INTERFACE_DOCUMENT,
- methods, NULL,
- (DRouteGetDatumFunction) get_document_from_path,
- NULL);
+ droute_path_add_interface (path,
+ SPI_DBUS_INTERFACE_DOCUMENT,
+ methods,
+ NULL);
};
* Boston, MA 02111-1307, USA.
*/
-#include "accessible.h"
+#include <atk/atk.h>
+#include <droute/droute.h>
-static AtkEditableText *
-get_editable (DBusMessage * message)
-{
- AtkObject *obj = atk_dbus_get_object (dbus_message_get_path (message));
- if (!obj)
- return NULL;
- return ATK_EDITABLE_TEXT (obj);
-}
-
-static AtkEditableText *
-get_editable_from_path (const char *path, void *user_data)
-{
- AtkObject *obj = atk_dbus_get_object (path);
- if (!obj || !ATK_IS_EDITABLE_TEXT(obj))
- return NULL;
- return ATK_EDITABLE_TEXT (obj);
-}
+#include "spi-common/spi-dbus.h"
static DBusMessage *
impl_setTextContents (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkEditableText *editable = get_editable (message);
+ AtkEditableText *editable = (AtkEditableText *) user_data;
const char *newContents;
dbus_bool_t rv;
DBusError error;
DBusMessage *reply;
- if (!editable)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_EDITABLE_TEXT (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_STRING, &newContents, DBUS_TYPE_INVALID))
static DBusMessage *
impl_insertText (DBusConnection * bus, DBusMessage * message, void *user_data)
{
- AtkEditableText *editable = get_editable (message);
+ AtkEditableText *editable = (AtkEditableText *) user_data;
dbus_int32_t position, length;
char *text;
dbus_bool_t rv;
DBusMessage *reply;
gint ip;
- if (!editable)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_EDITABLE_TEXT (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &position, DBUS_TYPE_STRING, &text,
impl_setAttributes (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkEditableText *editable = get_editable (message);
+ AtkEditableText *editable = (AtkEditableText *) user_data;
const char *attributes;
dbus_int32_t startPos, endPos;
dbus_bool_t rv;
DBusError error;
DBusMessage *reply;
- if (!editable)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_EDITABLE_TEXT (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_STRING, &attributes, DBUS_TYPE_INT32,
static DBusMessage *
impl_copyText (DBusConnection * bus, DBusMessage * message, void *user_data)
{
- AtkEditableText *editable = get_editable (message);
+ AtkEditableText *editable = (AtkEditableText *) user_data;
dbus_int32_t startPos, endPos;
DBusError error;
- if (!editable)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_EDITABLE_TEXT (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &startPos, DBUS_TYPE_INT32, &endPos,
static DBusMessage *
impl_cutText (DBusConnection * bus, DBusMessage * message, void *user_data)
{
- AtkEditableText *editable = get_editable (message);
+ AtkEditableText *editable = (AtkEditableText *) user_data;
dbus_int32_t startPos, endPos;
DBusError error;
dbus_bool_t rv;
DBusMessage *reply;
- if (!editable)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_EDITABLE_TEXT (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &startPos, DBUS_TYPE_INT32, &endPos,
static DBusMessage *
impl_deleteText (DBusConnection * bus, DBusMessage * message, void *user_data)
{
- AtkEditableText *editable = get_editable (message);
+ AtkEditableText *editable = (AtkEditableText *) user_data;
dbus_int32_t startPos, endPos;
DBusError error;
dbus_bool_t rv;
DBusMessage *reply;
- if (!editable)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_EDITABLE_TEXT (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &startPos, DBUS_TYPE_INT32, &endPos,
static DBusMessage *
impl_pasteText (DBusConnection * bus, DBusMessage * message, void *user_data)
{
- AtkEditableText *editable = get_editable (message);
+ AtkEditableText *editable = (AtkEditableText *) user_data;
dbus_int32_t position;
DBusError error;
dbus_bool_t rv;
DBusMessage *reply;
- if (!editable)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_EDITABLE_TEXT (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &position, DBUS_TYPE_INVALID))
};
void
-spi_initialize_editabletext (DRouteData * data)
+spi_initialize_editabletext (DRoutePath *path)
{
- droute_add_interface (data, SPI_DBUS_INTERFACE_EDITABLE_TEXT,
- methods, NULL,
- (DRouteGetDatumFunction) get_editable_from_path,
- NULL);
+ droute_path_add_interface (path,
+ SPI_DBUS_INTERFACE_EDITABLE_TEXT,
+ methods,
+ NULL);
};
* Boston, MA 02111-1307, USA.
*/
-#include <atk/atk.h>
#include <string.h>
-#include "accessible.h"
+
+#include <atk/atk.h>
+#include <droute/droute.h>
+
#include "bridge.h"
#include "atk-dbus.h"
-extern SpiAppData *app_data;
+#include "spi-common/spi-dbus.h"
static GArray *listener_ids = NULL;
static gint atk_bridge_key_event_listener_id;
static gint atk_bridge_focus_tracker_id;
+/* Amazingly the ATK event callbacks dont have a user
+ * data parameter. Instead, with great sadness, we use
+ * some global data. Data is declared and initialized
+ * in bridge.c.
+ */
+extern SpiAppData *atk_adaptor_app_data;
/*---------------------------------------------------------------------------*/
dbus_error_init(&error);
if (spi_dbus_marshal_deviceEvent(message, key_event))
{
- DBusMessage *reply = dbus_connection_send_with_reply_and_block(app_data->droute.bus, message, 1000, &error);
+ DBusMessage *reply = dbus_connection_send_with_reply_and_block(atk_adaptor_app_data->bus, message, 1000, &error);
if (reply)
{
DBusError error;
dbus_message_iter_append_basic(&sub, (int) *type, &val);
dbus_message_iter_close_container(&iter, &sub);
- dbus_connection_send(app_data->droute.bus, sig, NULL);
+ dbus_connection_send(atk_adaptor_app_data->bus, sig, NULL);
dbus_message_unref(sig);
}
dbus_message_iter_close_container (&variant, &sub);
dbus_message_iter_close_container (&iter, &variant);
- dbus_connection_send(app_data->droute.bus, sig, NULL);
+ dbus_connection_send(atk_adaptor_app_data->bus, sig, NULL);
}
/*---------------------------------------------------------------------------*/
--- /dev/null
+/*
+ * AT-SPI - Assistive Technology Service Provider Interface
+ * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
+ *
+ * Copyright 2001, 2002 Sun Microsystems Inc.,
+ * Copyright 2001, 2002 Ximian, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef SPI_EVENT_H_
+#define SPI_EVENT_H_
+
+#include <atk/atk.h>
+#include <spi-common/spi-types.h>
+
+G_BEGIN_DECLS
+
+void spi_atk_register_event_listeners (void);
+void spi_atk_deregister_event_listeners (void);
+void spi_atk_tidy_windows (void);
+
+G_END_DECLS
+
+#endif /* SPI_EVENT_H_ */
* Boston, MA 02111-1307, USA.
*/
-#include "accessible.h"
+#include <atk/atk.h>
+#include <droute/droute.h>
-static AtkHyperlink *
-get_hyperlink (DBusMessage * message)
-{
- AtkObject *obj = atk_dbus_get_object (dbus_message_get_path (message));
- if (!obj)
- return NULL;
- return ATK_HYPERLINK (obj);
-}
-
-static AtkHyperlink *
-get_hyperlink_from_path (const char *path, void *user_data)
-{
- AtkObject *obj = atk_dbus_get_object (path);
- if (!obj || !ATK_IS_HYPERLINK(obj))
- return NULL;
- return ATK_HYPERLINK (obj);
-}
+#include "atk-dbus.h"
+#include "spi-common/spi-dbus.h"
static dbus_bool_t
-impl_get_nAnchors (const char *path, DBusMessageIter * iter, void *user_data)
+impl_get_nAnchors (DBusMessageIter * iter, void *user_data)
{
- AtkHyperlink *link = get_hyperlink_from_path (path, user_data);
- if (!link)
- return FALSE;
+ AtkHyperlink *link = (AtkHyperlink *) user_data;
+ g_return_val_if_fail (ATK_IS_HYPERLINK (user_data), FALSE);
return droute_return_v_int32 (iter, atk_hyperlink_get_n_anchors (link));
}
static dbus_bool_t
-impl_get_startIndex (const char *path, DBusMessageIter * iter,
+impl_get_startIndex (DBusMessageIter * iter,
void *user_data)
{
- AtkHyperlink *link = get_hyperlink_from_path (path, user_data);
- if (!link)
- return FALSE;
+ AtkHyperlink *link = (AtkHyperlink *) user_data;
+ g_return_val_if_fail (ATK_IS_HYPERLINK (user_data), FALSE);
return droute_return_v_int32 (iter, atk_hyperlink_get_start_index (link));
}
static dbus_bool_t
-impl_get_endIndex (const char *path, DBusMessageIter * iter, void *user_data)
+impl_get_endIndex (DBusMessageIter * iter, void *user_data)
{
- AtkHyperlink *link = get_hyperlink_from_path (path, user_data);
- if (!link)
- return FALSE;
+ AtkHyperlink *link = (AtkHyperlink *) user_data;
+ g_return_val_if_fail (ATK_IS_HYPERLINK (user_data), FALSE);
return droute_return_v_int32 (iter, atk_hyperlink_get_end_index (link));
}
static DBusMessage *
impl_getObject (DBusConnection * bus, DBusMessage * message, void *user_data)
{
- AtkHyperlink *link = get_hyperlink (message);
+ AtkHyperlink *link = (AtkHyperlink *) user_data;
DBusError error;
dbus_int32_t i;
AtkObject *atk_object;
- if (!link)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_HYPERLINK (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &i, DBUS_TYPE_INVALID))
static DBusMessage *
impl_getURI (DBusConnection * bus, DBusMessage * message, void *user_data)
{
- AtkHyperlink *link = get_hyperlink (message);
+ AtkHyperlink *link = (AtkHyperlink *) user_data;
dbus_int32_t i;
DBusError error;
gchar *rv;
DBusMessage *reply;
- if (!link)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_HYPERLINK (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &i, DBUS_TYPE_INT32, &i,
static DBusMessage *
impl_isValid (DBusConnection * bus, DBusMessage * message, void *user_data)
{
- AtkHyperlink *link = get_hyperlink (message);
+ AtkHyperlink *link = (AtkHyperlink *) user_data;
dbus_bool_t rv;
DBusMessage *reply;
- if (!link)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_HYPERLINK (user_data),
+ droute_not_yet_handled_error (message));
rv = atk_hyperlink_is_valid (link);
reply = dbus_message_new_method_return (message);
};
void
-spi_initialize_hyperlink (DRouteData * data)
+spi_initialize_hyperlink (DRoutePath *path)
{
- droute_add_interface (data, SPI_DBUS_INTERFACE_HYPERLINK,
- methods, properties,
- (DRouteGetDatumFunction) get_hyperlink_from_path,
- NULL);
+ droute_path_add_interface (path,
+ SPI_DBUS_INTERFACE_HYPERLINK,
+ methods,
+ properties);
};
* Boston, MA 02111-1307, USA.
*/
-#include "accessible.h"
+#include <atk/atk.h>
+#include <droute/droute.h>
-static AtkHypertext *
-get_hypertext (DBusMessage * message)
-{
- AtkObject *obj = atk_dbus_get_object (dbus_message_get_path (message));
- if (!obj)
- return NULL;
- return ATK_HYPERTEXT (obj);
-}
-
-static AtkHypertext *
-get_hypertext_from_path (const char *path, void *user_data)
-{
- AtkObject *obj = atk_dbus_get_object (path);
- if (!obj || !ATK_IS_HYPERTEXT(obj))
- return NULL;
- return ATK_HYPERTEXT (obj);
-}
+#include "spi-common/spi-dbus.h"
static DBusMessage *
impl_getNLinks (DBusConnection * bus, DBusMessage * message, void *user_data)
{
- AtkHypertext *hypertext = get_hypertext (message);
+ AtkHypertext *hypertext = (AtkHypertext *) user_data;
gint rv;
DBusMessage *reply;
- if (!hypertext)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_HYPERTEXT (user_data),
+ droute_not_yet_handled_error (message));
rv = atk_hypertext_get_n_links (hypertext);
reply = dbus_message_new_method_return (message);
if (reply)
static DBusMessage *
impl_getLink (DBusConnection * bus, DBusMessage * message, void *user_data)
{
- AtkHypertext *hypertext = get_hypertext (message);
+ AtkHypertext *hypertext = (AtkHypertext *) user_data;
DBusError error;
dbus_int32_t linkIndex;
AtkHyperlink *link;
- if (!hypertext)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_HYPERTEXT (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &linkIndex, DBUS_TYPE_INVALID))
impl_getLinkIndex (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkHypertext *hypertext = get_hypertext (message);
+ AtkHypertext *hypertext = (AtkHypertext *) user_data;
DBusError error;
dbus_int32_t characterIndex;
dbus_int32_t rv;
DBusMessage *reply;
- if (!hypertext)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_HYPERTEXT (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &characterIndex, DBUS_TYPE_INVALID))
};
void
-spi_initialize_hypertext (DRouteData * data)
+spi_initialize_hypertext (DRoutePath *path)
{
- droute_add_interface (data, SPI_DBUS_INTERFACE_HYPERTEXT,
- methods, NULL,
- (DRouteGetDatumFunction) get_hypertext_from_path,
- NULL);
+ droute_path_add_interface (path,
+ SPI_DBUS_INTERFACE_HYPERTEXT,
+ methods,
+ NULL);
};
* Boston, MA 02111-1307, USA.
*/
-#include "accessible.h"
+#include <atk/atk.h>
+#include <droute/droute.h>
-static AtkImage *
-get_image (DBusMessage * message)
-{
- AtkObject *obj = atk_dbus_get_object (dbus_message_get_path (message));
- if (!obj)
- return NULL;
- return ATK_IMAGE (obj);
-}
-
-static AtkImage *
-get_image_from_path (const char *path, void *user_data)
-{
- AtkObject *obj = atk_dbus_get_object (path);
- if (!obj || !ATK_IS_IMAGE(obj))
- return NULL;
- return ATK_IMAGE (obj);
-}
+#include "spi-common/spi-dbus.h"
static dbus_bool_t
-impl_get_imageDescription (const char *path, DBusMessageIter * iter,
+impl_get_imageDescription (DBusMessageIter * iter,
void *user_data)
{
- AtkImage *image = get_image_from_path (path, user_data);
- if (!image)
- return FALSE;
+ AtkImage *image = (AtkImage *) user_data;
+ g_return_val_if_fail (ATK_IS_IMAGE (user_data), FALSE);
return droute_return_v_string (iter,
atk_image_get_image_description (image));
}
static dbus_bool_t
-impl_get_imageLocale (const char *path, DBusMessageIter * iter,
+impl_get_imageLocale (DBusMessageIter * iter,
void *user_data)
{
- AtkImage *image = get_image_from_path (path, user_data);
- if (!image)
- return FALSE;
+ AtkImage *image = (AtkImage *) user_data;
+ g_return_val_if_fail (ATK_IS_IMAGE (user_data), FALSE);
return droute_return_v_string (iter, atk_image_get_image_locale (image));
}
impl_getImageExtents (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkImage *image = get_image (message);
+ AtkImage *image = (AtkImage *) user_data;
DBusError error;
dbus_int16_t coordType;
gint ix, iy, iwidth, iheight;
- if (!image)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_IMAGE (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT16, &coordType, DBUS_TYPE_INVALID))
impl_getImagePosition (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkImage *image = get_image (message);
+ AtkImage *image = (AtkImage *) user_data;
DBusError error;
dbus_int16_t coord_type;
gint ix = 0, iy = 0;
dbus_int32_t x, y;
DBusMessage *reply;
- if (!image)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_IMAGE (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT16, &coord_type, DBUS_TYPE_INVALID))
impl_getImageSize (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkImage *image = get_image (message);
+ AtkImage *image = (AtkImage *) user_data;
gint iwidth = 0, iheight = 0;
dbus_int32_t width, height;
DBusMessage *reply;
- if (!image)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_IMAGE (user_data),
+ droute_not_yet_handled_error (message));
atk_image_get_image_size (image, &iwidth, &iheight);
width = iwidth;
height = iheight;
};
void
-spi_initialize_image (DRouteData * data)
+spi_initialize_image (DRoutePath *path)
{
- droute_add_interface (data, SPI_DBUS_INTERFACE_IMAGE, methods,
- properties,
- (DRouteGetDatumFunction) get_image_from_path, NULL);
+ droute_path_add_interface (path,
+ SPI_DBUS_INTERFACE_IMAGE,
+ methods,
+ properties);
};
+++ /dev/null
-/*
- * AT-SPI - Assistive Technology Service Provider Interface
- * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
- *
- * Copyright 2008 Codethink Ltd.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <glib.h>
-#include <accessible.h>
-
-#include <droute/droute.h>
-#include <droute/introspect-loader.h>
-
-/*
- * This file contains an implementation of the D-Bus introspectable interface.
- * For ATK objects.
- */
-
-/*
- * This function finds the names of each interface that the ATK object supports
- * and appends the introspection XML for each interface.
- */
-static DBusMessage *
-impl_introspect (DBusConnection *bus, DBusMessage *message,
- void *user_data)
-{
- AtkObject *object;
- const char *path;
- GString *output;
- char *final;
-
- DBusMessage *reply;
-
- path = dbus_message_get_path(message);
- object = spi_dbus_get_object(path);
-
- output = g_string_new(spi_introspection_header);
-
- g_string_append_printf(output, spi_introspection_node_element, path);
-
- spi_append_interface(output, SPI_DBUS_INTERFACE_ACCESSIBLE);
-
- if (ATK_IS_ACTION (object))
- spi_append_interface(output, SPI_DBUS_INTERFACE_ACTION);
-
- if (ATK_IS_COMPONENT (object))
- spi_append_interface(output, SPI_DBUS_INTERFACE_COMPONENT);
-
- if (ATK_IS_EDITABLE_TEXT (object))
- spi_append_interface(output, SPI_DBUS_INTERFACE_EDITABLE_TEXT);
-
- if (ATK_IS_TEXT (object))
- spi_append_interface(output, SPI_DBUS_INTERFACE_TEXT);
-
- if (ATK_IS_HYPERTEXT (object))
- spi_append_interface(output, SPI_DBUS_INTERFACE_HYPERTEXT);
-
- if (ATK_IS_IMAGE (object))
- spi_append_interface(output, SPI_DBUS_INTERFACE_IMAGE);
-
- if (ATK_IS_SELECTION (object))
- spi_append_interface(output, SPI_DBUS_INTERFACE_SELECTION);
-
- if (ATK_IS_TABLE (object))
- spi_append_interface(output, SPI_DBUS_INTERFACE_TABLE);
-
- if (ATK_IS_VALUE (object))
- spi_append_interface(output, SPI_DBUS_INTERFACE_VALUE);
-
- if (ATK_IS_STREAMABLE_CONTENT (object))
- spi_append_interface(output, "org.freedesktop.atspi.StreamableContent");
-
- if (ATK_IS_DOCUMENT (object))
- {
- spi_append_interface(output, "org.freedesktop.atspi.Collection");
- spi_append_interface(output, SPI_DBUS_INTERFACE_DOCUMENT);
- }
-
- if (ATK_IS_HYPERLINK_IMPL (object))
- spi_append_interface(output, SPI_DBUS_INTERFACE_HYPERLINK);
-
- g_string_append(output, spi_introspection_footer);
- final = g_string_free(output, FALSE);
-
- reply = dbus_message_new_method_return (message);
- g_assert(reply != NULL);
- dbus_message_append_args(reply, DBUS_TYPE_STRING, &final,
- DBUS_TYPE_INVALID);
-
- g_free(final);
- return reply;
-}
-
-static DRouteMethod methods[] = {
- {impl_introspect, "Introspect"},
- {NULL, NULL}
-};
-
-/*
- * Adds the introspectable interface to the DRoute object provided
- */
-void
-spi_initialize_introspectable (DRouteData *data, DRouteGetDatumFunction verify_object)
-{
- droute_add_interface (data, "org.freedesktop.DBus.Introspectable",
- methods, NULL,
- verify_object, NULL);
-};
#include <config.h>
#include <stdio.h>
-#include <libspi/accessible.h>
-#include <libspi/relation.h>
+#include <atk/atk.h>
+#include <droute/droute.h>
+
+#include "spi-common/spi-types.h"
+#include "spi-common/spi-dbus.h"
static gboolean
spi_init_relation_type_table (Accessibility_RelationType *types)
* Boston, MA 02111-1307, USA.
*/
-#include "accessible.h"
+#include <atk/atk.h>
+#include <droute/droute.h>
-static AtkSelection *
-get_selection (DBusMessage * message)
-{
- AtkObject *obj = atk_dbus_get_object (dbus_message_get_path (message));
- if (!obj)
- return NULL;
- return ATK_SELECTION (obj);
-}
-
-static AtkSelection *
-get_selection_from_path (const char *path, void *user_data)
-{
- AtkObject *obj = atk_dbus_get_object (path);
- if (!obj || ~ATK_IS_SELECTION(obj))
- return NULL;
- return ATK_SELECTION (obj);
-}
+#include "spi-common/spi-dbus.h"
static dbus_bool_t
-impl_get_nSelectedChildren (const char *path, DBusMessageIter * iter,
+impl_get_nSelectedChildren (DBusMessageIter * iter,
void *user_data)
{
- AtkSelection *selection = get_selection_from_path (path, user_data);
- if (!selection)
- return FALSE;
+ AtkSelection *selection = (AtkSelection *) user_data;
+ g_return_val_if_fail (ATK_IS_SELECTION (user_data), FALSE);
return droute_return_v_int32 (iter,
atk_selection_get_selection_count
(selection));
}
-static char *
+/*static char *
impl_get_nSelectedChildren_str (void *datum)
{
g_assert (ATK_IS_HYPERLINK (datum));
return g_strdup_printf ("%d",
atk_selection_get_selection_count ((AtkSelection *)
datum));
-}
+}*/
static DBusMessage *
impl_getSelectedChild (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkSelection *selection = get_selection (message);
+ AtkSelection *selection = (AtkSelection *) user_data;
DBusError error;
dbus_int32_t selectedChildIndex;
AtkObject *atk_object;
- if (!selection)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_SELECTION (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &selectedChildIndex,
impl_selectChild (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkSelection *selection = get_selection (message);
+ AtkSelection *selection = (AtkSelection *) user_data;
DBusError error;
dbus_int32_t childIndex;
dbus_bool_t rv;
DBusMessage *reply;
- if (!selection)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_SELECTION (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &childIndex, DBUS_TYPE_INVALID))
impl_deselectSelectedChild (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkSelection *selection = get_selection (message);
+ AtkSelection *selection = (AtkSelection *) user_data;
DBusError error;
dbus_int32_t selectedChildIndex;
dbus_bool_t rv;
DBusMessage *reply;
- if (!selection)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_SELECTION (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &selectedChildIndex,
impl_isChildSelected (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkSelection *selection = get_selection (message);
+ AtkSelection *selection = (AtkSelection *) user_data;
DBusError error;
dbus_int32_t childIndex;
dbus_bool_t rv;
DBusMessage *reply;
- if (!selection)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_SELECTION (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &childIndex, DBUS_TYPE_INVALID))
static DBusMessage *
impl_selectAll (DBusConnection * bus, DBusMessage * message, void *user_data)
{
- AtkSelection *selection = get_selection (message);
+ AtkSelection *selection = (AtkSelection *) user_data;
dbus_bool_t rv;
DBusMessage *reply;
- if (!selection)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_SELECTION (user_data),
+ droute_not_yet_handled_error (message));
rv = atk_selection_select_all_selection (selection);
reply = dbus_message_new_method_return (message);
if (reply)
impl_clearSelection (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkSelection *selection = get_selection (message);
+ AtkSelection *selection = (AtkSelection *) user_data;
dbus_bool_t rv;
DBusMessage *reply;
- if (!selection)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_SELECTION (user_data),
+ droute_not_yet_handled_error (message));
rv = atk_selection_clear_selection (selection);
reply = dbus_message_new_method_return (message);
if (reply)
impl_deselectChild (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkSelection *selection = get_selection (message);
+ AtkSelection *selection = (AtkSelection *) user_data;
DBusError error;
dbus_int32_t selectedChildIndex;
dbus_bool_t rv = FALSE;
gint i, nselected;
DBusMessage *reply;
- if (!selection)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_SELECTION (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &selectedChildIndex,
};
void
-spi_initialize_selection (DRouteData * data)
+spi_initialize_selection (DRoutePath *path)
{
- droute_add_interface (data, SPI_DBUS_INTERFACE_SELECTION,
- methods, properties,
- (DRouteGetDatumFunction) get_selection_from_path,
- NULL);
+ droute_path_add_interface (path,
+ SPI_DBUS_INTERFACE_SELECTION,
+ methods,
+ properties);
};
* Boston, MA 02111-1307, USA.
*/
-#include "accessible.h"
+#include <atk/atk.h>
+#include <droute/droute.h>
-static AtkTable *
-get_table (DBusMessage * message)
-{
- AtkObject *obj = atk_dbus_get_object (dbus_message_get_path (message));
- if (!obj)
- return NULL;
- return ATK_TABLE (obj);
-}
-
-static AtkTable *
-get_table_from_path (const char *path, void *user_data)
-{
- AtkObject *obj = atk_dbus_get_object (path);
- if (!obj || !ATK_IS_TABLE(obj))
- return NULL;
- return ATK_TABLE (obj);
-}
+#include "atk-dbus.h"
+#include "spi-common/spi-dbus.h"
static dbus_bool_t
-impl_get_nRows (const char *path, DBusMessageIter * iter, void *user_data)
+impl_get_nRows (DBusMessageIter * iter, void *user_data)
{
- AtkTable *table = get_table_from_path (path, user_data);
- if (!table)
- return FALSE;
+ AtkTable *table = (AtkTable *) user_data;
+ g_return_val_if_fail (ATK_IS_TABLE (user_data), FALSE);
return droute_return_v_int32 (iter, atk_table_get_n_rows (table));
}
static dbus_bool_t
-impl_get_nColumns (const char *path, DBusMessageIter * iter, void *user_data)
+impl_get_nColumns (DBusMessageIter * iter, void *user_data)
{
- AtkTable *table = get_table_from_path (path, user_data);
- if (!table)
- return FALSE;
+ AtkTable *table = (AtkTable *) user_data;
+ g_return_val_if_fail (ATK_IS_TABLE (user_data), FALSE);
return droute_return_v_int32 (iter, atk_table_get_n_columns (table));
}
static dbus_bool_t
-impl_get_caption (const char *path, DBusMessageIter * iter, void *user_data)
+impl_get_caption (DBusMessageIter * iter, void *user_data)
{
- AtkTable *table = get_table_from_path (path, user_data);
- if (!table)
- return FALSE;
+ AtkTable *table = (AtkTable *) user_data;
+ g_return_val_if_fail (ATK_IS_TABLE (user_data), FALSE);
return spi_dbus_return_v_object (iter, atk_table_get_caption (table),
FALSE);
}
static dbus_bool_t
-impl_get_summary (const char *path, DBusMessageIter * iter, void *user_data)
+impl_get_summary (DBusMessageIter * iter, void *user_data)
{
- AtkTable *table = get_table_from_path (path, user_data);
- if (!table)
- return FALSE;
+ AtkTable *table = (AtkTable *) user_data;
+ g_return_val_if_fail (ATK_IS_TABLE (user_data), FALSE);
return spi_dbus_return_v_object (iter, atk_table_get_summary (table),
FALSE);
}
static dbus_bool_t
-impl_get_nSelectedRows (const char *path, DBusMessageIter * iter,
+impl_get_nSelectedRows (DBusMessageIter * iter,
void *user_data)
{
- AtkTable *table = get_table_from_path (path, user_data);
+ AtkTable *table = (AtkTable *) user_data;
gint *selected_rows = NULL;
int count;
- if (!table)
- return FALSE;
+ g_return_val_if_fail (ATK_IS_TABLE (user_data), FALSE);
count = atk_table_get_selected_rows (table, &selected_rows);
if (selected_rows)
g_free (selected_rows);
}
static dbus_bool_t
-impl_get_nSelectedColumns (const char *path, DBusMessageIter * iter,
+impl_get_nSelectedColumns (DBusMessageIter * iter,
void *user_data)
{
- AtkTable *table = get_table_from_path (path, user_data);
+ AtkTable *table = (AtkTable *) user_data;
gint *selected_columns = NULL;
int count;
- if (!table)
- return FALSE;
+ g_return_val_if_fail (ATK_IS_TABLE (user_data), FALSE);
count = atk_table_get_selected_columns (table, &selected_columns);
if (selected_columns)
g_free (selected_columns);
impl_getAccessibleAt (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkTable *table = get_table (message);
+ AtkTable *table = (AtkTable *) user_data;
dbus_int32_t row, column;
DBusError error;
AtkObject *obj;
- if (!table)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_TABLE (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &row, DBUS_TYPE_INT32, &column,
static DBusMessage *
impl_getIndexAt (DBusConnection * bus, DBusMessage * message, void *user_data)
{
- AtkTable *table = get_table (message);
+ AtkTable *table = (AtkTable *) user_data;
dbus_int32_t row, column;
dbus_int32_t index;
DBusError error;
DBusMessage *reply;
- if (!table)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_TABLE (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &row, DBUS_TYPE_INT32, &column,
impl_getRowAtIndex (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkTable *table = get_table (message);
+ AtkTable *table = (AtkTable *) user_data;
dbus_int32_t index;
dbus_int32_t row;
DBusError error;
DBusMessage *reply;
- if (!table)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_TABLE (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &index, DBUS_TYPE_INVALID))
impl_getColumnAtIndex (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkTable *table = get_table (message);
+ AtkTable *table = (AtkTable *) user_data;
dbus_int32_t index;
dbus_int32_t column;
DBusError error;
DBusMessage *reply;
- if (!table)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_TABLE (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &index, DBUS_TYPE_INVALID))
impl_getRowDescription (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkTable *table = get_table (message);
dbus_int32_t row;
+ AtkTable *table = (AtkTable *) user_data;
const gchar *description;
DBusError error;
DBusMessage *reply;
- if (!table)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_TABLE (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &row, DBUS_TYPE_INVALID))
impl_getColumnDescription (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkTable *table = get_table (message);
+ AtkTable *table = (AtkTable *) user_data;
dbus_int32_t column;
const char *description;
DBusError error;
DBusMessage *reply;
- if (!table)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_TABLE (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &column, DBUS_TYPE_INVALID))
impl_getRowExtentAt (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkTable *table = get_table (message);
+ AtkTable *table = (AtkTable *) user_data;
dbus_int32_t row, column;
dbus_int32_t extent;
DBusError error;
DBusMessage *reply;
- if (!table)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_TABLE (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &row, DBUS_TYPE_INT32, &column,
impl_getColumnExtentAt (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkTable *table = get_table (message);
+ AtkTable *table = (AtkTable *) user_data;
dbus_int32_t row, column;
dbus_int32_t extent;
DBusError error;
DBusMessage *reply;
- if (!table)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_TABLE (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &row, DBUS_TYPE_INT32, &column,
impl_getRowHeader (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkTable *table = get_table (message);
+ AtkTable *table = (AtkTable *) user_data;
dbus_int32_t row;
DBusError error;
AtkObject *obj;
- if (!table)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_TABLE (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &row, DBUS_TYPE_INVALID))
impl_getColumnHeader (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkTable *table = get_table (message);
+ AtkTable *table = (AtkTable *) user_data;
dbus_int32_t column;
DBusError error;
AtkObject *obj;
- if (!table)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_TABLE (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &column, DBUS_TYPE_INVALID))
impl_getSelectedRows (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkTable *table = get_table (message);
+ AtkTable *table = (AtkTable *) user_data;
gint *selected_rows = NULL;
gint count;
DBusMessage *reply;
- if (!table)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_TABLE (user_data),
+ droute_not_yet_handled_error (message));
count = atk_table_get_selected_rows (table, &selected_rows);
if (!selected_rows)
count = 0;
impl_getSelectedColumns (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkTable *table = get_table (message);
+ AtkTable *table = (AtkTable *) user_data;
gint *selected_columns = NULL;
gint count;
DBusMessage *reply;
- if (!table)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_TABLE (user_data),
+ droute_not_yet_handled_error (message));
count = atk_table_get_selected_columns (table, &selected_columns);
if (!selected_columns)
count = 0;
impl_isRowSelected (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkTable *table = get_table (message);
+ AtkTable *table = (AtkTable *) user_data;
dbus_int32_t row;
DBusError error;
DBusMessage *reply;
dbus_bool_t ret;
- if (!table)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_TABLE (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &row, DBUS_TYPE_INVALID))
impl_isColumnSelected (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkTable *table = get_table (message);
+ AtkTable *table = (AtkTable *) user_data;
dbus_int32_t column;
DBusError error;
DBusMessage *reply;
dbus_bool_t ret;
- if (!table)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_TABLE (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &column, DBUS_TYPE_INVALID))
static DBusMessage *
impl_isSelected (DBusConnection * bus, DBusMessage * message, void *user_data)
{
- AtkTable *table = get_table (message);
+ AtkTable *table = (AtkTable *) user_data;
dbus_int32_t row, column;
DBusError error;
DBusMessage *reply;
dbus_bool_t ret;
- if (!table)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_TABLE (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &row, DBUS_TYPE_INT32, &column,
impl_addRowSelection (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkTable *table = get_table (message);
+ AtkTable *table = (AtkTable *) user_data;
dbus_int32_t row;
DBusError error;
DBusMessage *reply;
dbus_bool_t ret;
- if (!table)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_TABLE (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &row, DBUS_TYPE_INVALID))
impl_addColumnSelection (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkTable *table = get_table (message);
+ AtkTable *table = (AtkTable *) user_data;
dbus_int32_t column;
DBusError error;
DBusMessage *reply;
dbus_bool_t ret;
- if (!table)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_TABLE (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &column, DBUS_TYPE_INVALID))
impl_removeRowSelection (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkTable *table = get_table (message);
+ AtkTable *table = (AtkTable *) user_data;
dbus_int32_t row;
DBusError error;
DBusMessage *reply;
dbus_bool_t ret;
- if (!table)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_TABLE (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &row, DBUS_TYPE_INVALID))
impl_removeColumnSelection (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkTable *table = get_table (message);
+ AtkTable *table = (AtkTable *) user_data;
dbus_int32_t column;
DBusError error;
DBusMessage *reply;
dbus_bool_t ret;
- if (!table)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_TABLE (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &column, DBUS_TYPE_INVALID))
impl_getRowColumnExtentsAtIndex (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkTable *table = get_table (message);
+ AtkTable *table = (AtkTable *) user_data;
dbus_int32_t index;
DBusError error;
dbus_int32_t row, column, row_extents, col_extents;
AtkObject *cell;
AtkRole role;
- if (!table)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_TABLE (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &index, DBUS_TYPE_INVALID))
};
void
-spi_initialize_table (DRouteData * data)
+spi_initialize_table (DRoutePath *path)
{
- droute_add_interface (data, SPI_DBUS_INTERFACE_TABLE, methods,
- properties,
- (DRouteGetDatumFunction) get_table_from_path, NULL);
+ droute_path_add_interface (path,
+ SPI_DBUS_INTERFACE_TABLE,
+ methods,
+ properties);
};
* Boston, MA 02111-1307, USA.
*/
-#include "accessible.h"
#include <string.h>
-static AtkText *
-get_text (DBusMessage * message)
-{
- AtkObject *obj = atk_dbus_get_object (dbus_message_get_path (message));
- if (!obj)
- return NULL;
- return ATK_TEXT (obj);
-}
+#include <atk/atk.h>
+#include <droute/droute.h>
-static AtkText *
-get_text_from_path (const char *path, void *user_data)
-{
- AtkObject *obj = atk_dbus_get_object (path);
- if (!obj || !ATK_IS_TEXT(obj))
- return NULL;
- return ATK_TEXT (obj);
-}
+#include "spi-common/spi-dbus.h"
static dbus_bool_t
-impl_get_characterCount (const char *path, DBusMessageIter * iter,
+impl_get_characterCount (DBusMessageIter * iter,
void *user_data)
{
- AtkText *text = get_text_from_path (path, user_data);
- if (!text)
- return FALSE;
+ AtkText *text = (AtkText *) user_data;
+ g_return_val_if_fail (ATK_IS_TEXT (user_data), FALSE);
return droute_return_v_int32 (iter, atk_text_get_character_count (text));
}
static dbus_bool_t
-impl_get_caretOffset (const char *path, DBusMessageIter * iter,
+impl_get_caretOffset (DBusMessageIter * iter,
void *user_data)
{
- AtkText *text = get_text_from_path (path, user_data);
- if (!text)
- return FALSE;
+ AtkText *text = (AtkText *) user_data;
+ g_return_val_if_fail (ATK_IS_TEXT (user_data), FALSE);
return droute_return_v_int32 (iter, atk_text_get_caret_offset (text));
}
static DBusMessage *
impl_getText (DBusConnection * bus, DBusMessage * message, void *user_data)
{
- AtkText *text = get_text (message);
+ AtkText *text = (AtkText *) user_data;
dbus_int32_t startOffset, endOffset;
gchar *txt;
DBusError error;
DBusMessage *reply;
- if (!text)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_TEXT (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &startOffset, DBUS_TYPE_INT32,
impl_setCaretOffset (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkText *text = get_text (message);
+ AtkText *text = (AtkText *) user_data;
dbus_int32_t offset;
dbus_bool_t rv;
DBusError error;
DBusMessage *reply;
- if (!text)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_TEXT (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &offset, DBUS_TYPE_INVALID))
impl_getTextBeforeOffset (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkText *text = get_text (message);
+ AtkText *text = (AtkText *) user_data;
dbus_int32_t offset;
dbus_uint32_t type;
gchar *txt;
DBusError error;
DBusMessage *reply;
- if (!text)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_TEXT (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &offset, DBUS_TYPE_UINT32, &type,
impl_getTextAtOffset (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkText *text = get_text (message);
+ AtkText *text = (AtkText *) user_data;
dbus_int32_t offset, type;
gchar *txt;
dbus_int32_t startOffset, endOffset;
DBusError error;
DBusMessage *reply;
- if (!text)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_TEXT (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &offset, DBUS_TYPE_UINT32, &type,
impl_getTextAfterOffset (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkText *text = get_text (message);
+ AtkText *text = (AtkText *) user_data;
dbus_int32_t offset;
dbus_uint32_t type;
gchar *txt;
DBusError error;
DBusMessage *reply;
- if (!text)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_TEXT (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &offset, DBUS_TYPE_UINT32, &type,
impl_getCharacterAtOffset (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkText *text = get_text (message);
+ AtkText *text = (AtkText *) user_data;
dbus_int32_t offset;
dbus_int32_t ch;
DBusError error;
DBusMessage *reply;
- if (!text)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_TEXT (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &offset, DBUS_TYPE_INVALID))
impl_getAttributeValue (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkText *text = get_text (message);
+ AtkText *text = (AtkText *) user_data;
dbus_int32_t offset;
char *attributeName;
dbus_int32_t startOffset, endOffset;
GSList *cur_attr;
AtkAttribute *at;
- if (!text)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_TEXT (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &offset, DBUS_TYPE_STRING,
impl_getAttributes (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkText *text = get_text (message);
+ AtkText *text = (AtkText *) user_data;
dbus_int32_t offset;
dbus_int32_t startOffset, endOffset;
gint intstart_offset, intend_offset;
DBusMessage *reply;
AtkAttributeSet *set;
- if (!text)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_TEXT (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &offset, DBUS_TYPE_INVALID))
impl_getDefaultAttributes (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkText *text = get_text (message);
+ AtkText *text = (AtkText *) user_data;
char *rv;
DBusError error;
DBusMessage *reply;
AtkAttributeSet *set;
- if (!text)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_TEXT (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
set = atk_text_get_default_attributes (text);
impl_getCharacterExtents (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkText *text = get_text (message);
+ AtkText *text = (AtkText *) user_data;
dbus_int32_t offset;
dbus_int16_t coordType;
dbus_int32_t x, y, width, height;
DBusError error;
DBusMessage *reply;
- if (!text)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_TEXT (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &offset, DBUS_TYPE_INT16, &coordType,
impl_getOffsetAtPoint (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkText *text = get_text (message);
+ AtkText *text = (AtkText *) user_data;
dbus_int32_t x, y;
dbus_int16_t coordType;
dbus_int32_t rv;
DBusError error;
DBusMessage *reply;
- if (!text)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_TEXT (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &x, DBUS_TYPE_INT32, &y,
impl_getNSelections (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkText *text = get_text (message);
+ AtkText *text = (AtkText *) user_data;
dbus_int32_t rv;
DBusMessage *reply;
- if (!text)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_TEXT (user_data),
+ droute_not_yet_handled_error (message));
rv = atk_text_get_n_selections (text);
reply = dbus_message_new_method_return (message);
if (reply)
impl_getSelection (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkText *text = get_text (message);
+ AtkText *text = (AtkText *) user_data;
dbus_int32_t selectionNum;
dbus_int32_t startOffset, endOffset;
gint intstart_offset = 0, intend_offset = 0;
DBusError error;
DBusMessage *reply;
- if (!text)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_TEXT (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &selectionNum, DBUS_TYPE_INVALID))
impl_addSelection (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkText *text = get_text (message);
+ AtkText *text = (AtkText *) user_data;
dbus_int32_t startOffset, endOffset;
dbus_bool_t rv;
DBusError error;
DBusMessage *reply;
- if (!text)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_TEXT (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &startOffset, DBUS_TYPE_INT32,
impl_removeSelection (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkText *text = get_text (message);
+ AtkText *text = (AtkText *) user_data;
dbus_int32_t selectionNum;
dbus_bool_t rv;
DBusError error;
DBusMessage *reply;
- if (!text)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_TEXT (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &selectionNum, DBUS_TYPE_INVALID))
impl_setSelection (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkText *text = get_text (message);
+ AtkText *text = (AtkText *) user_data;
dbus_int32_t selectionNum, startOffset, endOffset;
dbus_bool_t rv;
DBusError error;
DBusMessage *reply;
- if (!text)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_TEXT (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &selectionNum, DBUS_TYPE_INT32,
impl_getRangeExtents (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkText *text = get_text (message);
+ AtkText *text = (AtkText *) user_data;
dbus_int32_t startOffset, endOffset;
dbus_int16_t coordType;
AtkTextRectangle rect;
DBusError error;
DBusMessage *reply;
- if (!text)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_TEXT (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &startOffset, DBUS_TYPE_INT32,
impl_getBoundedRanges (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkText *text = get_text (message);
+ AtkText *text = (AtkText *) user_data;
dbus_int32_t x, y, width, height;
dbus_int16_t coordType, xClipType, yClipType;
DBusError error;
DBusMessage *reply;
DBusMessageIter iter, array, struc, variant;
- if (!text)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_TEXT (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &x, DBUS_TYPE_INT32, &y,
void *user_data)
{
DBusError error;
- AtkText *text = get_text (message);
+ AtkText *text = (AtkText *) user_data;
dbus_int32_t offset;
dbus_bool_t includeDefaults;
dbus_int32_t startOffset, endOffset;
gint n_attributes = 0, total_attributes = 0, n_default_attributes = 0;
gint i, j;
- if (!text)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_TEXT (user_data),
+ droute_not_yet_handled_error (message));
dbus_error_init (&error);
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_INT32, &offset, DBUS_TYPE_BOOLEAN,
impl_getDefaultAttributeSet (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
- AtkText *text = get_text (message);
+ AtkText *text = (AtkText *) user_data;
DBusMessage *reply;
AtkAttributeSet *attributes;
AtkAttribute *attr = NULL;
gint n_attributes = 0;
gint i;
- if (!text)
- return spi_dbus_general_error (message);
+ g_return_val_if_fail (ATK_IS_TEXT (user_data),
+ droute_not_yet_handled_error (message));
attributes = atk_text_get_default_attributes (text);
if (attributes)
};
void
-spi_initialize_text (DRouteData * data)
+spi_initialize_text (DRoutePath *path)
{
- droute_add_interface (data, SPI_DBUS_INTERFACE_TEXT, methods,
- properties,
- (DRouteGetDatumFunction) get_text_from_path, NULL);
+ droute_path_add_interface (path,
+ SPI_DBUS_INTERFACE_TEXT,
+ methods,
+ properties);
};
*/
#include <string.h>
-#include <droute/introspect-loader.h>
-#include "accessible.h"
+#include <atk/atk.h>
+#include <droute/droute.h>
+
+#include "atk-dbus.h"
+#include "spi-common/spi-dbus.h"
#include "bridge.h"
-extern SpiAppData *app_data;
static gboolean update_pending = FALSE;
/*---------------------------------------------------------------------------*/
+static void
+append_atk_object_interfaces (AtkObject *object, DBusMessageIter *iter)
+{
+ const gchar *itf;
+
+ itf = SPI_DBUS_INTERFACE_ACCESSIBLE;
+ dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &itf);
+
+ if (ATK_IS_ACTION (object))
+ {
+ itf = SPI_DBUS_INTERFACE_ACTION;
+ dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &itf);
+ }
+
+ if (ATK_IS_COMPONENT (object))
+ {
+ itf = SPI_DBUS_INTERFACE_COMPONENT;
+ dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &itf);
+ }
+
+ if (ATK_IS_EDITABLE_TEXT (object))
+ {
+ itf = SPI_DBUS_INTERFACE_EDITABLE_TEXT;
+ dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &itf);
+ }
+
+ if (ATK_IS_TEXT (object))
+ {
+ itf = SPI_DBUS_INTERFACE_TEXT;
+ dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &itf);
+ }
+
+ if (ATK_IS_HYPERTEXT (object))
+ {
+ itf = SPI_DBUS_INTERFACE_HYPERTEXT;
+ dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &itf);
+ }
+
+ if (ATK_IS_IMAGE (object))
+ {
+ itf = SPI_DBUS_INTERFACE_IMAGE;
+ dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &itf);
+ }
+
+ if (ATK_IS_SELECTION (object))
+ {
+ itf = SPI_DBUS_INTERFACE_SELECTION;
+ dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &itf);
+ }
+
+ if (ATK_IS_TABLE (object))
+ {
+ itf = SPI_DBUS_INTERFACE_TABLE;
+ dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &itf);
+ }
+
+ if (ATK_IS_VALUE (object))
+ {
+ itf = SPI_DBUS_INTERFACE_VALUE;
+ dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &itf);
+ }
+
+ if (ATK_IS_STREAMABLE_CONTENT (object))
+ {
+ itf = "org.freedesktop.atspi.StreamableContent";
+ dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &itf);
+ }
+
+ if (ATK_IS_DOCUMENT (object))
+ {
+ itf = "org.freedesktop.atspi.Collection";
+ dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &itf);
+ itf = SPI_DBUS_INTERFACE_DOCUMENT;
+ dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &itf);
+ }
+
+ if (ATK_IS_HYPERLINK_IMPL (object))
+ {
+ itf = SPI_DBUS_INTERFACE_HYPERLINK;
+ dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &itf);
+ }
+}
+
+/*---------------------------------------------------------------------------*/
+
static const char *dumm = "/APath/1";
/*
AtkObject *obj;
DBusMessageIter *iter_array;
DBusMessageIter iter_struct, iter_sub_array;
- DRouteData *data;
dbus_int32_t states [2];
int count;
obj = ATK_OBJECT(obj_data);
iter_array = (DBusMessageIter *) iter;
- data = &(app_data->droute);
dbus_message_iter_open_container (iter_array, DBUS_TYPE_STRUCT, NULL, &iter_struct);
{
{
AtkObject *child;
gchar *child_path;
-
+
child = atk_object_ref_accessible_child (obj, i);
- child_path = atk_dbus_get_path (child);
- g_object_unref(G_OBJECT(child));
- dbus_message_iter_append_basic (&iter_sub_array, DBUS_TYPE_OBJECT_PATH, &child_path);
- g_free (child_path);
- }
+ child_path = atk_dbus_get_path (child);
+ g_object_unref(G_OBJECT(child));
+ dbus_message_iter_append_basic (&iter_sub_array, DBUS_TYPE_OBJECT_PATH, &child_path);
+ g_free (child_path);
+ }
}
dbus_message_iter_close_container (&iter_struct, &iter_sub_array);
dbus_message_iter_open_container (&iter_struct, DBUS_TYPE_ARRAY, "s", &iter_sub_array);
- {
- for (l = data->interfaces; l; l = g_slist_next (l))
- {
- DRouteInterface *iface_def = (DRouteInterface *) l->data;
- void *datum = NULL;
-
- if (iface_def->get_datum)
- {
- datum = (*iface_def->get_datum) (path, data->user_data);
- if (!datum)
- continue;
- }
- dbus_message_iter_append_basic (&iter_sub_array, DBUS_TYPE_STRING, &iface_def->name);
- if (iface_def->free_datum)
- (*iface_def->free_datum) (datum);
- }
- }
+ append_atk_object_interfaces (obj, &iter_sub_array);
dbus_message_iter_close_container (&iter_struct, &iter_sub_array);
name = atk_object_get_name (obj);
dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_STRING, &desc);
g_free(path);
- }
+ }
spi_atk_state_to_dbus_array (obj, &states);
dbus_message_iter_open_container (&iter_struct, DBUS_TYPE_ARRAY, "u", &iter_sub_array);
for (count = 0; count < 2; count++)
/*---------------------------------------------------------------------------*/
static gboolean
-send_cache_update(gpointer d)
+send_cache_update(gpointer data)
{
DBusMessage *message;
DBusMessageIter iter;
DBusMessageIter iter_array;
- DRouteData *data;
-
- data = &(app_data->droute);
+ DBusConnection *bus = (DBusConnection *) data;
message = dbus_message_new_signal ("/org/freedesktop/atspi/tree", SPI_DBUS_INTERFACE_TREE, "updateTree");
atk_dbus_foreach_remove_list(append_accessible_path, &iter_array);
dbus_message_iter_close_container(&iter, &iter_array);
- dbus_connection_send(data->bus, message, NULL);
+ dbus_connection_send(bus, message, NULL);
update_pending = FALSE;
return FALSE;
/*---------------------------------------------------------------------------*/
void
-atk_tree_cache_needs_update(void)
+atk_tree_cache_needs_update(DBusConnection *bus)
{
if (!update_pending)
{
- g_idle_add(send_cache_update, NULL);
+ g_idle_add(send_cache_update, bus);
update_pending = TRUE;
}
}
/*---------------------------------------------------------------------------*/
-static DBusMessage *
-impl_introspect (DBusConnection *bus, DBusMessage *message, void *user_data)
-{
- const char *path;
- GString *output;
- char *final;
-
- DBusMessage *reply;
-
- path = dbus_message_get_path(message);
-
- output = g_string_new(spi_introspection_header);
-
- g_string_append_printf(output, spi_introspection_node_element, path);
-
- spi_append_interface(output, SPI_DBUS_INTERFACE_TREE);
-
- g_string_append(output, spi_introspection_footer);
- final = g_string_free(output, FALSE);
-
- reply = dbus_message_new_method_return (message);
- g_assert(reply != NULL);
- dbus_message_append_args(reply, DBUS_TYPE_STRING, &final,
- DBUS_TYPE_INVALID);
-
- g_free(final);
- return reply;
-}
-
-/*---------------------------------------------------------------------------*/
-
-static DBusHandlerResult
-message_handler (DBusConnection *bus, DBusMessage *message, void *user_data)
-{
- const char *iface = dbus_message_get_interface (message);
- const char *member = dbus_message_get_member (message);
-
- DBusMessage *reply = NULL;
-
- g_return_val_if_fail(iface != NULL, DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
-
- if (!strcmp(iface, SPI_DBUS_INTERFACE_TREE))
- {
- if (!strcmp(member, "getRoot"))
- {
- reply = impl_getRoot(bus, message, user_data);
- }
-
- if (!strcmp(member, "getTree"))
- {
- reply = impl_getTree(bus, message, user_data);
- }
- }
-
- if (!strcmp(iface, "org.freedesktop.DBus.Introspectable"))
- {
- if (!strcmp(member, "Introspect"))
- {
- reply = impl_introspect(bus, message, user_data);
- }
- }
-
- if (reply)
- {
- dbus_connection_send (bus, reply, NULL);
- dbus_message_unref (reply);
- }
-
- return DBUS_HANDLER_RESULT_HANDLED;
-}
-
-/*---------------------------------------------------------------------------*/
-
-static DBusObjectPathVTable tree_vtable =
-{
- NULL,
- &message_handler,
- NULL, NULL, NULL, NULL
+static DRouteMethod methods[] = {
+ {impl_getRoot, "getRoot"},
+ {impl_getTree, "getTree"},
+ {NULL, NULL}
};
-/*---------------------------------------------------------------------------*/
-
void
-spi_register_tree_object(DBusConnection *bus,
- DRouteData *data,
- const char *path)
+spi_initialize_tree (DRoutePath *path)
{
- dbus_bool_t mem = FALSE;
- mem = dbus_connection_register_object_path(bus, path, &tree_vtable, data);
- g_assert(mem == TRUE);
-}
+ droute_path_add_interface (path,
+ SPI_DBUS_INTERFACE_TREE,
+ methods,
+ NULL);
+};
/*END------------------------------------------------------------------------*/
--- /dev/null
+/*
+ * AT-SPI - Assistive Technology Service Provider Interface
+ * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
+ *
+ * Copyright 2001, 2002 Sun Microsystems Inc.,
+ * Copyright 2001, 2002 Ximian, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef SPI_TREE_H_
+#define SPI_TREE_H_
+
+#include <atk/atk.h>
+#include <spi-common/spi-types.h>
+
+G_BEGIN_DECLS
+
+void atk_tree_cache_needs_update(void);
+
+G_END_DECLS
+
+#endif /* SPI_ACCESSIBLE_H_ */
* Boston, MA 02111-1307, USA.
*/
-#include "accessible.h"
#include <math.h>
-static AtkValue *
-get_value_from_path (const char *path, void *user_data)
-{
- AtkObject *obj = atk_dbus_get_object (path);
- if (!obj || !ATK_IS_VALUE(obj))
- return NULL;
- return ATK_VALUE (obj);
-}
+#include <atk/atk.h>
+#include <droute/droute.h>
+
+#include "spi-common/spi-dbus.h"
static double
get_double_from_gvalue (GValue * gvalue)
}
static dbus_bool_t
-impl_get_minimumValue (const char *path, DBusMessageIter * iter,
+impl_get_minimumValue (DBusMessageIter * iter,
void *user_data)
{
- AtkValue *value = get_value_from_path (path, user_data);
+ AtkValue *value = (AtkValue *) user_data;
GValue gvalue = { 0, };
- if (!value)
- return FALSE;
+ g_return_val_if_fail (ATK_IS_VALUE (user_data), FALSE);
atk_value_get_minimum_value (value, &gvalue);
return droute_return_v_double (iter, get_double_from_gvalue (&gvalue));
}
static dbus_bool_t
-impl_get_maximumValue (const char *path, DBusMessageIter * iter,
+impl_get_maximumValue (DBusMessageIter * iter,
void *user_data)
{
- AtkValue *value = get_value_from_path (path, user_data);
+ AtkValue *value = (AtkValue *) user_data;
GValue gvalue = { 0, };
- if (!value)
- return FALSE;
+ g_return_val_if_fail (ATK_IS_VALUE (user_data), FALSE);
atk_value_get_maximum_value (value, &gvalue);
return droute_return_v_double (iter, get_double_from_gvalue (&gvalue));
}
static dbus_bool_t
-impl_get_minimumIncrement (const char *path, DBusMessageIter * iter,
+impl_get_minimumIncrement (DBusMessageIter * iter,
void *user_data)
{
- AtkValue *value = get_value_from_path (path, user_data);
+ AtkValue *value = (AtkValue *) user_data;
GValue gvalue = { 0, };
- if (!value)
- return FALSE;
+ g_return_val_if_fail (ATK_IS_VALUE (user_data), FALSE);
atk_value_get_minimum_value (value, &gvalue);
return droute_return_v_double (iter, get_double_from_gvalue (&gvalue));
}
static dbus_bool_t
-impl_get_currentValue (const char *path, DBusMessageIter * iter,
+impl_get_currentValue (DBusMessageIter * iter,
void *user_data)
{
- AtkValue *value = get_value_from_path (path, user_data);
+ AtkValue *value = (AtkValue *) user_data;
GValue gvalue = { 0, };
- if (!value)
- return FALSE;
+ g_return_val_if_fail (ATK_IS_VALUE (user_data), FALSE);
atk_value_get_current_value (value, &gvalue);
return droute_return_v_double (iter, get_double_from_gvalue (&gvalue));
}
static dbus_bool_t
-impl_set_currentValue (const char *path, DBusMessageIter * iter,
+impl_set_currentValue (DBusMessageIter * iter,
void *user_data)
{
- AtkValue *value = get_value_from_path (path, user_data);
+ AtkValue *value = (AtkValue *) user_data;
GValue gvalue = { 0, };
double dbl;
- if (!value)
- return FALSE;
+ g_return_val_if_fail (ATK_IS_VALUE (user_data), FALSE);
if (!get_double_from_variant (iter, &dbl))
return FALSE;
atk_value_get_current_value (value, &gvalue);
};
void
-spi_initialize_value (DRouteData * data)
+spi_initialize_value (DRoutePath *path)
{
- droute_add_interface (data, SPI_DBUS_INTERFACE_VALUE, NULL,
- properties,
- (DRouteGetDatumFunction) get_value_from_path, NULL);
+ droute_path_add_interface (path,
+ SPI_DBUS_INTERFACE_VALUE,
+ NULL,
+ properties);
};
if (!msg)
goto out;
+ p = arg_types;
dbus_message_iter_init (msg, &iter);
dbind_any_marshal_va (&iter, &p, args);
droute-variant.h\
droute-pairhash.c\
droute-pairhash.h
+
+TESTS = droute-test
+
+droute_test_CFLAGS = $(DBUS_GLIB_CFLAGS) \
+ -I$(top_builddir)
+
+check_PROGRAMS = droute-test
+droute_test_SOURCES = droute-test.c
+droute_test_CPPFLAGS = $(DBUS_GLIB_CFLAGS) \
+ -I$(top_builddir)\
+ -DTEST_INTROSPECTION_DIRECTORY=\"$(top_srcdir)/droute\"
+
+droute_test_LDFLAGS = $(top_builddir)/dbind/libdbind.la\
+ libdroute.la\
+ $(DBUS_GLIB_LIBS)
pair = g_new (StrPair, 1);
pair->one = one;
pair->two = two;
+ return pair;
}
gint
StrPair *pair = (StrPair *) key;
guint hash = 0;
+ /*g_return_val_if_fail (pair != NULL, 0);
+ g_return_val_if_fail (pair->one != NULL, 0);
+ g_return_val_if_fail (pair->two != NULL, 0);
+ */
+
if (*(pair->two) != '\0')
{
hash = *(pair->two);
--- /dev/null
+#include <stdio.h>
+#include <glib.h>
+#include <string.h>
+#include <droute/droute.h>
+
+#include "dbus/dbus-glib-lowlevel.h"
+
+#define TEST_OBJECT_PATH "/test/object"
+#define TEST_INTERFACE_ONE "test.interface.One"
+#define TEST_INTERFACE_TWO "test.interface.Two"
+
+#define OBJECT_ONE "ObjectOne";
+#define OBJECT_TWO "ObjectTwo";
+
+#if !defined TEST_INTROSPECTION_DIRECTORY
+ #error "No introspection XML directory defined"
+#endif
+
+#define STRING_ONE "StringOne"
+#define STRING_TWO "StringTwo"
+
+#define INT_ONE 0
+#define INT_TWO 456
+
+#define NONE_REPLY_STRING "NoneMethod"
+
+typedef struct _AnObject
+{
+ gchar *astring;
+ guint *anint;
+} AnObject;
+
+static DBusConnection *bus;
+static GMainLoop *main_loop;
+static gboolean success = TRUE;
+
+static DBusMessage *
+impl_null (DBusConnection *bus, DBusMessage *message, void *user_data)
+{
+ AnObject *object = (AnObject *) user_data;
+ DBusMessage *reply;
+ DBusError error;
+
+ reply = dbus_message_new_method_return (message);
+ return reply;
+}
+
+static DBusMessage *
+impl_getInt (DBusConnection *bus, DBusMessage *message, void *user_data)
+{
+ AnObject *object = (AnObject *) user_data;
+ DBusMessage *reply;
+ DBusError error;
+
+ dbus_error_init (&error);
+
+ reply = dbus_message_new_method_return (message);
+ dbus_message_append_args (reply, DBUS_TYPE_INT32, &(object->anint), DBUS_TYPE_INVALID);
+ return reply;
+}
+
+static DBusMessage *
+impl_setInt (DBusConnection *bus, DBusMessage *message, void *user_data)
+{
+ AnObject *object = (AnObject *) user_data;
+ DBusMessage *reply;
+ DBusError error;
+
+ dbus_error_init (&error);
+
+ dbus_message_get_args (message, &error, DBUS_TYPE_INT32, &(object->anint), DBUS_TYPE_INVALID);
+
+ reply = dbus_message_new_method_return (message);
+ return reply;
+}
+
+static DBusMessage *
+impl_getString (DBusConnection *bus, DBusMessage *message, void *user_data)
+{
+ AnObject *object = (AnObject *) user_data;
+ DBusMessage *reply;
+ DBusError error;
+
+ dbus_error_init (&error);
+
+ reply = dbus_message_new_method_return (message);
+ dbus_message_append_args (reply, DBUS_TYPE_STRING, &(object->astring), DBUS_TYPE_INVALID);
+ return reply;
+}
+
+static DBusMessage *
+impl_setString (DBusConnection *bus, DBusMessage *message, void *user_data)
+{
+ AnObject *object = (AnObject *) user_data;
+ DBusMessage *reply;
+ DBusError error;
+
+ dbus_error_init (&error);
+
+ g_free (object->astring);
+ dbus_message_get_args (message, &error, DBUS_TYPE_STRING, &(object->astring), DBUS_TYPE_INVALID);
+
+ reply = dbus_message_new_method_return (message);
+ return reply;
+}
+
+static DBusMessage *
+impl_getInterfaceOne (DBusConnection *bus, DBusMessage *message, void *user_data)
+{
+ AnObject *object = (AnObject *) user_data;
+ DBusMessage *reply;
+ DBusError error;
+ gchar *itf = TEST_INTERFACE_ONE;
+
+ dbus_error_init (&error);
+
+ reply = dbus_message_new_method_return (message);
+ dbus_message_append_args (reply, DBUS_TYPE_STRING, &itf, DBUS_TYPE_INVALID);
+ return reply;
+}
+
+static DBusMessage *
+impl_getInterfaceTwo (DBusConnection *bus, DBusMessage *message, void *user_data)
+{
+ AnObject *object = (AnObject *) user_data;
+ DBusMessage *reply;
+ DBusError error;
+ gchar *itf = TEST_INTERFACE_TWO;
+
+ dbus_error_init (&error);
+
+ reply = dbus_message_new_method_return (message);
+ dbus_message_append_args (reply, DBUS_TYPE_STRING, &itf, DBUS_TYPE_INVALID);
+ return reply;
+}
+
+static DRouteMethod test_methods_one[] = {
+ {impl_null, "null"},
+ {impl_getInt, "getInt"},
+ {impl_setInt, "setInt"},
+ {impl_getString, "getString"},
+ {impl_setString, "setString"},
+ {impl_getInterfaceOne, "getInterfaceOne"},
+ {NULL, NULL}
+};
+
+static DRouteMethod test_methods_two[] = {
+ {impl_null, "null"},
+ {impl_getInt, "getInt"},
+ {impl_setInt, "setInt"},
+ {impl_getString, "getString"},
+ {impl_setString, "setString"},
+ {impl_getInterfaceTwo, "getInterfaceTwo"},
+ {NULL, NULL}
+};
+
+static DRouteProperty test_properties[] = {
+ {NULL, NULL, NULL}
+};
+
+gboolean
+do_tests_func (gpointer data)
+{
+ DBusError error;
+ gchar *bus_name;
+
+ gchar *expected_string;
+ gchar *result_string;
+
+ dbus_error_init (&error);
+ bus_name = dbus_bus_get_unique_name (bus);
+
+ /* --------------------------------------------------------*/
+
+ dbind_method_call_reentrant (bus,
+ bus_name,
+ TEST_OBJECT_PATH,
+ TEST_INTERFACE_ONE,
+ "null",
+ NULL,
+ "");
+
+ /* --------------------------------------------------------*/
+
+ expected_string = TEST_INTERFACE_ONE;
+ result_string = NULL;
+ dbind_method_call_reentrant (bus,
+ bus_name,
+ TEST_OBJECT_PATH,
+ TEST_INTERFACE_ONE,
+ "getInterfaceOne",
+ NULL,
+ "=>s",
+ &result_string);
+ if (g_strcmp0(expected_string, result_string))
+ {
+ g_print ("Failed: reply to getInterfaceOne not as expected\n");
+ goto out;
+ }
+
+ /* --------------------------------------------------------*/
+
+out:
+ g_main_loop_quit (main_loop);
+ return FALSE;
+}
+
+
+int main (int argc, char **argv)
+{
+ DRouteContext *cnx;
+ DRoutePath *path;
+ AnObject *object;
+ DBusError error;
+
+ /* Setup some server object */
+
+ object = g_new0(AnObject, 1);
+ object->astring = g_strdup (STRING_ONE);
+ object->anint = INT_ONE;
+
+ dbus_error_init (&error);
+ main_loop = g_main_loop_new(NULL, FALSE);
+ bus = dbus_bus_get (DBUS_BUS_SESSION, &error);
+ dbus_connection_setup_with_g_main(bus, g_main_context_default());
+
+ cnx = droute_new (bus, TEST_INTROSPECTION_DIRECTORY);
+ path = droute_add_one (cnx, TEST_OBJECT_PATH, object);
+
+ droute_path_add_interface (path,
+ TEST_INTERFACE_ONE,
+ test_methods_one,
+ test_properties);
+
+ droute_path_add_interface (path,
+ TEST_INTERFACE_TWO,
+ test_methods_two,
+ test_properties);
+
+ g_idle_add (do_tests_func, NULL);
+ g_main_run(main_loop);
+ if (success)
+ return 0;
+ else
+ return 1;
+}
#define oom() g_error ("D-Bus out of memory, this message will fail anyway")
+#if defined DROUTE_DEBUG
+ #define _DROUTE_DEBUG(format, args...) g_print (format , ## args)
+#else
+ #define _DROUTE_DEBUG
+#endif
+
struct _DRouteContext
{
DBusConnection *bus;
{
DRoutePath *new_path;
- new_path = g_new0 (DRoutePath, 0);
+ new_path = g_new0 (DRoutePath, 1);
new_path->cnx = cnx;
new_path->chunks = g_string_chunk_new (CHUNKS_DEFAULT);
new_path->interfaces = g_ptr_array_new ();
void
droute_free (DRouteContext *cnx)
{
- g_pointer_array_foreach ((GFunc) path_free, cnx->registered_paths, NULL);
+ g_ptr_array_foreach (cnx->registered_paths, (GFunc) path_free, NULL);
g_free (cnx->introspect_dir);
g_free (cnx);
}
/*---------------------------------------------------------------------------*/
+DBusConnection *
+droute_get_bus (DRouteContext *cnx)
+{
+ return cnx->bus;
+}
+
+/*---------------------------------------------------------------------------*/
+
static DBusObjectPathVTable droute_vtable =
{
NULL,
{
gchar *itf;
- g_return_if_fail (name == NULL);
+ g_return_if_fail (name != NULL);
itf = g_string_chunk_insert (path->chunks, name);
g_ptr_array_add (path->interfaces, itf);
- for (; methods->name != NULL; methods++)
+ for (; methods != NULL && methods->name != NULL; methods++)
{
gchar *meth;
g_hash_table_insert (path->methods, str_pair_new (itf, meth), methods->func);
}
- for (; properties->name != NULL; properties++)
+ for (; properties != NULL && properties->name != NULL; properties++)
{
gchar *prop;
PropertyPair *pair;
void *datum = path_get_datum (path, pathstr);
dbus_error_init (&error);
-
if (!dbus_message_get_args
(message, &error, DBUS_TYPE_STRING, &iface, DBUS_TYPE_INVALID))
return dbus_message_new_error (message, DBUS_ERROR_FAILED, error.message);
g_hash_table_iter_init (&prop_iter, path->properties);
while (g_hash_table_iter_next (&prop_iter, (gpointer*)&key, (gpointer*)&value))
{
- if (!g_strcmp (key->one, iface))
+ if (!g_strcmp0 (key->one, iface))
{
if (!value->get)
continue;
DBusError error;
StrPair pair;
- PropertyPair *prop_funcs;
+ PropertyPair *prop_funcs = NULL;
+
+ dbus_error_init (&error);
if (!dbus_message_get_args (message,
&error,
DBUS_TYPE_STRING,
void *datum = path_get_datum (path, pathstr);
DBusMessageIter iter;
+ _DROUTE_DEBUG ("DRoute (handle prop Get): %s|%s on %s\n", pair.one, pair.two, pathstr);
+
reply = dbus_message_new_method_return (message);
dbus_message_iter_init_append (reply, &iter);
(prop_funcs->get) (&iter, datum);
void *datum = path_get_datum (path, pathstr);
DBusMessageIter iter;
+ _DROUTE_DEBUG ("DRoute (handle prop Get): %s|%s on %s\n", pair.one, pair.two, pathstr);
+
dbus_message_iter_init_append (message, &iter);
/* Skip the interface and property name */
dbus_message_iter_next(&iter);
dbus_message_iter_next(&iter);
- (prop_funcs->get) (&iter, datum);
+ (prop_funcs->set) (&iter, datum);
+
+ reply = dbus_message_new_method_return (message);
+ }
+ else
+ {
+ reply = dbus_message_new_error (message, DBUS_ERROR_FAILED, "Getter or setter unavailable");
}
+
return reply;
}
else
result = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ if (reply)
+ {
+ dbus_connection_send (bus, reply, NULL);
+ dbus_message_unref (reply);
+ }
+
return result;
}
const gchar *interface,
const gchar *directory)
{
- gchar *filename;
- gchar *contents;
- gsize len;
-
- GError *err = NULL;
-
- filename = g_build_filename (directory, interface, NULL);
-
- if (g_file_get_contents (filename, &contents, &len, &err))
- {
- g_string_append_len (str, contents, len);
- }
- else
- {
- g_warning ("AT-SPI: Cannot find introspection XML file %s - %s",
- filename, err->message);
- g_error_free (err);
- }
-
- g_string_append (str, "\n");
- g_free (filename);
- g_free (contents);
+ gchar *filename;
+ gchar *contents;
+ gsize len;
+
+ GError *err = NULL;
+
+ filename = g_build_filename (directory, interface, NULL);
+
+ if (g_file_get_contents (filename, &contents, &len, &err))
+ {
+ g_string_append_len (str, contents, len);
+ }
+ else
+ {
+ g_warning ("AT-SPI: Cannot find introspection XML file %s - %s",
+ filename, err->message);
+ g_error_free (err);
+ }
+
+ g_string_append (str, "\n");
+ g_free (filename);
+ g_free (contents);
}
static DBusHandlerResult
-handle_intropsection (DBusConnection *bus,
+handle_introspection (DBusConnection *bus,
DBusMessage *message,
DRoutePath *path,
const gchar *iface,
DBusMessage *reply;
- if (g_strcmp (member, "Introspect"))
+ _DROUTE_DEBUG ("DRoute (handle introspection): %s\n", pathstr);
+
+ if (g_strcmp0 (member, "Introspect"))
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
output = g_string_new(introspection_header);
pair.one = iface;
pair.two = member;
+ _DROUTE_DEBUG ("DRoute (handle other): %s|%s on %s\n", member, iface, pathstr);
+
func = (DRouteFunction) g_hash_table_lookup (path->methods, &pair);
if (func != NULL)
{
return handle_other (bus, message, path, iface, member, pathstr);
}
+/*---------------------------------------------------------------------------*/
+
+DBusMessage *
+droute_not_yet_handled_error (DBusMessage *message)
+{
+ DBusMessage *reply;
+ gchar *errmsg;
+
+ errmsg= g_strdup_printf (
+ "Method \"%s\" with signature \"%s\" on interface \"%s\" doesn't exist\n",
+ dbus_message_get_member (message),
+ dbus_message_get_signature (message),
+ dbus_message_get_interface (message));
+ reply = dbus_message_new_error (message,
+ DBUS_ERROR_UNKNOWN_METHOD,
+ errmsg);
+ g_free (errmsg);
+ return reply;
+}
+
/*END------------------------------------------------------------------------*/
#include <droute/droute-variant.h>
+
typedef DBusMessage *(*DRouteFunction) (DBusConnection *, DBusMessage *, void *);
typedef dbus_bool_t (*DRoutePropertyFunction) (DBusMessageIter *, void *);
const DRouteMethod *methods,
const DRouteProperty *properties);
+DBusMessage *
+droute_not_yet_handled_error (DBusMessage *message);
+
+DBusConnection *
+droute_get_bus (DRouteContext *cnx);
+
#endif /* _DROUTE_H */
--- /dev/null
+<interface name="test.interface.One">
+ <method name="null"/>
+ <method name="getInt">
+ <arg direction="out" type="o"/>
+ </method>
+ <method name="setInt">
+ <arg direction="in" type="o"/>
+ </method>
+ <method name="getString">
+ <arg direction="out" type="s"/>
+ </method>
+ <method name="setString">
+ <arg direction="in" type="s"/>
+ </method>
+</interface>
--- /dev/null
+<interface name="test.interface.Two">
+ <method name="null"/>
+ <method name="getInt">
+ <arg direction="out" type="o"/>
+ </method>
+ <method name="setInt">
+ <arg direction="in" type="o"/>
+ </method>
+ <method name="getString">
+ <arg direction="out" type="s"/>
+ </method>
+ <method name="setString">
+ <arg direction="in" type="s"/>
+ </method>
+</interface>
#along with this program; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-import interfaces
-from base import BaseProxy
+from interfaces import *
+from accessible import Accessible
from factory import accessible_factory
__all__ = [
#------------------------------------------------------------------------------
-class Action(BaseProxy):
+class Action(Accessible):
"""
An interface through which a user-actionable user interface component
can be manipulated. Components which react to mouse or keyboard
Causes the object to perform the specified action.
@return : a boolean indicating success or failure.
"""
- func = self.get_dbus_method("doAction")
+ func = self.get_dbus_method("doAction", dbus_interface=ATSPI_ACTION)
return func(index)
def getDescription(self, index):
@return : a string containing the description of the specified
action.
"""
- func = self.get_dbus_method("getDescription")
+ func = self.get_dbus_method("getDescription", dbus_interface=ATSPI_ACTION)
return func(index)
def getKeyBinding(self, index):
@return : a string containing the key binding for the specified
action, or an empty string ("") if none exists.
"""
- func = self.get_dbus_method("getKeyBinding")
+ func = self.get_dbus_method("getKeyBinding", dbus_interface=ATSPI_ACTION)
return func(index)
def getName(self, index):
the result of invoking the action.
@return : a string containing the name of the specified action.
"""
- func = self.get_dbus_method("getName")
+ func = self.get_dbus_method("getName", dbus_interface=ATSPI_ACTION)
return func(index)
def get_nActions(self):
nActions = property(fget=get_nActions, fset=set_nActions, doc=_nActionsDoc)
# Register the accessible class with the factory.
-accessible_factory.register_accessible_class(interfaces.ATSPI_ACTION, Action)
+accessible_factory.register_accessible_class(ATSPI_ACTION, Action)
#END----------------------------------------------------------------------------
#along with this program; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-import interfaces
-from base import BaseProxy
+from interfaces import *
from factory import accessible_factory
from accessible import Accessible
__all__ = [
- "Application",
- ]
+ "Application",
+ ]
#------------------------------------------------------------------------------
@return a string compliant with the POSIX standard for locale
description.
"""
- func = self.get_dbus_method("getLocale")
+ func = self.get_dbus_method("getLocale", dbus_interface=ATSPI_APPLICATION)
return func(*args, **kwargs)
def pause(self, *args, **kwargs):
loop.
@return : true if the request succeeded, false otherwise.
"""
- func = self.get_dbus_method("pause")
+ func = self.get_dbus_method("pause", dbus_interface=ATSPI_APPLICATION)
return func(*args, **kwargs)
def registerObjectEventListener(self, *args, **kwargs):
being requested. Register with this application toolkit for "Accessibility::Accessible"
event notifications.
"""
- func = self.get_dbus_method("registerObjectEventListener")
+ func = self.get_dbus_method("registerObjectEventListener", dbus_interface=ATSPI_APPLICATION)
return func(*args, **kwargs)
def registerToolkitEventListener(self, *args, **kwargs):
Register with this application's toolkit for "toolkit-specific"
event notifications.
"""
- func = self.get_dbus_method("registerToolkitEventListener")
+ func = self.get_dbus_method("registerToolkitEventListener", dbus_interface=ATSPI_APPLICATION)
return func(*args, **kwargs)
def resume(self, *args, **kwargs):
Request that the application resume sending events.
@return : True if the request succeeded, False otherwise.
"""
- func = self.get_dbus_method("resume")
+ func = self.get_dbus_method("resume", dbus_interface=ATSPI_APPLICATION)
return func(*args, **kwargs)
def get_id(self):
version = property(fget=get_version, fset=set_version, doc=_versionDoc)
# Register the accessible class with the factory.
-accessible_factory.register_accessible_class(interfaces.ATSPI_APPLICATION, Application)
+accessible_factory.register_accessible_class(ATSPI_APPLICATION, Application)
#END----------------------------------------------------------------------------
#along with this program; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-import interfaces
-from base import BaseProxy, Enum
+from interfaces import *
+from base import Enum
+from accessible import Accessible
from factory import accessible_factory
__all__ = [
#------------------------------------------------------------------------------
-class Collection(BaseProxy):
+class Collection(Accessible):
def createMatchRule(self, *args, **kwargs):
- func = self.get_dbus_method("createMatchRule")
+ func = self.get_dbus_method("createMatchRule", dbus_interface=ATSPI_COLLECTION)
return func(*args, **kwargs)
def freeMatchRule(self, *args, **kwargs):
- func = self.get_dbus_method("freeMatchRule")
+ func = self.get_dbus_method("freeMatchRule", dbus_interface=ATSPI_COLLECTION)
return func(*args, **kwargs)
def getActiveDescendant(self, *args, **kwargs):
- func = self.get_dbus_method("getActiveDescendant")
+ func = self.get_dbus_method("getActiveDescendant", dbus_interface=ATSPI_COLLECTION)
return func(*args, **kwargs)
def getMatches(self, *args, **kwargs):
- func = self.get_dbus_method("getMatches")
+ func = self.get_dbus_method("getMatches", dbus_interface=ATSPI_COLLECTION)
return func(*args, **kwargs)
def getMatchesFrom(self, *args, **kwargs):
- func = self.get_dbus_method("getMatchesFrom")
+ func = self.get_dbus_method("getMatchesFrom", dbus_interface=ATSPI_COLLECTION)
return func(*args, **kwargs)
def getMatchesTo(self, *args, **kwargs):
- func = self.get_dbus_method("getMatchesTo")
+ func = self.get_dbus_method("getMatchesTo", dbus_interface=ATSPI_COLLECTION)
return func(*args, **kwargs)
def isAncestorOf(self, *args, **kwargs):
- func = self.get_dbus_method("isAncestorOf")
+ func = self.get_dbus_method("isAncestorOf", dbus_interface=ATSPI_COLLECTION)
return func(*args, **kwargs)
class MatchType(Enum):
TREE_RESTRICT_SIBLING = TreeTraversalType(1)
# Register the accessible class with the factory.
-accessible_factory.register_accessible_class(interfaces.ATSPI_COLLECTION, Collection)
+accessible_factory.register_accessible_class(ATSPI_COLLECTION, Collection)
#END----------------------------------------------------------------------------
#along with this program; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-import interfaces
-from base import BaseProxy, Enum
+from interfaces import *
+from base import Enum
from factory import accessible_factory
-from accessible import BoundingBox
+from accessible import BoundingBox, Accessible
from dbus.types import Int16
#------------------------------------------------------------------------------
-class Component(BaseProxy):
+class Component(Accessible):
"""
The Component interface is implemented by objects which occupy
on-screen space, e.g. objects which have onscreen visual representations.
@return True if the specified point lies within the Component's
bounding box, False otherwise.
"""
- func = self.get_dbus_method("contains")
+ func = self.get_dbus_method("contains", dbus_interface=ATSPI_COMPONENT)
return func(*args, **kwargs)
def deregisterFocusHandler(self, *args, **kwargs):
Request that an EventListener registered via registerFocusHandler
no longer be notified when this object receives keyboard focus.
"""
- func = self.get_dbus_method("deregisterFocusHandler")
+ func = self.get_dbus_method("deregisterFocusHandler", dbus_interface=ATSPI_COMPONENT)
return func(*args, **kwargs)
def getAccessibleAtPoint(self, *args, **kwargs):
specified point.
"""
#TODO this needs a real implementation
- func = self.get_dbus_method("getAccessibleAtPoint")
+ func = self.get_dbus_method("getAccessibleAtPoint", dbus_interface=ATSPI_COMPONENT)
return func(*args, **kwargs)
def getAlpha(self, *args, **kwargs):
alpha value of 0.0 indicates that the object is fully transparent.
Negative alpha values have no defined meaning at this time.
"""
- func = self.get_dbus_method("getAlpha")
+ func = self.get_dbus_method("getAlpha", dbus_interface=ATSPI_COMPONENT)
return func(*args, **kwargs)
def getExtents(self, coord_type):
@return a BoundingBox which entirely contains the object's onscreen
visual representation.
"""
- func = self.get_dbus_method("getExtents")
+ func = self.get_dbus_method("getExtents", dbus_interface=ATSPI_COMPONENT)
extents = func(Int16(coord_type))
return BoundingBox(*extents)
"""
@return the ComponentLayer in which this object resides.
"""
- func = self.get_dbus_method("getLayer")
+ func = self.get_dbus_method("getLayer", dbus_interface=ATSPI_COMPONENT)
return ComponentLayer(func(*args, **kwargs))
def getMDIZOrder(self):
@return an integer indicating the object's place in the stacking
order.
"""
- func = self.get_dbus_method("getMDIZOrder")
+ func = self.get_dbus_method("getMDIZOrder", dbus_interface=ATSPI_COMPONENT)
return func()
def getPosition(self, coord_type):
an out parameter which will be back-filled with the returned
y coordinate.
"""
- func = self.get_dbus_method("getPosition")
+ func = self.get_dbus_method("getPosition", dbus_interface=ATSPI_COMPONENT)
return func(Int16(coord_type))
def getSize(self, *args, **kwargs):
@param : height
the object's vertical extents in the specified coordinate system.
"""
- func = self.get_dbus_method("getSize")
+ func = self.get_dbus_method("getSize", dbus_interface=ATSPI_COMPONENT)
return func(*args, **kwargs)
def grabFocus(self, *args, **kwargs):
@return True if keyboard focus was successfully transferred to
the Component.
"""
- func = self.get_dbus_method("grabFocus")
+ func = self.get_dbus_method("grabFocus", dbus_interface=ATSPI_COMPONENT)
return func(*args, **kwargs)
def registerFocusHandler(self, *args, **kwargs):
Register an EventListener for notification when this object receives
keyboard focus.
"""
- func = self.get_dbus_method("registerFocusHandler")
+ func = self.get_dbus_method("registerFocusHandler", dbus_interface=ATSPI_COMPONENT)
return func(*args, **kwargs)
# Register the accessible class with the factory.
-accessible_factory.register_accessible_class(interfaces.ATSPI_COMPONENT, Component)
+accessible_factory.register_accessible_class(ATSPI_COMPONENT, Component)
#END----------------------------------------------------------------------------
#along with this program; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-import interfaces
+from interfaces import *
from base import BaseProxyMeta
from accessible import BoundingBox
from state import StateSet
@property
def interfaces(self):
- return [interfaces.ATSPI_ACCESSIBLE, interfaces.ATSPI_COMPONENT]
+ return [ATSPI_ACCESSIBLE, ATSPI_COMPONENT]
def queryInterface(self, interface):
"""
or raises a NotImplemented error if the given interface
is not supported.
"""
- if interface == interfaces.ATSPI_ACCESSIBLE:
+ if interface == ATSPI_ACCESSIBLE:
return self
- elif interface == interfaces.ATSPI_COMPONENT:
+ elif interface == ATSPI_COMPONENT:
return DesktopComponent()
else:
raise NotImplementedError(
#along with this program; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-import interfaces
-from base import BaseProxy
+from interfaces import *
+from accessible import Accessible
from factory import accessible_factory
__all__ = [
#------------------------------------------------------------------------------
-class Document(BaseProxy):
+class Document(Accessible):
"""
Primarily a 'tagging' interface which indicates the start of
document content in the Accessibility hierarchy. Accessible objects
attribute, or an empty string if the attribute is unspecified
for the object.
"""
- func = self.get_dbus_method("getAttributeValue")
+ func = self.get_dbus_method("getAttributeValue", dbus_interface=ATSPI_DOCUMENT)
return func(*args, **kwargs)
def getAttributes(self, *args, **kwargs):
@return an AttributeSet containing the attributes of the document,
as name-value pairs.
"""
- func = self.get_dbus_method("getAttributes")
+ func = self.get_dbus_method("getAttributes", dbus_interface=ATSPI_DOCUMENT)
return func(*args, **kwargs)
def getLocale(self, *args, **kwargs):
@return a string compliant with the POSIX standard for locale
description.
"""
- func = self.get_dbus_method("getLocale")
+ func = self.get_dbus_method("getLocale", dbus_interface=ATSPI_DOCUMENT)
return func(*args, **kwargs)
# Register the accessible class with the factory.
-accessible_factory.register_accessible_class(interfaces.ATSPI_DOCUMENT, Document)
+accessible_factory.register_accessible_class(ATSPI_DOCUMENT, Document)
#END----------------------------------------------------------------------------
#along with this program; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-import interfaces
-from base import BaseProxy
+from interfaces import *
from factory import accessible_factory
from text import *
the offset of the first character past the end of the range of
text being copied.
"""
- func = self.get_dbus_method("copyText")
+ func = self.get_dbus_method("copyText", dbus_interface=ATSPI_EDITABLE_TEXT)
return func(*args, **kwargs)
def cutText(self, *args, **kwargs):
text being cut.
@return True if the text was successfully cut, False otherwise.
"""
- func = self.get_dbus_method("cutText")
+ func = self.get_dbus_method("cutText", dbus_interface=ATSPI_EDITABLE_TEXT)
return func(*args, **kwargs)
def deleteText(self, *args, **kwargs):
text being deleted.
@return True if the text was successfully deleted, False otherwise.
"""
- func = self.get_dbus_method("deleteText")
+ func = self.get_dbus_method("deleteText", dbus_interface=ATSPI_EDITABLE_TEXT)
return func(*args, **kwargs)
def insertText(self, *args, **kwargs):
@return True if the text content was successfully inserted, False
otherwise.
"""
- func = self.get_dbus_method("insertText")
+ func = self.get_dbus_method("insertText", dbus_interface=ATSPI_EDITABLE_TEXT)
return func(*args, **kwargs)
def pasteText(self, *args, **kwargs):
@return True if the text was successfully pasted into the Text
object, False otherwise.
"""
- func = self.get_dbus_method("pasteText")
+ func = self.get_dbus_method("pasteText", dbus_interface=ATSPI_EDITABLE_TEXT)
return func(*args, **kwargs)
def setAttributes(self, *args, **kwargs):
@return True if the text attributes were successfully modified,
False otherwise.
"""
- func = self.get_dbus_method("setAttributes")
+ func = self.get_dbus_method("setAttributes", dbus_interface=ATSPI_EDITABLE_TEXT)
return func(*args, **kwargs)
def setTextContents(self, *args, **kwargs):
@return True if the text content was successfully changed, False
otherwise.
"""
- func = self.get_dbus_method("setTextContents")
+ func = self.get_dbus_method("setTextContents", dbus_interface=ATSPI_EDITABLE_TEXT)
return func(*args, **kwargs)
# Register the accessible class with the factory.
-accessible_factory.register_accessible_class(interfaces.ATSPI_EDITABLE_TEXT, EditableText)
+accessible_factory.register_accessible_class(ATSPI_EDITABLE_TEXT, EditableText)
#END----------------------------------------------------------------------------
#along with this program; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-import interfaces
-from base import BaseProxy
+from interfaces import *
+from accessible import Accessible
from factory import accessible_factory
__all__ = [
#------------------------------------------------------------------------------
-class Hyperlink(BaseProxy):
+class Hyperlink(Accessible):
"""
Instances of Hyperlink are returned by Hypertext objects, and
are the means by which end users and clients interact with linked,
ith anchor, or through which the content associated with the
ith anchor can be accessed.
"""
- func = self.get_dbus_method("getObject")
+ func = self.get_dbus_method("getObject", dbus_interface=ATSPI_HYPERLINK)
return func(*args, **kwargs)
def getURI(self, *args, **kwargs):
@return a string corresponding to the URI of the Hyperlink's
'ith' anchor, if one exists, or a NIL string otherwise.
"""
- func = self.get_dbus_method("getURI")
+ func = self.get_dbus_method("getURI", dbus_interface=ATSPI_HYPERLINK)
return func(*args, **kwargs)
def isValid(self, *args, **kwargs):
the hyperlink's URI is invalid, or a connection to the resource
can not be established.
"""
- func = self.get_dbus_method("isValid")
+ func = self.get_dbus_method("isValid", dbus_interface=ATSPI_HYPERLINK)
return func(*args, **kwargs)
def get_endIndex(self):
startIndex = property(fget=get_startIndex, fset=set_startIndex, doc=_startIndexDoc)
# Register the accessible class with the factory.
-accessible_factory.register_accessible_class(interfaces.ATSPI_HYPERLINK, Hyperlink)
+accessible_factory.register_accessible_class(ATSPI_HYPERLINK, Hyperlink)
#END----------------------------------------------------------------------------
#along with this program; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-import interfaces
-from base import BaseProxy
+from interfaces import *
+from accessible import Accessible
from factory import accessible_factory
__all__ = [
#------------------------------------------------------------------------------
-class Hypertext(BaseProxy):
+class Hypertext(Accessible):
"""
An interface used for objects which implement linking between
multiple resource or content locations, or multiple 'markers'
an integer from 0 to getNLinks() - 1.
@return the Hyperlink in this Hypertext object.
"""
- func = self.get_dbus_method("getLink")
+ func = self.get_dbus_method("getLink", dbus_interface=ATSPI_HYPERTEXT)
return func(*args, **kwargs)
def getLinkIndex(self, *args, **kwargs):
offset characterIndex, or -1 if no Hyperlink is associated with
that character offset.
"""
- func = self.get_dbus_method("getLinkIndex")
+ func = self.get_dbus_method("getLinkIndex", dbus_interface=ATSPI_HYPERTEXT)
return func(*args, **kwargs)
def getNLinks(self, *args, **kwargs):
@return the number of Hyperlinks associated with this Hypertext
object, as a long integer.
"""
- func = self.get_dbus_method("getNLinks")
+ func = self.get_dbus_method("getNLinks", dbus_interface=ATSPI_HYPERTEXT)
return func(*args, **kwargs)
# Register the accessible class with the factory.
-accessible_factory.register_accessible_class(interfaces.ATSPI_HYPERTEXT, Hypertext)
+accessible_factory.register_accessible_class(ATSPI_HYPERTEXT, Hypertext)
#END----------------------------------------------------------------------------
#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
import dbus
-import interfaces
-from base import BaseProxy
+from interfaces import *
+from accessible import Accessible
from factory import accessible_factory
from accessible import BoundingBox
#------------------------------------------------------------------------------
-class Image(BaseProxy):
+class Image(Accessible):
"""
An interface implemented by objects which render image data or
pictorial information to the screen. When onscreen components
to the containing window.
@return a BoundingBox enclosing the image's onscreen representation.
"""
- func = self.get_dbus_method("getImageExtents")
+ func = self.get_dbus_method("getImageExtents", dbus_interface=ATSPI_IMAGE)
return BoundingBox(*func(dbus.Int16(coordType)))
def getImagePosition(self, *args, **kwargs):
to the screen; if 1, they are returned relative to the containing
window.
"""
- func = self.get_dbus_method("getImagePosition")
+ func = self.get_dbus_method("getImagePosition", dbus_interface=ATSPI_IMAGE)
return func(*args, **kwargs)
def getImageSize(self, *args, **kwargs):
Back-filled with the y extents of the onscreen image (i.e. the
image height in pixels)
"""
- func = self.get_dbus_method("getImageSize")
+ func = self.get_dbus_method("getImageSize", dbus_interface=ATSPI_IMAGE)
return func(*args, **kwargs)
def get_imageDescription(self):
imageLocale = property(fget=get_imageLocale, fset=set_imageLocale, doc=_imageLocaleDoc)
# Register the accessible class with the factory.
-accessible_factory.register_accessible_class(interfaces.ATSPI_IMAGE, Image)
+accessible_factory.register_accessible_class(ATSPI_IMAGE, Image)
#END----------------------------------------------------------------------------
#along with this program; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-import interfaces
-from base import BaseProxy, Enum
+from interfaces import *
+from base import Enum
+from accessible import Accessible
from factory import accessible_factory
__all__ = [
#------------------------------------------------------------------------------
-class LoginHelper(BaseProxy):
+class LoginHelper(Accessible):
"""
An interface for use by assistive technologies by which they
can access system information and services on a 'need to know'
device I/O required in order to facilitate end-user access to
the system.
"""
- func = self.get_dbus_method("getDeviceReqs")
+ func = self.get_dbus_method("getDeviceReqs", dbus_interface=ATSPI_LOGIN_HELPER)
return func(*args, **kwargs)
def getRaiseWindows(self, *args, **kwargs):
order for the LoginHelper to facilitate end-user access to the
system.
"""
- func = self.get_dbus_method("getRaiseWindows")
+ func = self.get_dbus_method("getRaiseWindows", dbus_interface=ATSPI_LOGIN_HELPER)
return func(*args, **kwargs)
def setSafe(self, *args, **kwargs):
when in "safe" mode.
@return : whether the LoginHelper is now "safe" or not.
"""
- func = self.get_dbus_method("setSafe")
+ func = self.get_dbus_method("setSafe", dbus_interface=ATSPI_LOGIN_HELPER)
return func(*args, **kwargs)
class DeviceReq(Enum):
winID = property(fget=_get_winID, fset=_set_winID)
# Register the accessible class with the factory.
-accessible_factory.register_accessible_class(interfaces.ATSPI_LOGIN_HELPER, LoginHelper)
+accessible_factory.register_accessible_class(ATSPI_LOGIN_HELPER, LoginHelper)
#END----------------------------------------------------------------------------
#along with this program; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-import interfaces
-from base import BaseProxy
+from interfaces import *
+from accessible import Accessible
from factory import accessible_factory
__all__ = [
#------------------------------------------------------------------------------
-class Selection(BaseProxy):
+class Selection(Accessible):
"""
An interface which indicates that an object exposes a 'selection'
model, allowing the selection of one or more of its children.
@return True if the selections were successfully cleared, False
otherwise.
"""
- func = self.get_dbus_method("clearSelection")
+ func = self.get_dbus_method("clearSelection", dbus_interface=ATSPI_SELECTION)
return func(*args, **kwargs)
def deselectChild(self, *args, **kwargs):
to be selected.
@return True if the child was successfully selected, False otherwise.
"""
- func = self.get_dbus_method("deselectChild")
+ func = self.get_dbus_method("deselectChild", dbus_interface=ATSPI_SELECTION)
return func(*args, **kwargs)
def deselectSelectedChild(self, *args, **kwargs):
@return True if the child was successfully deselected, False
otherwise.
"""
- func = self.get_dbus_method("deselectSelectedChild")
+ func = self.get_dbus_method("deselectSelectedChild", dbus_interface=ATSPI_SELECTION)
return func(*args, **kwargs)
def getSelectedChild(self, *args, **kwargs):
@return a pointer to a selected Accessible child object, specified
by selectedChildIndex.
"""
- func = self.get_dbus_method("getSelectedChild")
+ func = self.get_dbus_method("getSelectedChild", dbus_interface=ATSPI_SELECTION)
return func(*args, **kwargs)
def isChildSelected(self, *args, **kwargs):
@return True if the specified child is currently selected, False
otherwise.
"""
- func = self.get_dbus_method("isChildSelected")
+ func = self.get_dbus_method("isChildSelected", dbus_interface=ATSPI_SELECTION)
return func(*args, **kwargs)
def selectAll(self, *args, **kwargs):
support this operation).
@return True if successful, False otherwise.
"""
- func = self.get_dbus_method("selectAll")
+ func = self.get_dbus_method("selectAll", dbus_interface=ATSPI_SELECTION)
return func(*args, **kwargs)
def selectChild(self, *args, **kwargs):
be selected.
@return True if the child was successfully selected, False otherwise.
"""
- func = self.get_dbus_method("selectChild")
+ func = self.get_dbus_method("selectChild", dbus_interface=ATSPI_SELECTION)
return func(*args, **kwargs)
def get_nSelectedChildren(self):
nSelectedChildren = property(fget=get_nSelectedChildren, fset=set_nSelectedChildren, doc=_nSelectedChildrenDoc)
# Register the accessible class with the factory.
-accessible_factory.register_accessible_class(interfaces.ATSPI_SELECTION, Selection)
+accessible_factory.register_accessible_class(ATSPI_SELECTION, Selection)
#END----------------------------------------------------------------------------
#along with this program; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-import interfaces
+from interfaces import *
from base import BaseProxy, Enum
+from accessible import Accessible
from factory import accessible_factory
__all__ = [
The newly-available list of Command objects which may be invoked
by the listener.
"""
- func = self.get_dbus_method("notifyCommands")
+ func = self.get_dbus_method("notifyCommands", dbus_interface=ATSPI_COMMAND_LISTENER)
return func(*args, **kwargs)
#------------------------------------------------------------------------------
-class Selector(BaseProxy):
+class Selector(Accessible):
"""
This interface is intended for use by assistive technologies
and related user-agents. Via this interface, an assistive technology
and the reason for failure if the Command could not be activated
or invoked.
"""
- func = self.get_dbus_method("activateCommand")
+ func = self.get_dbus_method("activateCommand", dbus_interface=ATSPI_SELECTOR)
return func(*args, **kwargs)
def deregisterChangeListener(self, *args, **kwargs):
@param : listener
the CommandListener to remove from the notification list.
"""
- func = self.get_dbus_method("deregisterChangeListener")
+ func = self.get_dbus_method("deregisterChangeListener", dbus_interface=ATSPI_SELECTOR)
return func(*args, **kwargs)
def getCommands(self, *args, **kwargs):
Query the Selector for the current CommandList.
@return the currently available CommandList
"""
- func = self.get_dbus_method("getCommands")
+ func = self.get_dbus_method("getCommands", dbus_interface=ATSPI_SELECTOR)
return func(*args, **kwargs)
def refreshCommands(self, *args, **kwargs):
Ask the Selector to re-calculate its CommandList.
@return TRUE if the CommandList changed.
"""
- func = self.get_dbus_method("refreshCommands")
+ func = self.get_dbus_method("refreshCommands", dbus_interface=ATSPI_SELECTOR)
return func(*args, **kwargs)
def registerChangeListener(self, *args, **kwargs):
@param : listener
the CommandListener to be notified of changes.
"""
- func = self.get_dbus_method("registerChangeListener")
+ func = self.get_dbus_method("registerChangeListener", dbus_interface=ATSPI_SELECTOR)
return func(*args, **kwargs)
def replaceCommands(self, *args, **kwargs):
@return TRUE if the replacement request was successful, FALSE
if the request could not be honored.
"""
- func = self.get_dbus_method("replaceCommands")
+ func = self.get_dbus_method("replaceCommands", dbus_interface=ATSPI_SELECTOR)
return func(*args, **kwargs)
def get_supportsReplace(self):
COMMAND_RESULT_SUCCESS = CommandResult(1)
# Register the accessible class with the factory.
-accessible_factory.register_accessible_class(interfaces.ATSPI_SELECTOR, Selector)
+accessible_factory.register_accessible_class(ATSPI_SELECTOR, Selector)
#END----------------------------------------------------------------------------
#along with this program; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-import interfaces
+from interfaces import *
from base import BaseProxy, Enum
+from accessible import Accessible
from factory import accessible_factory
__all__ = [
not perform further operations on a StreamableContent::Stream
object after closing it.
"""
- func = self.get_dbus_method("close")
+ func = self.get_dbus_method("close", dbus_interface=ATSPI_STREAMABLE_CONTENT)
return func(*args, **kwargs)
def read(self, *args, **kwargs):
Request/read a specified amount of data from a Stream.
@return the number of bytes actually read into the client buffer.
"""
- func = self.get_dbus_method("read")
+ func = self.get_dbus_method("read", dbus_interface=ATSPI_STREAMABLE_CONTENT)
return func(*args, **kwargs)
def seek(self, *args, **kwargs):
exception will be raised.
@return the actual resulting offset, if no exception was raised.
"""
- func = self.get_dbus_method("seek")
+ func = self.get_dbus_method("seek", dbus_interface=ATSPI_STREAMABLE_CONTENT)
return func(*args, **kwargs)
class IOError(Exception):
#------------------------------------------------------------------------------
-class StreamableContent(BaseProxy):
+class StreamableContent(Accessible):
"""
An interface whereby an object allows its backing content to
be streamed to clients. Negotiation of content type is allowed.
"""
DEPRECATED, use getStream instead.
"""
- func = self.get_dbus_method("getContent")
+ func = self.get_dbus_method("getContent", dbus_interface=ATSPI_STREAMABLE_CONTENT)
return func(*args, **kwargs)
def getContentTypes(self, *args, **kwargs):
getContentTypes:
@return the list of available mimetypes for this object's content.
"""
- func = self.get_dbus_method("getContentTypes")
+ func = self.get_dbus_method("getContentTypes", dbus_interface=ATSPI_STREAMABLE_CONTENT)
return func(*args, **kwargs)
def getStream(self, *args, **kwargs):
@return a Stream whose mimetype matches contentType, if available,
or NIL.
"""
- func = self.get_dbus_method("getStream")
+ func = self.get_dbus_method("getStream", dbus_interface=ATSPI_STREAMABLE_CONTENT)
return func(*args, **kwargs)
def getURI(self, *args, **kwargs):
@return a string which constitutes a URI for a stream of the
specified content type, or NULL if no such URI can be obtained.
"""
- func = self.get_dbus_method("getURI")
+ func = self.get_dbus_method("getURI", dbus_interface=ATSPI_STREAMABLE_CONTENT)
return func(*args, **kwargs)
# Register the accessible class with the factory.
-accessible_factory.register_accessible_class(interfaces.ATSPI_STREAMABLE_CONTENT, StreamableContent)
+accessible_factory.register_accessible_class(ATSPI_STREAMABLE_CONTENT, StreamableContent)
#END----------------------------------------------------------------------------
#along with this program; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-import interfaces
-from base import BaseProxy
+from interfaces import *
+from accessible import Accessible
from factory import accessible_factory
__all__ = [
#------------------------------------------------------------------------------
-class Table(BaseProxy):
+class Table(Accessible):
"""
An interface used by containers whose contained data is arranged
in a "tabular" (i.e. row-column) fashion. Tables may resemble
@return True if the specified column was successfully selected,
False if not.
"""
- func = self.get_dbus_method("addColumnSelection")
+ func = self.get_dbus_method("addColumnSelection", dbus_interface=ATSPI_TABLE)
return func(*args, **kwargs)
def addRowSelection(self, *args, **kwargs):
@return True if the specified row was successfully selected,
False if not.
"""
- func = self.get_dbus_method("addRowSelection")
+ func = self.get_dbus_method("addRowSelection", dbus_interface=ATSPI_TABLE)
return func(*args, **kwargs)
def getAccessibleAt(self, *args, **kwargs):
@return an Accessible object representing the specified table
cell.
"""
- func = self.get_dbus_method("getAccessibleAt")
+ func = self.get_dbus_method("getAccessibleAt", dbus_interface=ATSPI_TABLE)
return func(*args, **kwargs)
def getColumnAtIndex(self, *args, **kwargs):
@return a long integer indicating the first column spanned by
the child of a table, at the specified 1-D (zero-offset) index.
"""
- func = self.get_dbus_method("getColumnAtIndex")
+ func = self.get_dbus_method("getColumnAtIndex", dbus_interface=ATSPI_TABLE)
return func(*args, **kwargs)
def getColumnDescription(self, *args, **kwargs):
@return a UTF-8 string describing the specified table column,
if available.
"""
- func = self.get_dbus_method("getColumnDescription")
+ func = self.get_dbus_method("getColumnDescription", dbus_interface=ATSPI_TABLE)
return func(*args, **kwargs)
def getColumnExtentAt(self, *args, **kwargs):
@return a long integer indicating the number of columns spanned
by the specified cell.
"""
- func = self.get_dbus_method("getColumnExtentAt")
+ func = self.get_dbus_method("getColumnExtentAt", dbus_interface=ATSPI_TABLE)
return func(*args, **kwargs)
def getColumnHeader(self, *args, **kwargs):
@return an Accessible representatin of the specified table column,
if available.
"""
- func = self.get_dbus_method("getColumnHeader")
+ func = self.get_dbus_method("getColumnHeader", dbus_interface=ATSPI_TABLE)
return func(*args, **kwargs)
def getIndexAt(self, *args, **kwargs):
@return a long integer which serves as the index of a specified
cell in the table, in a form usable by Accessible::getChildAtIndex.
"""
- func = self.get_dbus_method("getIndexAt")
+ func = self.get_dbus_method("getIndexAt", dbus_interface=ATSPI_TABLE)
return func(*args, **kwargs)
def getRowAtIndex(self, *args, **kwargs):
@return a long integer indicating the first row spanned by the
child of a table, at the specified 1-D (zero-offset) index.
"""
- func = self.get_dbus_method("getRowAtIndex")
+ func = self.get_dbus_method("getRowAtIndex", dbus_interface=ATSPI_TABLE)
return func(*args, **kwargs)
def getRowColumnExtentsAtIndex(self, *args, **kwargs):
False if the index does not correspond to a cell. If False is
returned, the values of the out parameters are undefined.
"""
- func = self.get_dbus_method("getRowColumnExtentsAtIndex")
+ func = self.get_dbus_method("getRowColumnExtentsAtIndex", dbus_interface=ATSPI_TABLE)
return func(*args, **kwargs)
def getRowDescription(self, *args, **kwargs):
@return a UTF-8 string describing the specified table row, if
available.
"""
- func = self.get_dbus_method("getRowDescription")
+ func = self.get_dbus_method("getRowDescription", dbus_interface=ATSPI_TABLE)
return func(*args, **kwargs)
def getRowExtentAt(self, *args, **kwargs):
@return a long integer indicating the number of rows spanned
by the specified cell.
"""
- func = self.get_dbus_method("getRowExtentAt")
+ func = self.get_dbus_method("getRowExtentAt", dbus_interface=ATSPI_TABLE)
return func(*args, **kwargs)
def getRowHeader(self, *args, **kwargs):
@return an Accessible representatin of the specified table row,
if available.
"""
- func = self.get_dbus_method("getRowHeader")
+ func = self.get_dbus_method("getRowHeader", dbus_interface=ATSPI_TABLE)
return func(*args, **kwargs)
def getSelectedColumns(self, *args, **kwargs):
@return a sequence of integers comprising the indices of columns
currently selected.
"""
- func = self.get_dbus_method("getSelectedColumns")
+ func = self.get_dbus_method("getSelectedColumns", dbus_interface=ATSPI_TABLE)
return func(*args, **kwargs)
def getSelectedRows(self, *args, **kwargs):
@return a sequence of integers comprising the indices of rows
currently selected.
"""
- func = self.get_dbus_method("getSelectedRows")
+ func = self.get_dbus_method("getSelectedRows", dbus_interface=ATSPI_TABLE)
return func(*args, **kwargs)
def isColumnSelected(self, *args, **kwargs):
@return True if the specified column is currently selected, False
if not.
"""
- func = self.get_dbus_method("isColumnSelected")
+ func = self.get_dbus_method("isColumnSelected", dbus_interface=ATSPI_TABLE)
return func(*args, **kwargs)
def isRowSelected(self, *args, **kwargs):
@return True if the specified row is currently selected, False
if not.
"""
- func = self.get_dbus_method("isRowSelected")
+ func = self.get_dbus_method("isRowSelected", dbus_interface=ATSPI_TABLE)
return func(*args, **kwargs)
def isSelected(self, *args, **kwargs):
@return True if the specified cell is currently selected, False
if not.
"""
- func = self.get_dbus_method("isSelected")
+ func = self.get_dbus_method("isSelected", dbus_interface=ATSPI_TABLE)
return func(*args, **kwargs)
def removeColumnSelection(self, *args, **kwargs):
@return True if the specified column was successfully de-selected,
False if not.
"""
- func = self.get_dbus_method("removeColumnSelection")
+ func = self.get_dbus_method("removeColumnSelection", dbus_interface=ATSPI_TABLE)
return func(*args, **kwargs)
def removeRowSelection(self, *args, **kwargs):
@return True if the specified row was successfully de-selected,
False if not.
"""
- func = self.get_dbus_method("removeRowSelection")
+ func = self.get_dbus_method("removeRowSelection", dbus_interface=ATSPI_TABLE)
return func(*args, **kwargs)
def get_caption(self):
summary = property(fget=get_summary, fset=set_summary, doc=_summaryDoc)
# Register the accessible class with the factory.
-accessible_factory.register_accessible_class(interfaces.ATSPI_TABLE, Table)
+accessible_factory.register_accessible_class(ATSPI_TABLE, Table)
#END----------------------------------------------------------------------------
import dbus
-import interfaces
-from base import BaseProxy, Enum
+from interfaces import *
+from accessible import Accessible
+from base import Enum
from factory import accessible_factory
__all__ = [
#------------------------------------------------------------------------------
-class Text(BaseProxy):
+class Text(Accessible):
"""
The text interface should be implemented by objects which place
textual information onscreen as character strings or glyphs.
other reasons (for instance if the user does not have permission
to copy the text into the relevant selection buffer).
"""
- func = self.get_dbus_method("addSelection")
+ func = self.get_dbus_method("addSelection", dbus_interface=ATSPI_TEXT)
return func(*args, **kwargs)
def getAttributeRun(self, *args, **kwargs):
@return the AttributeSet defined at offset, optionally including
the 'default' attributes.
"""
- func = self.get_dbus_method("getAttributeRun")
+ func = self.get_dbus_method("getAttributeRun", dbus_interface=ATSPI_TEXT)
return func(*args, **kwargs)
def getAttributeValue(self, *args, **kwargs):
@return the value of attribute (name-value pair) corresponding
to "name", if defined.
"""
- func = self.get_dbus_method("getAttributeValue")
+ func = self.get_dbus_method("getAttributeValue", dbus_interface=ATSPI_TEXT)
return func(*args, **kwargs)
def getAttributes(self, offset):
@return the attributes at offset, as a semicolon-delimited set
of colon-delimited name-value pairs.
"""
- func = self.get_dbus_method("getAttributes")
+ func = self.get_dbus_method("getAttributes", dbus_interface=ATSPI_TEXT)
return func(dbus.Int32(offset))
def getBoundedRanges(self, *args, **kwargs):
determines whether text which intersects the bounding box in
the y direction is included.
"""
- func = self.get_dbus_method("getBoundedRanges")
+ func = self.get_dbus_method("getBoundedRanges", dbus_interface=ATSPI_TEXT)
return func(*args, **kwargs)
def getCharacterAtOffset(self, *args, **kwargs):
UCS-4 representation of the character at the specified text offset,
or 0 if offset is out of range.
"""
- func = self.get_dbus_method("getCharacterAtOffset")
+ func = self.get_dbus_method("getCharacterAtOffset", dbus_interface=ATSPI_TEXT)
return func(*args, **kwargs)
def getCharacterExtents(self, *args, **kwargs):
window, with the x axis pointing right and the y axis pointing
down.
"""
- func = self.get_dbus_method("getCharacterExtents")
+ func = self.get_dbus_method("getCharacterExtents", dbus_interface=ATSPI_TEXT)
return func(*args, **kwargs)
def getDefaultAttributeSet(self, *args, **kwargs):
whereas an object whose text weight is inspecified may report
the default or implied text weight in the default AttributeSet.
"""
- func = self.get_dbus_method("getDefaultAttributeSet")
+ func = self.get_dbus_method("getDefaultAttributeSet", dbus_interface=ATSPI_TEXT)
return func(*args, **kwargs)
def getDefaultAttributes(self, *args, **kwargs):
@return the attributes which apply to the entire text content,
but which were not explicitly specified by the content creator.
"""
- func = self.get_dbus_method("getDefaultAttributes")
+ func = self.get_dbus_method("getDefaultAttributes", dbus_interface=ATSPI_TEXT)
return func(*args, **kwargs)
def getNSelections(self, *args, **kwargs):
@return the number of contiguous selections in the current Text
object.
"""
- func = self.get_dbus_method("getNSelections")
+ func = self.get_dbus_method("getNSelections", dbus_interface=ATSPI_TEXT)
return func(*args, **kwargs)
def getOffsetAtPoint(self, *args, **kwargs):
of the glyph whose onscreen bounds contain the point x,y, or
-1 if the point is outside the bounds of any glyph.
"""
- func = self.get_dbus_method("getOffsetAtPoint")
+ func = self.get_dbus_method("getOffsetAtPoint", dbus_interface=ATSPI_TEXT)
return func(*args, **kwargs)
def getRangeExtents(self, *args, **kwargs):
corner of the screen; if 1, the coordinates are reported relative
to the corner of the containing toplevel window.
"""
- func = self.get_dbus_method("getRangeExtents")
+ func = self.get_dbus_method("getRangeExtents", dbus_interface=ATSPI_TEXT)
return func(*args, **kwargs)
def getSelection(self, *args, **kwargs):
(i.e. for a selection which does not exist) is not strictly defined,
but should set endOffset equal to startOffset.
"""
- func = self.get_dbus_method("getSelection")
+ func = self.get_dbus_method("getSelection", dbus_interface=ATSPI_TEXT)
return func(*args, **kwargs)
def getText(self, startOffset, endOffset):
startOffset (inclusive) up to but not including the character
at endOffset.
"""
- func = self.get_dbus_method("getText")
+ func = self.get_dbus_method("getText", dbus_interface=ATSPI_TEXT)
if not endOffset:
endOffset = -1
return func(dbus.Int32(startOffset), dbus.Int32(endOffset))
@return a string which is a substring of the text content of
the object, delimited by the specified boundary condition.
"""
- func = self.get_dbus_method("getTextAfterOffset")
+ func = self.get_dbus_method("getTextAfterOffset", dbus_interface=ATSPI_TEXT)
return func(*args, **kwargs)
def getTextAtOffset(self, *args, **kwargs):
@return a string which is a substring of the text content of
the object, delimited by the specified boundary condition.
"""
- func = self.get_dbus_method("getTextAtOffset")
+ func = self.get_dbus_method("getTextAtOffset", dbus_interface=ATSPI_TEXT)
return func(*args, **kwargs)
def getTextBeforeOffset(self, *args, **kwargs):
@return a string which is a substring of the text content of
the object, delimited by the specified boundary condition.
"""
- func = self.get_dbus_method("getTextBeforeOffset")
+ func = self.get_dbus_method("getTextBeforeOffset", dbus_interface=ATSPI_TEXT)
return func(*args, **kwargs)
def removeSelection(self, *args, **kwargs):
@return True if the selection was successfully removed, False
otherwise.
"""
- func = self.get_dbus_method("removeSelection")
+ func = self.get_dbus_method("removeSelection", dbus_interface=ATSPI_TEXT)
return func(*args, **kwargs)
def setCaretOffset(self, *args, **kwargs):
@return TRUE if the request was carried out, or FALSE if the
caret could not be moved to the requested position.
"""
- func = self.get_dbus_method("setCaretOffset")
+ func = self.get_dbus_method("setCaretOffset", dbus_interface=ATSPI_TEXT)
return func(*args, **kwargs)
def setSelection(self, *args, **kwargs):
@return True if the selection corresponding to selectionNum is
successfully modified, False otherwise.
"""
- func = self.get_dbus_method("setSelection")
+ func = self.get_dbus_method("setSelection", dbus_interface=ATSPI_TEXT)
return func(*args, **kwargs)
def get_caretOffset(self):
data = property(fget=_get_data, fset=_set_data)
# Register the accessible class with the factory.
-accessible_factory.register_accessible_class(interfaces.ATSPI_TEXT, Text)
+accessible_factory.register_accessible_class(ATSPI_TEXT, Text)
#END----------------------------------------------------------------------------
#along with this program; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-import interfaces
-from base import BaseProxy
+from interfaces import *
+from accessible import Accessible
from factory import accessible_factory
__all__ = [
#------------------------------------------------------------------------------
-class Value(BaseProxy):
+class Value(Accessible):
"""
An interface supporting controls which allow a one-dimensional,
scalar quantity to be modified or which reflect a scalar quantity.
minimumValue = property(fget=get_minimumValue, fset=set_minimumValue, doc=_minimumValueDoc)
# Register the accessible class with the factory.
-accessible_factory.register_accessible_class(interfaces.ATSPI_VALUE, Value)
+accessible_factory.register_accessible_class(ATSPI_VALUE, Value)
#END----------------------------------------------------------------------------
$(GOBJ_CFLAGS) \
$(ATK_CFLAGS) \
$(GDK_CFLAGS) \
- -I$(top_srcdir)
+ -I$(top_srcdir) \
+ -DATSPI_INTROSPECTION_PATH=\"$(pkgdatadir)/$(DEFAULT_ATSPI_INTROSPECTION_PATH)\"
at_spi_registryd_LDADD = $(DBUS_GLIB_LIBS) \
$(GOBJ_CFLAGS) \
#include <gdk/gdkkeysyms.h>
#include <gdk/gdkwindow.h>
-#include <atk-adaptor/spi-private.h>
#include <spi-common/keymasks.h>
-#include <droute/droute.h>
-#include <droute/introspect-loader.h>
#include <spi-common/spi-dbus.h>
#include <spi-common/spi-types.h>
+#include <droute/droute.h>
+
#include "deviceeventcontroller.h"
#include "reentrant-list.h"
va_list arg;
va_start(arg, first_type);
- spi_dbus_emit_valist(controller->droute->bus, SPI_DBUS_PATH_DEC, SPI_DBUS_INTERFACE_DEC, name, first_type, arg);
+ spi_dbus_emit_valist(controller->bus, SPI_DBUS_PATH_DEC, SPI_DBUS_INTERFACE_DEC, name, first_type, arg);
va_end(arg);
}
controller->key_listeners = g_list_prepend (controller->key_listeners,
key_listener);
- spi_dbus_add_disconnect_match (controller->droute->bus, key_listener->listener.bus_name);
+ spi_dbus_add_disconnect_match (controller->bus, key_listener->listener.bus_name);
if (key_listener->mode->global)
{
return spi_controller_register_global_keygrabs (controller, key_listener);
break;
case SPI_DEVICE_TYPE_MOUSE:
controller->mouse_listeners = g_list_prepend (controller->mouse_listeners, listener);
- spi_dbus_add_disconnect_match (controller->droute->bus, listener->bus_name);
+ spi_dbus_add_disconnect_match (controller->bus, listener->bus_name);
break;
default:
break;
{
// TODO: Evaluate performance: perhaps rework this whole architecture
// to avoid blocking calls
- DBusMessage *reply = dbus_connection_send_with_reply_and_block(controller->droute->bus, message, 1000, &error);
+ DBusMessage *reply = dbus_connection_send_with_reply_and_block(controller->bus, message, 1000, &error);
if (reply)
{
DBusError error;
{
RemoveListenerClosure ctx;
- ctx.bus = controller->droute->bus;
+ ctx.bus = controller->bus;
ctx.listener = listener;
spi_re_entrant_list_foreach (&controller->mouse_listeners,
{
RemoveListenerClosure ctx;
- ctx.bus = controller->droute->bus;
+ ctx.bus = controller->bus;
ctx.listener = (DEControllerListener *) key_listener;
/* special case, copy keyset from existing controller list entry */
check_release_handler = g_timeout_add (CHECK_RELEASE_DELAY, check_release, &pressed_event);
}
-static DBusMessage *
-impl_introspect (DBusConnection *bus, DBusMessage *message,
- void *user_data)
-{
- const char *path;
- GString *output;
- char *final;
-
- DBusMessage *reply;
-
- path = dbus_message_get_path(message);
-
- output = g_string_new(spi_introspection_header);
-
- g_string_append_printf(output, spi_introspection_node_element, path);
-
- spi_append_interface(output, SPI_DBUS_INTERFACE_DEC);
-
- g_string_append(output, spi_introspection_footer);
- final = g_string_free(output, FALSE);
-
- reply = dbus_message_new_method_return (message);
- g_assert(reply != NULL);
- dbus_message_append_args(reply, DBUS_TYPE_STRING, &final,
- DBUS_TYPE_INVALID);
-
- g_free(final);
- return reply;
-}
-
static DRouteMethod dev_methods[] =
{
{ impl_register_keystroke_listener, "registerKeystrokeListener" },
{ NULL, NULL }
};
-static DRouteMethod intro_methods[] = {
- {impl_introspect, "Introspect"},
- {NULL, NULL}
-};
-
SpiDEController *
-spi_registry_dec_new (SpiRegistry *reg, DRouteData *droute)
+spi_registry_dec_new (SpiRegistry *reg, DBusConnection *bus, DRouteContext *droute)
{
SpiDEController *dec = g_object_new (SPI_DEVICE_EVENT_CONTROLLER_TYPE, NULL);
+ DRoutePath *path;
dec->registry = g_object_ref (reg);
- dec->droute = droute;
-
- droute_add_interface (droute,
- SPI_DBUS_INTERFACE_DEC,
- dev_methods,
- NULL, NULL, NULL);
- droute_add_interface (droute,
- "org.freedesktop.DBus.Introspectable",
- intro_methods,
- NULL, NULL, NULL);
+ dec->bus = bus;
+
+ path = droute_add_one (droute,
+ "/org/freedesktop/atspi/registry/deviceeventcontroller",
+ dec);
+
+ droute_path_add_interface (path,
+ SPI_DBUS_INTERFACE_DEC,
+ dev_methods,
+ NULL);
spi_dec_init_mouse_listener (dec);
/* TODO: kill mouse listener on finalize */
struct _SpiDEController {
GObject parent;
-
- SpiRegistry *registry;
- DRouteData *droute;
- GList *key_listeners;
- GList *mouse_listeners;
- GList *keygrabs_list;
- Display *xevie_display;
+ DBusConnection *bus;
+ SpiRegistry *registry;
+ GList *key_listeners;
+ GList *mouse_listeners;
+ GList *keygrabs_list;
+ Display *xevie_display;
};
typedef struct {
} SpiDEControllerClass;
GType spi_device_event_controller_get_type (void);
-SpiDEController *spi_device_event_controller_new (SpiRegistry *registry);
+SpiDEController *spi_device_event_controller_new (SpiRegistry *registry,
+ DBusConnection *bus,
+ DRouteContext *droute);
void spi_remove_device_listeners (SpiDEController *controller, const char *bus_name);
#include "registry.h"
#include "deviceeventcontroller.h"
+#if !defined ATSPI_INTROSPECTION_PATH
+ #error "No introspection XML directory defined"
+#endif
+
static gchar *dbus_name = NULL;
static GOptionEntry optentries[] =
{NULL}
};
-static DBusObjectPathVTable droute_vtable =
-{
- NULL,
- &droute_message,
- NULL, NULL, NULL, NULL
-};
-
int
main (int argc, char **argv)
{
SpiRegistry *registry;
SpiDEController *dec;
- DRouteData droute;
+ DRouteContext *droute;
+ gchar *introspection_directory;
GMainLoop *mainloop;
DBusConnection *bus;
dbus_error_init (&error);
bus = dbus_bus_get(DBUS_BUS_SESSION, &error);
- droute.bus = bus;
if (!bus)
{
g_warning("Couldn't connect to dbus: %s\n", error.message);
g_print ("SpiRegistry daemon is running with well-known name - %s\n", dbus_name);
}
+ /* Get D-Bus introspection directory */
+ introspection_directory = (char *) g_getenv("ATSPI_INTROSPECTION_PATH");
+ if (introspection_directory == NULL)
+ introspection_directory = ATSPI_INTROSPECTION_PATH;
+
/* Set up D-Route for use by the dec */
- droute.interfaces = NULL;
- if (!dbus_connection_register_object_path (droute.bus,
- "/org/freedesktop/atspi/registry/deviceeventcontroller",
- &droute_vtable,
- &droute))
- {
- g_error("AT-SPI Registry daemon: Couldn't register droute.\n");
- return 0;
- }
+ droute = droute_new (bus, introspection_directory);
- registry = spi_registry_new (bus);
- dec = spi_registry_dec_new (registry, &droute);
- droute.user_data = dec;
+ registry = spi_registry_new (bus, droute);
+ dec = spi_registry_dec_new (registry, bus, droute);
g_main_loop_run (mainloop);
return 0;
/*---------------------------------------------------------------------------*/
static DBusHandlerResult
-message_handler (DBusConnection *bus, DBusMessage *message, void *user_data)
-{
- DBusMessage *reply = NULL;
- guint res = DBUS_HANDLER_RESULT_HANDLED;
-
- int mtype;
- const char *itf;
- const char *name;
-
- mtype = dbus_message_get_type (message);
- itf = dbus_message_get_interface (message);
- name = dbus_message_get_member (message);
-
- if (dbus_message_is_method_call (message, SPI_DBUS_INTERFACE_REGISTRY, "getApplications"))
- reply = impl_getApplications (bus, message, user_data);
- else if (dbus_message_is_method_call (message, SPI_DBUS_INTERFACE_REGISTRY, "registerApplication"))
- impl_registerApplication (bus, message, user_data);
- else if (dbus_message_is_method_call (message, SPI_DBUS_INTERFACE_REGISTRY, "deregisterApplication"))
- impl_deregisterApplication (bus, message, user_data);
- else
- res = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-
- if (reply)
- {
- dbus_connection_send (bus, reply, NULL);
- dbus_message_unref (reply);
- }
- return res;
-}
-
-/*---------------------------------------------------------------------------*/
-
-static DBusHandlerResult
signal_filter (DBusConnection *bus, DBusMessage *message, void *user_data)
{
SpiRegistry *registry = SPI_REGISTRY (user_data);
static gchar *app_sig_match_name_owner =
"type='signal', interface='org.freedesktop.DBus', member='NameOwnerChanged'";
-static DBusObjectPathVTable reg_vtable =
+static DRouteMethod dev_methods[] =
{
- NULL,
- &message_handler,
- NULL, NULL, NULL, NULL
+ { impl_getApplications, "getApplications" },
+ { impl_registerApplication, "registerApplication" },
+ { impl_deregisterApplication, "deregisterApplication" },
+ { NULL, NULL }
};
SpiRegistry *
-spi_registry_new (DBusConnection *bus)
+spi_registry_new (DBusConnection *bus, DRouteContext *droute)
{
SpiRegistry *reg = g_object_new (SPI_REGISTRY_TYPE, NULL);
+ DRoutePath *path;
reg->bus = bus;
- dbus_connection_register_object_path(bus, SPI_DBUS_PATH_REGISTRY, ®_vtable, reg);
-
dbus_bus_add_match (bus, app_sig_match_name_owner, NULL);
dbus_connection_add_filter (bus, signal_filter, reg, NULL);
+ path = droute_add_one (droute,
+ SPI_DBUS_PATH_REGISTRY,
+ reg);
+
+ droute_path_add_interface (path,
+ SPI_DBUS_INTERFACE_DEC,
+ dev_methods,
+ NULL);
+
return reg;
}
#include <glib.h>
#include <glib-object.h>
+#include <droute/droute.h>
+
typedef struct _SpiRegistry SpiRegistry;
typedef struct _SpiRegistryClass SpiRegistryClass;
};
GType spi_registry_get_type (void);
-SpiRegistry *spi_registry_new (DBusConnection *bus);
+SpiRegistry *spi_registry_new (DBusConnection *bus,
+ DRouteContext *droute);
G_END_DECLS