2008-12-17 Mark Doffman <mark.doffman@codethink.co.uk>
authorMark Doffman <mdoff@silver-wind.(none)>
Wed, 17 Dec 2008 17:53:30 +0000 (17:53 +0000)
committerMark Doffman <mdoff@silver-wind.(none)>
Thu, 18 Dec 2008 12:25:38 +0000 (12:25 +0000)
        Mega commit that changes droute, adding
        an interface for creating a droute context
        and registering single, or multiple objects
        with the droute context. Modifies atk-adaptor
        and registryd to use the new interface.

        * droute/
          New interface
        * atk-adaptor
          Use new droute interface
        * registryd
          Use new droute interface
        * pyatspi
          Bug fix, methods were using "null" interface.

57 files changed:
atk-adaptor/Makefile.am
atk-adaptor/accessible.c
atk-adaptor/accessible.h
atk-adaptor/action.c
atk-adaptor/application.c
atk-adaptor/atk-dbus.c
atk-adaptor/atk-dbus.h
atk-adaptor/bridge.c
atk-adaptor/bridge.h
atk-adaptor/collection.c
atk-adaptor/component.c
atk-adaptor/document.c
atk-adaptor/editabletext.c
atk-adaptor/event.c
atk-adaptor/event.h [new file with mode: 0644]
atk-adaptor/hyperlink.c
atk-adaptor/hypertext.c
atk-adaptor/image.c
atk-adaptor/introspectable.c [deleted file]
atk-adaptor/relation.c
atk-adaptor/selection.c
atk-adaptor/table.c
atk-adaptor/text.c
atk-adaptor/tree.c
atk-adaptor/tree.h [new file with mode: 0644]
atk-adaptor/value.c
dbind/dbind.c
droute/Makefile.am
droute/droute-pairhash.c
droute/droute-test.c [new file with mode: 0644]
droute/droute.c
droute/droute.h
droute/test.interface.One [new file with mode: 0644]
droute/test.interface.Two [new file with mode: 0644]
pyatspi/action.py
pyatspi/application.py
pyatspi/collection.py
pyatspi/component.py
pyatspi/desktop.py
pyatspi/document.py
pyatspi/editabletext.py
pyatspi/hyperlink.py
pyatspi/hypertext.py
pyatspi/image.py
pyatspi/loginhelper.py
pyatspi/selection.py
pyatspi/selector.py
pyatspi/streamablecontent.py
pyatspi/table.py
pyatspi/text.py
pyatspi/value.py
registryd/Makefile.am
registryd/deviceeventcontroller.c
registryd/deviceeventcontroller.h
registryd/registry-main.c
registryd/registry.c
registryd/registry.h

index 51c714f..944681f 100644 (file)
@@ -1,7 +1,8 @@
 gtkmoduledir = $(libdir)/$(GTK_MODULE_DIR)
 gtkmodule_LTLIBRARIES = libspiatk.la
 
 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             \
 
 libspiatk_la_LDFLAGS = -no-undefined       \
                       -module             \
@@ -31,10 +32,8 @@ libspiatk_la_SOURCES =               \
        atk-dbus.h              \
        image.c                 \
        selection.c             \
        atk-dbus.h              \
        image.c                 \
        selection.c             \
-       spi-private.h           \
        table.c                 \
        text.c                  \
        table.c                 \
        text.c                  \
-       tree.c                  \
-       util.c                  \
-       value.c                 \
-       introspectable.c 
+       tree.c                  \
+       tree.h                  \
+       value.c
index 220167e..9d2b62a 100644 (file)
  * Boston, MA 02111-1307, USA.
  */
 
  * 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
 
 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
   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);
   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
   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
   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);
   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
   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
 }
 
 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,
   return droute_return_v_int32 (iter,
-                               atk_object_get_n_accessible_children
-                               (object));
+                                atk_object_get_n_accessible_children
+                                (object));
 }
 
 static DBusMessage *
 }
 
 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;
 
   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 *
   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;
 
   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;
   count = atk_object_get_n_accessible_children (object);
   reply = dbus_message_new_method_return (message);
   if (!reply) goto oom;
@@ -151,15 +157,16 @@ oom:
 }
 
 static DBusMessage *
 }
 
 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;
 
   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)
   rv = atk_object_get_index_in_parent (object);
   reply = dbus_message_new_method_return (message);
   if (reply)
@@ -215,18 +222,19 @@ spi_relation_type_from_atk_relation_type (AtkRelationType type)
 }
 
 static DBusMessage *
 }
 
 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;
 
   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);
   reply = dbus_message_new_method_return (message);
   if (!reply) return NULL;
   set = atk_object_ref_relation_set (object);
@@ -400,15 +408,15 @@ spi_accessible_role_from_atk_role (AtkRole role)
 }
 
 static DBusMessage *
 }
 
 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;
 
   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);
   role = atk_object_get_role (object);
   rv = spi_accessible_role_from_atk_role (role);
   reply = dbus_message_new_method_return (message);
@@ -430,16 +438,17 @@ impl_get_role_str (void *datum)
 }
 
 static DBusMessage *
 }
 
 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;
 
   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)
   role = atk_object_get_role (object);
   role_name = atk_role_get_name (role);
   if (!role_name)
@@ -454,16 +463,17 @@ impl_getRoleName (DBusConnection * bus, DBusMessage * message,
 }
 
 static DBusMessage *
 }
 
 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;
 
   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)
   role = atk_object_get_role (object);
   role_name = atk_role_get_localized_name (role);
   if (!role_name)
@@ -478,15 +488,17 @@ impl_getLocalizedRoleName (DBusConnection * bus, DBusMessage * message,
 }
 
 static DBusMessage *
 }
 
 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;
 
   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)
   spi_atk_state_to_dbus_array (object, rv);
   reply = dbus_message_new_method_return (message);
   if (reply)
@@ -498,10 +510,11 @@ impl_getState (DBusConnection * bus, DBusMessage * message, void *user_data)
 }
 
 static DBusMessage *
 }
 
 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;
   DBusMessage *reply;
   AtkAttributeSet *attributes;
   AtkAttribute *attr = NULL;
@@ -509,8 +522,8 @@ impl_getAttributes (DBusConnection * bus, DBusMessage * message,
   gint n_attributes = 0;
   gint i;
 
   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)
 
   attributes = atk_object_get_attributes (object);
   if (attributes)
@@ -538,8 +551,9 @@ impl_getAttributes (DBusConnection * bus, DBusMessage * message,
 }
 
 static DBusMessage *
 }
 
 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);
 {
   AtkObject *root = atk_get_root ();
   return spi_dbus_return_object (message, root, FALSE);
@@ -568,9 +582,10 @@ static DRouteProperty properties[] = {
 };
 
 void
 };
 
 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);
 };
 };
index ce904aa..f15b397 100644 (file)
 #ifndef SPI_ACCESSIBLE_H_
 #define SPI_ACCESSIBLE_H_
 
 #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 <spi-common/spi-types.h>
 
-#include "atk/atk.h"
-
 G_BEGIN_DECLS
 
 Accessibility_Role spi_accessible_role_from_atk_role (AtkRole role);
 
 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_ */
 G_END_DECLS
 
 #endif /* SPI_ACCESSIBLE_H_ */
index 693a9a4..e9da657 100644 (file)
  * Boston, MA 02111-1307, USA.
  */
 
  * 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
 
 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)
 {
   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;
   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);
   }
   {
     return spi_dbus_general_error (message);
   }
@@ -78,12 +66,15 @@ static DBusMessage *
 impl_get_name (DBusConnection *bus, DBusMessage *message, void *user_data)
 {
   DBusMessage *reply;
 impl_get_name (DBusConnection *bus, DBusMessage *message, void *user_data)
 {
   DBusMessage *reply;
+  DBusError error;
   dbus_int32_t index;
   const char *name;
   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);
   }
   {
     return spi_dbus_general_error (message);
   }
@@ -101,12 +92,15 @@ static DBusMessage *
 impl_get_keybinding (DBusConnection *bus, DBusMessage *message, void *user_data)
 {
   DBusMessage *reply;
 impl_get_keybinding (DBusConnection *bus, DBusMessage *message, void *user_data)
 {
   DBusMessage *reply;
+  DBusError error;
   dbus_int32_t index;
   const char *kb;
   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);
   }
   {
     return spi_dbus_general_error (message);
   }
@@ -122,14 +116,14 @@ impl_get_keybinding (DBusConnection *bus, DBusMessage *message, void *user_data)
 
 static DBusMessage *impl_getActions(DBusConnection *bus, DBusMessage *message, void *user_data)
 {
 
 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;
 
   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;
   count = atk_action_get_n_actions(action);
   reply = dbus_message_new_method_return (message);
   if (!reply) goto oom;
@@ -161,14 +155,14 @@ oom:
 
 static DBusMessage *impl_doAction(DBusConnection *bus, DBusMessage *message, void *user_data)
 {
 
 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;
 
   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))
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &index, DBUS_TYPE_INVALID))
@@ -201,10 +195,10 @@ static DRouteProperty properties[] =
 };
 
 void
 };
 
 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);
 };
 };
index ccaa6c2..cf6b689 100644 (file)
  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  * Boston, MA 02111-1307, USA.
  */
  * 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
 
 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
                      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 ());
 }
 {
   return droute_return_v_string (iter, atk_get_toolkit_version ());
 }
@@ -40,13 +43,13 @@ impl_get_version (const char *path, DBusMessageIter * iter, void *user_data)
 static dbus_int32_t id;
 
 static dbus_bool_t
 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
 {
   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;
 {
   id = droute_get_v_int32 (iter);
   return TRUE;
@@ -100,17 +103,18 @@ static DRouteProperty properties[] = {
   {NULL, NULL, NULL}
 };
 
   {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 ());
 obj_is_root (const char *path, void *user_data)
 {
   AtkObject *obj = atk_dbus_get_object (path);
   return (obj == atk_get_root ());
-}
+}*/
 
 void
 
 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);
 };
 };
index 94b8a8a..6bf009c 100644 (file)
 #include <stdlib.h>
 #include <string.h>
 
 #include <stdlib.h>
 #include <string.h>
 
+#include "bridge.h"
 #include "accessible.h"
 
 #include "accessible.h"
 
-/* TODO 
+/* TODO
  * Need to add concurrency support.
  */
 
  * Need to add concurrency support.
  */
 
@@ -79,6 +80,13 @@ GHashTable *remove_list = NULL; /* Stores the objects that need to be removed fr
 
 static guint counter = 1;
 
 
 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;
+
 /*---------------------------------------------------------------------------*/
 
 /*
 /*---------------------------------------------------------------------------*/
 
 /*
@@ -121,7 +129,7 @@ deregister_accessible(gpointer data, GObject *accessible)
     {
       g_hash_table_remove(ref2ptr, GINT_TO_POINTER(ref));
       /* Add to removal list */
     {
       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.
        * TODO
        * Pyatspi client side exceptions have occured indicating
        * that an object has been removed twice.
@@ -130,7 +138,7 @@ deregister_accessible(gpointer data, GObject *accessible)
       g_hash_table_insert(remove_list, GINT_TO_POINTER(ref), NULL);
     }
 
       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);
 }
 
 /*---------------------------------------------------------------------------*/
 }
 
 /*---------------------------------------------------------------------------*/
@@ -157,7 +165,7 @@ register_accessible (AtkObject *accessible)
   /* Add to update list */
   g_hash_table_insert (update_list, GINT_TO_POINTER(reference), accessible);
 
   /* 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;
 }
 
   return reference;
 }
@@ -201,16 +209,16 @@ atk_dbus_notify_change(AtkObject *accessible)
 {
   guint ref;
   g_assert(ATK_IS_OBJECT(accessible));
 {
   guint ref;
   g_assert(ATK_IS_OBJECT(accessible));
-  
+
   if (!g_object_get_data (G_OBJECT (accessible), "dbus-id"))
     {
       register_accessible(accessible);
     }
   else
     {
   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);
     }
 }
 
     }
 }
 
@@ -270,7 +278,7 @@ atk_dbus_get_path (AtkObject *accessible)
 
   index = GPOINTER_TO_INT(g_object_get_data (G_OBJECT (accessible), "dbus-id"));
   if (!index)
 
   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);
 }
 
   return g_strdup_printf(ATK_BRIDGE_OBJECT_REFERENCE_TEMPLATE, index);
 }
@@ -360,7 +368,7 @@ spi_dbus_return_v_object (DBusMessageIter *iter, AtkObject *obj, int unref)
  * Initializes all of the required D-Bus interfaces.
  */
 void
  * 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);
 {
   if (!ref2ptr)
     ref2ptr = g_hash_table_new(g_direct_hash, g_direct_equal);
@@ -370,22 +378,7 @@ atk_dbus_initialize (DRouteData * data)
     remove_list = g_hash_table_new(g_direct_hash, g_direct_equal);
 
   /* Get the root accessible and add */
     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------------------------------------------------------------------------*/
 }
 
 /*END------------------------------------------------------------------------*/
index b3b6507..b409c2b 100644 (file)
@@ -26,8 +26,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-
-#include "accessible.h"
+#include <glib.h>
 
 void
 atk_dbus_foreach_registered(GHFunc func, gpointer data);
 
 void
 atk_dbus_foreach_registered(GHFunc func, gpointer data);
@@ -59,7 +58,4 @@ spi_dbus_return_object (DBusMessage *message, AtkObject *obj, gboolean unref);
 dbus_bool_t
 spi_dbus_return_v_object (DBusMessageIter *iter, AtkObject *obj, int unref);
 
 dbus_bool_t
 spi_dbus_return_v_object (DBusMessageIter *iter, AtkObject *obj, int unref);
 
-void
-atk_dbus_initialize (DRouteData * data);
-
 #endif /* __ATK_DBUS__ */
 #endif /* __ATK_DBUS__ */
index 3e5fba4..da7d331 100644 (file)
 #include <atk/atk.h>
 #include <atk/atkobject.h>
 #include <atk/atknoopobject.h>
 #include <atk/atk.h>
 #include <atk/atkobject.h>
 #include <atk/atknoopobject.h>
-#include "accessible.h"
+
+#include <droute/droute.h>
+
 #include "bridge.h"
 #include "bridge.h"
+#include "event.h"
 #include "atk-dbus.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;
 
 
 static const AtkMisc *atk_misc = NULL;
 
@@ -146,11 +154,11 @@ register_application (SpiAppData *app)
                                           "registerApplication");
   dbus_message_set_no_reply (message, TRUE);
 
                                           "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_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);
 }
 
   if (message) dbus_message_unref (message);
 }
 
@@ -172,11 +180,11 @@ deregister_application (SpiAppData *app)
                                           "deregisterApplication");
   dbus_message_set_no_reply (message, TRUE);
 
                                           "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_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);
 }
 
   if (message) dbus_message_unref (message);
 }
 
@@ -185,17 +193,17 @@ deregister_application (SpiAppData *app)
 static void
 exit_func (void)
 {
 static void
 exit_func (void)
 {
-  if (!app_data)
+  if (!atk_adaptor_app_data)
     {
       return;
     }
 
   spi_atk_tidy_windows ();
   spi_atk_deregister_event_listeners();
     {
       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
 
   /* Not currently creating an XDisplay */
 #if 0
@@ -206,13 +214,6 @@ exit_func (void)
 
 /*---------------------------------------------------------------------------*/
 
 
 /*---------------------------------------------------------------------------*/
 
-static DBusObjectPathVTable droute_vtable =
-{
-  NULL,
-  &droute_message,
-  NULL, NULL, NULL, NULL
-};
-
 static gchar *atspi_dbus_name;
 static gboolean atspi_no_register;
 
 static gchar *atspi_dbus_name;
 static gboolean atspi_no_register;
 
@@ -239,9 +240,10 @@ adaptor_init (gint *argc, gchar **argv[])
   GOptionContext *opt;
   GError *err = NULL;
   DBusError error;
   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);
 
   /* Parse command line options */
   opt = g_option_context_new(NULL);
@@ -251,51 +253,70 @@ adaptor_init (gint *argc, gchar **argv[])
       g_warning("AT-SPI Option parsing failed: %s\n", err->message);
 
   /* Allocate global data and do ATK initializations */
       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_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);
   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_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 &&
     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);
   }
 
   {
     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 */
 
   /* 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 */
 
   /* 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 ();
 
 
   /* 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 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);
 
 
   g_atexit (exit_func);
 
index b2bfc51..6b8829b 100644 (file)
  * Boston, MA 02111-1307, USA.
  */
 
  * 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
 {
 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_ */
index 317e147..304ed62 100644 (file)
 
 /* collection.c: implements the Collection interface */
 
 
 /* collection.c: implements the Collection interface */
 
-#include "accessible.h"
-#include "spi-common/bitarray.h"
 #include <string.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;
 #define get_object(message) atk_dbus_get_object(dbus_message_get_path(message))
 
 typedef struct _MatchRulePrivate MatchRulePrivate;
@@ -671,7 +677,7 @@ return_and_free_list(DBusMessage *message, GList *ls)
   if (!dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "o", &iter_array)) goto oom;
   for (item = ls; item; item = g_list_next(item))
   {
   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);
   }
       dbus_message_iter_append_basic(&iter_array, DBUS_TYPE_OBJECT_PATH, &path);
       g_free(path);
   }
@@ -1014,13 +1020,15 @@ impl_getMatches(DBusConnection *bus, DBusMessage *message, void *user_data)
 static DRouteMethod methods[] = {
   { impl_getMatchesFrom, "getMatchesFrom" },
   { impl_getMatchesTo, "getMatchesTo" },
 static DRouteMethod methods[] = {
   { impl_getMatchesFrom, "getMatchesFrom" },
   { impl_getMatchesTo, "getMatchesTo" },
-  {impl_getMatches, "getMatches" },
+  { impl_getMatches, "getMatches" },
   {NULL, NULL}
 };
 
 void
   {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);
 };
 };
index fdfaaee..cd132da 100644 (file)
  * Boston, MA 02111-1307, USA.
  */
 
  * 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)
 {
 
 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;
 
   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,
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &x, DBUS_TYPE_INT32, &y,
@@ -76,14 +63,15 @@ static DBusMessage *
 impl_getAccessibleAtPoint (DBusConnection * bus, DBusMessage * message,
                           void *user_data)
 {
 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;
 
   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,
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &x, DBUS_TYPE_INT32, &y,
@@ -100,13 +88,14 @@ impl_getAccessibleAtPoint (DBusConnection * bus, DBusMessage * message,
 static DBusMessage *
 impl_getExtents (DBusConnection * bus, DBusMessage * message, void *user_data)
 {
 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;
 
   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))
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT16, &coord_type, DBUS_TYPE_INVALID))
@@ -122,15 +111,16 @@ static DBusMessage *
 impl_getPosition (DBusConnection * bus, DBusMessage * message,
                  void *user_data)
 {
 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;
 
   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))
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT16, &coord_type, DBUS_TYPE_INVALID))
@@ -152,13 +142,14 @@ impl_getPosition (DBusConnection * bus, DBusMessage * message,
 static DBusMessage *
 impl_getSize (DBusConnection * bus, DBusMessage * message, void *user_data)
 {
 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;
 
   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;
   atk_component_get_size (component, &iwidth, &iheight);
   width = iwidth;
   height = iheight;
@@ -174,13 +165,14 @@ impl_getSize (DBusConnection * bus, DBusMessage * message, void *user_data)
 static DBusMessage *
 impl_getLayer (DBusConnection * bus, DBusMessage * message, void *user_data)
 {
 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;
 
   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)
   atklayer = atk_component_get_layer (component);
 
   switch (atklayer)
@@ -223,12 +215,13 @@ static DBusMessage *
 impl_getMDIZOrder (DBusConnection * bus, DBusMessage * message,
                   void *user_data)
 {
 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;
 
   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)
   rv = atk_component_get_mdi_zorder (component);
   reply = dbus_message_new_method_return (message);
   if (reply)
@@ -241,12 +234,13 @@ impl_getMDIZOrder (DBusConnection * bus, DBusMessage * message,
 static DBusMessage *
 impl_grabFocus (DBusConnection * bus, DBusMessage * message, void *user_data)
 {
 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;
 
   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)
   rv = atk_component_grab_focus (component);
   reply = dbus_message_new_method_return (message);
   if (reply)
@@ -274,12 +268,13 @@ impl_deregisterFocusHandler (DBusConnection * bus, DBusMessage * message,
 static DBusMessage *
 impl_getAlpha (DBusConnection * bus, DBusMessage * message, void *user_data)
 {
 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;
 
   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)
   rv = atk_component_get_alpha (component);
   reply = dbus_message_new_method_return (message);
   if (reply)
@@ -306,10 +301,10 @@ static DRouteMethod methods[] = {
 };
 
 void
 };
 
 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);
 };
 };
index 302f4ab..91f6313 100644 (file)
  * Boston, MA 02111-1307, USA.
  */
 
  * 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 *
 
 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;
 
   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 = "";
   lc = atk_document_get_locale (document);
   if (!lc)
     lc = "";
@@ -67,14 +54,14 @@ static DBusMessage *
 impl_getAttributeValue (DBusConnection * bus, DBusMessage * message,
                        void *user_data)
 {
 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;
 
   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))
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_STRING, &attributename, DBUS_TYPE_INVALID))
@@ -97,7 +84,7 @@ static DBusMessage *
 impl_getAttributes (DBusConnection * bus, DBusMessage * message,
                    void *user_data)
 {
 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;
   DBusMessage *reply;
   AtkAttributeSet *attributes;
   AtkAttribute *attr = NULL;
@@ -105,8 +92,8 @@ impl_getAttributes (DBusConnection * bus, DBusMessage * message,
   gint n_attributes = 0;
   gint i;
 
   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)
 
   attributes = atk_document_get_attributes (document);
   if (attributes)
@@ -141,10 +128,10 @@ static DRouteMethod methods[] = {
 };
 
 void
 };
 
 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);
 };
 };
index 8e16060..76a8866 100644 (file)
  * Boston, MA 02111-1307, USA.
  */
 
  * 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)
 {
 
 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;
 
   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))
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_STRING, &newContents, DBUS_TYPE_INVALID))
@@ -75,7 +60,7 @@ impl_setTextContents (DBusConnection * bus, DBusMessage * message,
 static DBusMessage *
 impl_insertText (DBusConnection * bus, DBusMessage * message, void *user_data)
 {
 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;
   dbus_int32_t position, length;
   char *text;
   dbus_bool_t rv;
@@ -83,8 +68,8 @@ impl_insertText (DBusConnection * bus, DBusMessage * message, void *user_data)
   DBusMessage *reply;
   gint ip;
 
   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,
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &position, DBUS_TYPE_STRING, &text,
@@ -109,15 +94,15 @@ static DBusMessage *
 impl_setAttributes (DBusConnection * bus, DBusMessage * message,
                    void *user_data)
 {
 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;
 
   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,
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_STRING, &attributes, DBUS_TYPE_INT32,
@@ -139,12 +124,12 @@ impl_setAttributes (DBusConnection * bus, DBusMessage * message,
 static DBusMessage *
 impl_copyText (DBusConnection * bus, DBusMessage * message, void *user_data)
 {
 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;
 
   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,
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &startPos, DBUS_TYPE_INT32, &endPos,
@@ -159,14 +144,14 @@ impl_copyText (DBusConnection * bus, DBusMessage * message, void *user_data)
 static DBusMessage *
 impl_cutText (DBusConnection * bus, DBusMessage * message, void *user_data)
 {
 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;
 
   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,
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &startPos, DBUS_TYPE_INT32, &endPos,
@@ -189,14 +174,14 @@ impl_cutText (DBusConnection * bus, DBusMessage * message, void *user_data)
 static DBusMessage *
 impl_deleteText (DBusConnection * bus, DBusMessage * message, void *user_data)
 {
 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;
 
   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,
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &startPos, DBUS_TYPE_INT32, &endPos,
@@ -219,14 +204,14 @@ impl_deleteText (DBusConnection * bus, DBusMessage * message, void *user_data)
 static DBusMessage *
 impl_pasteText (DBusConnection * bus, DBusMessage * message, void *user_data)
 {
 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;
 
   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))
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &position, DBUS_TYPE_INVALID))
@@ -257,10 +242,10 @@ static DRouteMethod methods[] = {
 };
 
 void
 };
 
 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);
 };
 };
index 73e13a0..fef3916 100644 (file)
  * Boston, MA 02111-1307, USA.
  */
 
  * Boston, MA 02111-1307, USA.
  */
 
-#include <atk/atk.h>
 #include <string.h>
 #include <string.h>
-#include "accessible.h"
+
+#include <atk/atk.h>
+#include <droute/droute.h>
+
 #include "bridge.h"
 #include "atk-dbus.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;
 
 
 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;
 
 /*---------------------------------------------------------------------------*/
 
 
 /*---------------------------------------------------------------------------*/
 
@@ -61,7 +69,7 @@ Accessibility_DeviceEventController_notifyListenersSync(const Accessibility_Devi
   dbus_error_init(&error);
   if (spi_dbus_marshal_deviceEvent(message, key_event))
   {
   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;
     if (reply)
     {
       DBusError error;
@@ -226,7 +234,7 @@ emit(AtkObject  *accessible,
   dbus_message_iter_append_basic(&sub, (int) *type, &val);
   dbus_message_iter_close_container(&iter, &sub);
 
   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_unref(sig);
 }
 
@@ -279,7 +287,7 @@ emit_rect(AtkObject  *accessible,
     dbus_message_iter_close_container (&variant, &sub);
   dbus_message_iter_close_container (&iter, &variant);
 
     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);
 }
 
 /*---------------------------------------------------------------------------*/
 }
 
 /*---------------------------------------------------------------------------*/
diff --git a/atk-adaptor/event.h b/atk-adaptor/event.h
new file mode 100644 (file)
index 0000000..d40567d
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * 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_ */
index 42b2096..39264d5 100644 (file)
  * Boston, MA 02111-1307, USA.
  */
 
  * 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
 
 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
   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)
 {
                     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
   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)
 {
   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;
 
   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))
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &i, DBUS_TYPE_INVALID))
@@ -94,14 +77,14 @@ impl_getObject (DBusConnection * bus, DBusMessage * message, void *user_data)
 static DBusMessage *
 impl_getURI (DBusConnection * bus, DBusMessage * message, void *user_data)
 {
 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;
 
   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,
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &i, DBUS_TYPE_INT32, &i,
@@ -126,12 +109,12 @@ impl_getURI (DBusConnection * bus, DBusMessage * message, void *user_data)
 static DBusMessage *
 impl_isValid (DBusConnection * bus, DBusMessage * message, void *user_data)
 {
 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;
 
   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);
 
   rv = atk_hyperlink_is_valid (link);
   reply = dbus_message_new_method_return (message);
@@ -158,10 +141,10 @@ static DRouteProperty properties[] = {
 };
 
 void
 };
 
 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);
 };
 };
index 8b5d4d6..a1c2298 100644 (file)
  * Boston, MA 02111-1307, USA.
  */
 
  * 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)
 {
 
 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;
 
   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)
   rv = atk_hypertext_get_n_links (hypertext);
   reply = dbus_message_new_method_return (message);
   if (reply)
@@ -64,13 +49,13 @@ impl_getNLinks (DBusConnection * bus, DBusMessage * message, void *user_data)
 static DBusMessage *
 impl_getLink (DBusConnection * bus, DBusMessage * message, void *user_data)
 {
 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;
 
   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))
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &linkIndex, DBUS_TYPE_INVALID))
@@ -85,14 +70,14 @@ static DBusMessage *
 impl_getLinkIndex (DBusConnection * bus, DBusMessage * message,
                   void *user_data)
 {
 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;
 
   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))
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &characterIndex, DBUS_TYPE_INVALID))
@@ -117,10 +102,10 @@ static DRouteMethod methods[] = {
 };
 
 void
 };
 
 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);
 };
 };
index f754749..23bf365 100644 (file)
  * Boston, MA 02111-1307, USA.
  */
 
  * 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
 
 static dbus_bool_t
-impl_get_imageDescription (const char *path, DBusMessageIter * iter,
+impl_get_imageDescription (DBusMessageIter * iter,
                           void *user_data)
 {
                           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
   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)
 {
                      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));
 }
 
   return droute_return_v_string (iter, atk_image_get_image_locale (image));
 }
 
@@ -67,13 +50,13 @@ static DBusMessage *
 impl_getImageExtents (DBusConnection * bus, DBusMessage * message,
                      void *user_data)
 {
 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;
 
   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))
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT16, &coordType, DBUS_TYPE_INVALID))
@@ -89,15 +72,15 @@ static DBusMessage *
 impl_getImagePosition (DBusConnection * bus, DBusMessage * message,
                       void *user_data)
 {
 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;
 
   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))
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT16, &coord_type, DBUS_TYPE_INVALID))
@@ -120,13 +103,13 @@ static DBusMessage *
 impl_getImageSize (DBusConnection * bus, DBusMessage * message,
                   void *user_data)
 {
 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;
 
   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;
   atk_image_get_image_size (image, &iwidth, &iheight);
   width = iwidth;
   height = iheight;
@@ -153,9 +136,10 @@ static DRouteProperty properties[] = {
 };
 
 void
 };
 
 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);
 };
 };
diff --git a/atk-adaptor/introspectable.c b/atk-adaptor/introspectable.c
deleted file mode 100644 (file)
index 4781979..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * 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);
-};
index 6d487d4..12edc7a 100644 (file)
 
 #include <config.h>
 #include <stdio.h>
 
 #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)
 
 static gboolean
 spi_init_relation_type_table (Accessibility_RelationType *types)
index d7c9b2f..3cae386 100644 (file)
  * Boston, MA 02111-1307, USA.
  */
 
  * 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
 
 static dbus_bool_t
-impl_get_nSelectedChildren (const char *path, DBusMessageIter * iter,
+impl_get_nSelectedChildren (DBusMessageIter * iter,
                            void *user_data)
 {
                            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));
 }
 
   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));
 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)
 {
 
 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;
 
   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,
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &selectedChildIndex,
@@ -89,14 +73,14 @@ static DBusMessage *
 impl_selectChild (DBusConnection * bus, DBusMessage * message,
                  void *user_data)
 {
 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;
 
   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))
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &childIndex, DBUS_TYPE_INVALID))
@@ -117,14 +101,14 @@ static DBusMessage *
 impl_deselectSelectedChild (DBusConnection * bus, DBusMessage * message,
                            void *user_data)
 {
 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;
 
   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,
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &selectedChildIndex,
@@ -146,14 +130,14 @@ static DBusMessage *
 impl_isChildSelected (DBusConnection * bus, DBusMessage * message,
                      void *user_data)
 {
 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;
 
   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))
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &childIndex, DBUS_TYPE_INVALID))
@@ -173,12 +157,12 @@ impl_isChildSelected (DBusConnection * bus, DBusMessage * message,
 static DBusMessage *
 impl_selectAll (DBusConnection * bus, DBusMessage * message, void *user_data)
 {
 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;
 
   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)
   rv = atk_selection_select_all_selection (selection);
   reply = dbus_message_new_method_return (message);
   if (reply)
@@ -193,12 +177,12 @@ static DBusMessage *
 impl_clearSelection (DBusConnection * bus, DBusMessage * message,
                     void *user_data)
 {
 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;
 
   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)
   rv = atk_selection_clear_selection (selection);
   reply = dbus_message_new_method_return (message);
   if (reply)
@@ -213,15 +197,15 @@ static DBusMessage *
 impl_deselectChild (DBusConnection * bus, DBusMessage * message,
                    void *user_data)
 {
 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;
 
   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,
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &selectedChildIndex,
@@ -267,10 +251,10 @@ static DRouteProperty properties[] = {
 };
 
 void
 };
 
 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);
 };
 };
index 868ae1f..c0c6b0f 100644 (file)
  * Boston, MA 02111-1307, USA.
  */
 
  * 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
 
 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
   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
   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
   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
   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)
 {
                        void *user_data)
 {
-  AtkTable *table = get_table_from_path (path, user_data);
+  AtkTable *table = (AtkTable *) user_data;
   gint *selected_rows = NULL;
   int count;
   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);
   count = atk_table_get_selected_rows (table, &selected_rows);
   if (selected_rows)
     g_free (selected_rows);
@@ -96,14 +77,13 @@ impl_get_nSelectedRows (const char *path, DBusMessageIter * iter,
 }
 
 static dbus_bool_t
 }
 
 static dbus_bool_t
-impl_get_nSelectedColumns (const char *path, DBusMessageIter * iter,
+impl_get_nSelectedColumns (DBusMessageIter * iter,
                           void *user_data)
 {
                           void *user_data)
 {
-  AtkTable *table = get_table_from_path (path, user_data);
+  AtkTable *table = (AtkTable *) user_data;
   gint *selected_columns = NULL;
   int count;
   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);
   count = atk_table_get_selected_columns (table, &selected_columns);
   if (selected_columns)
     g_free (selected_columns);
@@ -114,13 +94,13 @@ static DBusMessage *
 impl_getAccessibleAt (DBusConnection * bus, DBusMessage * message,
                      void *user_data)
 {
 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;
 
   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,
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &row, DBUS_TYPE_INT32, &column,
@@ -135,14 +115,14 @@ impl_getAccessibleAt (DBusConnection * bus, DBusMessage * message,
 static DBusMessage *
 impl_getIndexAt (DBusConnection * bus, DBusMessage * message, void *user_data)
 {
 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;
 
   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,
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &row, DBUS_TYPE_INT32, &column,
@@ -164,14 +144,14 @@ static DBusMessage *
 impl_getRowAtIndex (DBusConnection * bus, DBusMessage * message,
                    void *user_data)
 {
 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;
 
   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))
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &index, DBUS_TYPE_INVALID))
@@ -192,14 +172,14 @@ static DBusMessage *
 impl_getColumnAtIndex (DBusConnection * bus, DBusMessage * message,
                       void *user_data)
 {
 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;
 
   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))
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &index, DBUS_TYPE_INVALID))
@@ -220,14 +200,14 @@ static DBusMessage *
 impl_getRowDescription (DBusConnection * bus, DBusMessage * message,
                        void *user_data)
 {
 impl_getRowDescription (DBusConnection * bus, DBusMessage * message,
                        void *user_data)
 {
-  AtkTable *table = get_table (message);
   dbus_int32_t row;
   dbus_int32_t row;
+  AtkTable *table = (AtkTable *) user_data;
   const gchar *description;
   DBusError error;
   DBusMessage *reply;
 
   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))
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &row, DBUS_TYPE_INVALID))
@@ -250,14 +230,14 @@ static DBusMessage *
 impl_getColumnDescription (DBusConnection * bus, DBusMessage * message,
                           void *user_data)
 {
 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;
 
   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))
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &column, DBUS_TYPE_INVALID))
@@ -280,14 +260,14 @@ static DBusMessage *
 impl_getRowExtentAt (DBusConnection * bus, DBusMessage * message,
                     void *user_data)
 {
 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;
 
   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,
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &row, DBUS_TYPE_INT32, &column,
@@ -309,14 +289,14 @@ static DBusMessage *
 impl_getColumnExtentAt (DBusConnection * bus, DBusMessage * message,
                        void *user_data)
 {
 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;
 
   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,
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &row, DBUS_TYPE_INT32, &column,
@@ -338,13 +318,13 @@ static DBusMessage *
 impl_getRowHeader (DBusConnection * bus, DBusMessage * message,
                   void *user_data)
 {
 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;
 
   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))
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &row, DBUS_TYPE_INVALID))
@@ -359,13 +339,13 @@ static DBusMessage *
 impl_getColumnHeader (DBusConnection * bus, DBusMessage * message,
                      void *user_data)
 {
 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;
 
   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))
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &column, DBUS_TYPE_INVALID))
@@ -380,13 +360,13 @@ static DBusMessage *
 impl_getSelectedRows (DBusConnection * bus, DBusMessage * message,
                      void *user_data)
 {
 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;
 
   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;
   count = atk_table_get_selected_rows (table, &selected_rows);
   if (!selected_rows)
     count = 0;
@@ -406,13 +386,13 @@ static DBusMessage *
 impl_getSelectedColumns (DBusConnection * bus, DBusMessage * message,
                         void *user_data)
 {
 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;
 
   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;
   count = atk_table_get_selected_columns (table, &selected_columns);
   if (!selected_columns)
     count = 0;
@@ -432,14 +412,14 @@ static DBusMessage *
 impl_isRowSelected (DBusConnection * bus, DBusMessage * message,
                    void *user_data)
 {
 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;
 
   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))
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &row, DBUS_TYPE_INVALID))
@@ -460,14 +440,14 @@ static DBusMessage *
 impl_isColumnSelected (DBusConnection * bus, DBusMessage * message,
                       void *user_data)
 {
 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;
 
   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))
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &column, DBUS_TYPE_INVALID))
@@ -487,14 +467,14 @@ impl_isColumnSelected (DBusConnection * bus, DBusMessage * message,
 static DBusMessage *
 impl_isSelected (DBusConnection * bus, DBusMessage * message, void *user_data)
 {
 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;
 
   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,
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &row, DBUS_TYPE_INT32, &column,
@@ -516,14 +496,14 @@ static DBusMessage *
 impl_addRowSelection (DBusConnection * bus, DBusMessage * message,
                      void *user_data)
 {
 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;
 
   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))
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &row, DBUS_TYPE_INVALID))
@@ -544,14 +524,14 @@ static DBusMessage *
 impl_addColumnSelection (DBusConnection * bus, DBusMessage * message,
                         void *user_data)
 {
 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;
 
   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))
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &column, DBUS_TYPE_INVALID))
@@ -572,14 +552,14 @@ static DBusMessage *
 impl_removeRowSelection (DBusConnection * bus, DBusMessage * message,
                         void *user_data)
 {
 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;
 
   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))
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &row, DBUS_TYPE_INVALID))
@@ -600,14 +580,14 @@ static DBusMessage *
 impl_removeColumnSelection (DBusConnection * bus, DBusMessage * message,
                            void *user_data)
 {
 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;
 
   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))
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &column, DBUS_TYPE_INVALID))
@@ -628,7 +608,7 @@ static DBusMessage *
 impl_getRowColumnExtentsAtIndex (DBusConnection * bus, DBusMessage * message,
                                 void *user_data)
 {
 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;
   dbus_int32_t index;
   DBusError error;
   dbus_int32_t row, column, row_extents, col_extents;
@@ -639,8 +619,8 @@ impl_getRowColumnExtentsAtIndex (DBusConnection * bus, DBusMessage * message,
   AtkObject *cell;
   AtkRole role;
 
   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))
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &index, DBUS_TYPE_INVALID))
@@ -703,9 +683,10 @@ static DRouteProperty properties[] = {
 };
 
 void
 };
 
 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);
 };
 };
index 451a92b..7c88211 100644 (file)
  * Boston, MA 02111-1307, USA.
  */
 
  * Boston, MA 02111-1307, USA.
  */
 
-#include "accessible.h"
 #include <string.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
 
 static dbus_bool_t
-impl_get_characterCount (const char *path, DBusMessageIter * iter,
+impl_get_characterCount (DBusMessageIter * iter,
                         void *user_data)
 {
                         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
   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)
 {
                      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)
 {
   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;
 
   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,
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &startOffset, DBUS_TYPE_INT32,
@@ -98,14 +82,14 @@ static DBusMessage *
 impl_setCaretOffset (DBusConnection * bus, DBusMessage * message,
                     void *user_data)
 {
 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;
 
   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))
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &offset, DBUS_TYPE_INVALID))
@@ -126,7 +110,7 @@ static DBusMessage *
 impl_getTextBeforeOffset (DBusConnection * bus, DBusMessage * message,
                          void *user_data)
 {
 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;
   dbus_int32_t offset;
   dbus_uint32_t type;
   gchar *txt;
@@ -135,8 +119,8 @@ impl_getTextBeforeOffset (DBusConnection * bus, DBusMessage * message,
   DBusError error;
   DBusMessage *reply;
 
   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,
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &offset, DBUS_TYPE_UINT32, &type,
@@ -166,7 +150,7 @@ static DBusMessage *
 impl_getTextAtOffset (DBusConnection * bus, DBusMessage * message,
                      void *user_data)
 {
 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;
   dbus_int32_t offset, type;
   gchar *txt;
   dbus_int32_t startOffset, endOffset;
@@ -174,8 +158,8 @@ impl_getTextAtOffset (DBusConnection * bus, DBusMessage * message,
   DBusError error;
   DBusMessage *reply;
 
   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,
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &offset, DBUS_TYPE_UINT32, &type,
@@ -205,7 +189,7 @@ static DBusMessage *
 impl_getTextAfterOffset (DBusConnection * bus, DBusMessage * message,
                         void *user_data)
 {
 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;
   dbus_int32_t offset;
   dbus_uint32_t type;
   gchar *txt;
@@ -214,8 +198,8 @@ impl_getTextAfterOffset (DBusConnection * bus, DBusMessage * message,
   DBusError error;
   DBusMessage *reply;
 
   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,
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &offset, DBUS_TYPE_UINT32, &type,
@@ -245,14 +229,14 @@ static DBusMessage *
 impl_getCharacterAtOffset (DBusConnection * bus, DBusMessage * message,
                         void *user_data)
 {
 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;
 
   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))
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &offset, DBUS_TYPE_INVALID))
@@ -272,7 +256,7 @@ static DBusMessage *
 impl_getAttributeValue (DBusConnection * bus, DBusMessage * message,
                        void *user_data)
 {
 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;
   dbus_int32_t offset;
   char *attributeName;
   dbus_int32_t startOffset, endOffset;
@@ -285,8 +269,8 @@ impl_getAttributeValue (DBusConnection * bus, DBusMessage * message,
   GSList *cur_attr;
   AtkAttribute *at;
 
   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,
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &offset, DBUS_TYPE_STRING,
@@ -355,7 +339,7 @@ static DBusMessage *
 impl_getAttributes (DBusConnection * bus, DBusMessage * message,
                    void *user_data)
 {
 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;
   dbus_int32_t offset;
   dbus_int32_t startOffset, endOffset;
   gint intstart_offset, intend_offset;
@@ -364,8 +348,8 @@ impl_getAttributes (DBusConnection * bus, DBusMessage * message,
   DBusMessage *reply;
   AtkAttributeSet *set;
 
   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))
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &offset, DBUS_TYPE_INVALID))
@@ -395,14 +379,14 @@ static DBusMessage *
 impl_getDefaultAttributes (DBusConnection * bus, DBusMessage * message,
                           void *user_data)
 {
 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;
 
   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);
   dbus_error_init (&error);
 
   set = atk_text_get_default_attributes (text);
@@ -422,7 +406,7 @@ static DBusMessage *
 impl_getCharacterExtents (DBusConnection * bus, DBusMessage * message,
                          void *user_data)
 {
 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;
   dbus_int32_t offset;
   dbus_int16_t coordType;
   dbus_int32_t x, y, width, height;
@@ -430,8 +414,8 @@ impl_getCharacterExtents (DBusConnection * bus, DBusMessage * message,
   DBusError error;
   DBusMessage *reply;
 
   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,
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &offset, DBUS_TYPE_INT16, &coordType,
@@ -459,15 +443,15 @@ static DBusMessage *
 impl_getOffsetAtPoint (DBusConnection * bus, DBusMessage * message,
                       void *user_data)
 {
 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;
 
   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,
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &x, DBUS_TYPE_INT32, &y,
@@ -489,12 +473,12 @@ static DBusMessage *
 impl_getNSelections (DBusConnection * bus, DBusMessage * message,
                     void *user_data)
 {
 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;
 
   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)
   rv = atk_text_get_n_selections (text);
   reply = dbus_message_new_method_return (message);
   if (reply)
@@ -509,15 +493,15 @@ static DBusMessage *
 impl_getSelection (DBusConnection * bus, DBusMessage * message,
                   void *user_data)
 {
 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;
 
   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))
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &selectionNum, DBUS_TYPE_INVALID))
@@ -543,14 +527,14 @@ static DBusMessage *
 impl_addSelection (DBusConnection * bus, DBusMessage * message,
                   void *user_data)
 {
 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;
 
   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,
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &startOffset, DBUS_TYPE_INT32,
@@ -572,14 +556,14 @@ static DBusMessage *
 impl_removeSelection (DBusConnection * bus, DBusMessage * message,
                      void *user_data)
 {
 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;
 
   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))
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &selectionNum, DBUS_TYPE_INVALID))
@@ -600,14 +584,14 @@ static DBusMessage *
 impl_setSelection (DBusConnection * bus, DBusMessage * message,
                   void *user_data)
 {
 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;
 
   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,
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &selectionNum, DBUS_TYPE_INT32,
@@ -629,7 +613,7 @@ static DBusMessage *
 impl_getRangeExtents (DBusConnection * bus, DBusMessage * message,
                      void *user_data)
 {
 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;
   dbus_int32_t startOffset, endOffset;
   dbus_int16_t coordType;
   AtkTextRectangle rect;
@@ -637,8 +621,8 @@ impl_getRangeExtents (DBusConnection * bus, DBusMessage * message,
   DBusError error;
   DBusMessage *reply;
 
   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,
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &startOffset, DBUS_TYPE_INT32,
@@ -669,7 +653,7 @@ static DBusMessage *
 impl_getBoundedRanges (DBusConnection * bus, DBusMessage * message,
                       void *user_data)
 {
 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;
   dbus_int32_t x, y, width, height;
   dbus_int16_t coordType, xClipType, yClipType;
   DBusError error;
@@ -678,8 +662,8 @@ impl_getBoundedRanges (DBusConnection * bus, DBusMessage * message,
   DBusMessage *reply;
   DBusMessageIter iter, array, struc, variant;
 
   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,
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &x, DBUS_TYPE_INT32, &y,
@@ -743,7 +727,7 @@ impl_getAttributeRun (DBusConnection * bus, DBusMessage * message,
                      void *user_data)
 {
   DBusError error;
                      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;
   dbus_int32_t offset;
   dbus_bool_t includeDefaults;
   dbus_int32_t startOffset, endOffset;
@@ -755,8 +739,8 @@ impl_getAttributeRun (DBusConnection * bus, DBusMessage * message,
   gint n_attributes = 0, total_attributes = 0, n_default_attributes = 0;
   gint i, j;
 
   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,
   dbus_error_init (&error);
   if (!dbus_message_get_args
       (message, &error, DBUS_TYPE_INT32, &offset, DBUS_TYPE_BOOLEAN,
@@ -821,7 +805,7 @@ static DBusMessage *
 impl_getDefaultAttributeSet (DBusConnection * bus, DBusMessage * message,
                             void *user_data)
 {
 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;
   DBusMessage *reply;
   AtkAttributeSet *attributes;
   AtkAttribute *attr = NULL;
@@ -829,8 +813,8 @@ impl_getDefaultAttributeSet (DBusConnection * bus, DBusMessage * message,
   gint n_attributes = 0;
   gint i;
 
   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)
 
   attributes = atk_text_get_default_attributes (text);
   if (attributes)
@@ -888,9 +872,10 @@ static DRouteProperty properties[] = {
 };
 
 void
 };
 
 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);
 };
 };
index 4a256a9..feffb33 100644 (file)
  */
 
 #include <string.h>
  */
 
 #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"
 
 #include "bridge.h"
 
-extern SpiAppData *app_data;
 static gboolean update_pending = FALSE;
 
 /*---------------------------------------------------------------------------*/
 
 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";
 
 /*
 static const char *dumm = "/APath/1";
 
 /*
@@ -49,7 +136,6 @@ append_accessible(gpointer ref, gpointer obj_data, gpointer iter)
   AtkObject *obj;
   DBusMessageIter *iter_array;
   DBusMessageIter iter_struct, iter_sub_array;
   AtkObject *obj;
   DBusMessageIter *iter_array;
   DBusMessageIter iter_struct, iter_sub_array;
-  DRouteData *data;
   dbus_int32_t states [2];
   int count;
 
   dbus_int32_t states [2];
   int count;
 
@@ -60,7 +146,6 @@ append_accessible(gpointer ref, gpointer obj_data, gpointer iter)
 
   obj = ATK_OBJECT(obj_data);
   iter_array = (DBusMessageIter *) iter;
 
   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);
     {
 
   dbus_message_iter_open_container (iter_array, DBUS_TYPE_STRUCT, NULL, &iter_struct);
     {
@@ -87,34 +172,18 @@ append_accessible(gpointer ref, gpointer obj_data, gpointer iter)
             {
               AtkObject *child;
               gchar *child_path;
             {
               AtkObject *child;
               gchar *child_path;
-             
+
               child = atk_object_ref_accessible_child (obj, i);
               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);
         }
       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_close_container (&iter_struct, &iter_sub_array);
 
       name = atk_object_get_name (obj);
@@ -131,7 +200,7 @@ append_accessible(gpointer ref, gpointer obj_data, gpointer iter)
       dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_STRING, &desc);
 
       g_free(path);
       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++)
   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++)
@@ -163,14 +232,12 @@ append_accessible_path(gpointer ref_data, gpointer null, gpointer data)
 /*---------------------------------------------------------------------------*/
 
 static gboolean
 /*---------------------------------------------------------------------------*/
 
 static gboolean
-send_cache_update(gpointer d)
+send_cache_update(gpointer data)
 {
   DBusMessage *message;
   DBusMessageIter iter;
   DBusMessageIter iter_array;
 {
   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");
 
 
   message = dbus_message_new_signal ("/org/freedesktop/atspi/tree", SPI_DBUS_INTERFACE_TREE, "updateTree");
 
@@ -184,7 +251,7 @@ send_cache_update(gpointer d)
   atk_dbus_foreach_remove_list(append_accessible_path, &iter_array);
   dbus_message_iter_close_container(&iter, &iter_array);
 
   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;
   update_pending = FALSE;
 
   return FALSE;
@@ -193,11 +260,11 @@ send_cache_update(gpointer d)
 /*---------------------------------------------------------------------------*/
 
 void
 /*---------------------------------------------------------------------------*/
 
 void
-atk_tree_cache_needs_update(void)
+atk_tree_cache_needs_update(DBusConnection *bus)
 {
   if (!update_pending)
     {
 {
   if (!update_pending)
     {
-      g_idle_add(send_cache_update, NULL);
+      g_idle_add(send_cache_update, bus);
       update_pending = TRUE;
     }
 }
       update_pending = TRUE;
     }
 }
@@ -242,96 +309,19 @@ impl_getTree (DBusConnection *bus, DBusMessage *message, void *user_data)
 
 /*---------------------------------------------------------------------------*/
 
 
 /*---------------------------------------------------------------------------*/
 
-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
 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------------------------------------------------------------------------*/
 
 /*END------------------------------------------------------------------------*/
diff --git a/atk-adaptor/tree.h b/atk-adaptor/tree.h
new file mode 100644 (file)
index 0000000..0670a45
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * 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_ */
index 33b67c7..5618e61 100644 (file)
  * Boston, MA 02111-1307, USA.
  */
 
  * Boston, MA 02111-1307, USA.
  */
 
-#include "accessible.h"
 #include <math.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 double
 get_double_from_gvalue (GValue * gvalue)
@@ -181,63 +176,58 @@ gvalue_set_from_double (GValue * gvalue, double value)
 }
 
 static dbus_bool_t
 }
 
 static dbus_bool_t
-impl_get_minimumValue (const char *path, DBusMessageIter * iter,
+impl_get_minimumValue (DBusMessageIter * iter,
                       void *user_data)
 {
                       void *user_data)
 {
-  AtkValue *value = get_value_from_path (path, user_data);
+  AtkValue *value = (AtkValue *) user_data;
   GValue gvalue = { 0, };
   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
   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)
 {
                       void *user_data)
 {
-  AtkValue *value = get_value_from_path (path, user_data);
+  AtkValue *value = (AtkValue *) user_data;
   GValue gvalue = { 0, };
   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
   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)
 {
                           void *user_data)
 {
-  AtkValue *value = get_value_from_path (path, user_data);
+  AtkValue *value = (AtkValue *) user_data;
   GValue gvalue = { 0, };
   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
   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)
 {
                       void *user_data)
 {
-  AtkValue *value = get_value_from_path (path, user_data);
+  AtkValue *value = (AtkValue *) user_data;
   GValue gvalue = { 0, };
   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
   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)
 {
                       void *user_data)
 {
-  AtkValue *value = get_value_from_path (path, user_data);
+  AtkValue *value = (AtkValue *) user_data;
   GValue gvalue = { 0, };
   double dbl;
 
   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);
   if (!get_double_from_variant (iter, &dbl))
     return FALSE;
   atk_value_get_current_value (value, &gvalue);
@@ -254,9 +244,10 @@ static DRouteProperty properties[] = {
 };
 
 void
 };
 
 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);
 };
 };
index f34bcc4..2cdf5f7 100644 (file)
@@ -87,6 +87,7 @@ dbind_method_call_reentrant (DBusConnection *cnx,
     if (!msg)
         goto out;
 
     if (!msg)
         goto out;
 
+    p = arg_types;
     dbus_message_iter_init (msg, &iter);
     dbind_any_marshal_va (&iter, &p, args);
 
     dbus_message_iter_init (msg, &iter);
     dbind_any_marshal_va (&iter, &p, args);
 
index 46207e4..9ce04f1 100644 (file)
@@ -17,3 +17,18 @@ libdroute_la_SOURCES =\
                droute-variant.h\
                droute-pairhash.c\
                droute-pairhash.h
                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)
index 20ff491..0c4ace5 100644 (file)
@@ -43,6 +43,7 @@ str_pair_new (const gchar *one, const gchar *two)
     pair = g_new (StrPair, 1);
     pair->one = one;
     pair->two = two;
     pair = g_new (StrPair, 1);
     pair->one = one;
     pair->two = two;
+    return pair;
 }
 
 gint
 }
 
 gint
@@ -51,6 +52,11 @@ str_pair_hash (gconstpointer key)
     StrPair *pair = (StrPair *) key;
     guint hash = 0;
 
     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);
     if (*(pair->two) != '\0')
       {
         hash = *(pair->two);
diff --git a/droute/droute-test.c b/droute/droute-test.c
new file mode 100644 (file)
index 0000000..1895fb6
--- /dev/null
@@ -0,0 +1,246 @@
+#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;
+}
index 5b1d9de..06ec2bd 100644 (file)
 
 #define oom() g_error ("D-Bus out of memory, this message will fail anyway")
 
 
 #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;
 struct _DRouteContext
 {
     DBusConnection       *bus;
@@ -73,7 +79,7 @@ path_new (DRouteContext *cnx,
 {
     DRoutePath *new_path;
 
 {
     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 ();
     new_path->cnx = cnx;
     new_path->chunks = g_string_chunk_new (CHUNKS_DEFAULT);
     new_path->interfaces = g_ptr_array_new ();
@@ -128,13 +134,21 @@ droute_new (DBusConnection *bus, const char *introspect_dir)
 void
 droute_free (DRouteContext *cnx)
 {
 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);
 }
 
 /*---------------------------------------------------------------------------*/
 
     g_free (cnx->introspect_dir);
     g_free (cnx);
 }
 
 /*---------------------------------------------------------------------------*/
 
+DBusConnection *
+droute_get_bus (DRouteContext *cnx)
+{
+    return cnx->bus;
+}
+
+/*---------------------------------------------------------------------------*/
+
 static DBusObjectPathVTable droute_vtable =
 {
   NULL,
 static DBusObjectPathVTable droute_vtable =
 {
   NULL,
@@ -185,12 +199,12 @@ droute_path_add_interface(DRoutePath *path,
 {
     gchar *itf;
 
 {
     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);
 
 
     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;
 
       {
         gchar *meth;
 
@@ -198,7 +212,7 @@ droute_path_add_interface(DRoutePath *path,
         g_hash_table_insert (path->methods, str_pair_new (itf, meth), methods->func);
       }
 
         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;
       {
         gchar *prop;
         PropertyPair *pair;
@@ -233,7 +247,6 @@ impl_prop_GetAll (DBusMessage *message,
     void  *datum = path_get_datum (path, pathstr);
 
     dbus_error_init (&error);
     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);
     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);
@@ -250,7 +263,7 @@ impl_prop_GetAll (DBusMessage *message,
     g_hash_table_iter_init (&prop_iter, path->properties);
     while (g_hash_table_iter_next (&prop_iter, (gpointer*)&key, (gpointer*)&value))
       {
     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;
          {
            if (!value->get)
               continue;
@@ -280,8 +293,10 @@ impl_prop_GetSet (DBusMessage *message,
     DBusError error;
 
     StrPair pair;
     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,
     if (!dbus_message_get_args (message,
                                 &error,
                                 DBUS_TYPE_STRING,
@@ -300,6 +315,8 @@ impl_prop_GetSet (DBusMessage *message,
         void *datum = path_get_datum (path, pathstr);
         DBusMessageIter iter;
 
         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);
         reply = dbus_message_new_method_return (message);
         dbus_message_iter_init_append (reply, &iter);
         (prop_funcs->get) (&iter, datum);
@@ -309,12 +326,21 @@ impl_prop_GetSet (DBusMessage *message,
         void *datum = path_get_datum (path, pathstr);
         DBusMessageIter iter;
 
         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);
         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;
 }
 
     return reply;
 }
 
@@ -338,6 +364,12 @@ handle_properties (DBusConnection *bus,
     else
        result = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 
     else
        result = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 
+    if (reply)
+      {
+        dbus_connection_send (bus, reply, NULL);
+        dbus_message_unref (reply);
+      }
+
     return result;
 }
 
     return result;
 }
 
@@ -357,32 +389,32 @@ append_interface (GString     *str,
                   const gchar *interface,
                   const gchar *directory)
 {
                   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
 }
 
 static DBusHandlerResult
-handle_intropsection (DBusConnection *bus,
+handle_introspection (DBusConnection *bus,
                       DBusMessage    *message,
                       DRoutePath     *path,
                       const gchar    *iface,
                       DBusMessage    *message,
                       DRoutePath     *path,
                       const gchar    *iface,
@@ -395,7 +427,9 @@ handle_intropsection (DBusConnection *bus,
 
     DBusMessage *reply;
 
 
     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);
         return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 
     output = g_string_new(introspection_header);
@@ -442,6 +476,8 @@ handle_other (DBusConnection *bus,
     pair.one = iface;
     pair.two = member;
 
     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)
       {
     func = (DRouteFunction) g_hash_table_lookup (path->methods, &pair);
     if (func != NULL)
       {
@@ -485,4 +521,24 @@ handle_message (DBusConnection *bus, DBusMessage *message, void *user_data)
     return handle_other (bus, message, path, iface, member, pathstr);
 }
 
     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------------------------------------------------------------------------*/
 /*END------------------------------------------------------------------------*/
index 93de4f7..3943178 100644 (file)
@@ -28,6 +28,7 @@
 
 #include <droute/droute-variant.h>
 
 
 #include <droute/droute-variant.h>
 
+
 typedef DBusMessage *(*DRouteFunction)         (DBusConnection *, DBusMessage *, void *);
 typedef dbus_bool_t  (*DRoutePropertyFunction) (DBusMessageIter *, void *);
 
 typedef DBusMessage *(*DRouteFunction)         (DBusConnection *, DBusMessage *, void *);
 typedef dbus_bool_t  (*DRoutePropertyFunction) (DBusMessageIter *, void *);
 
@@ -79,4 +80,10 @@ droute_path_add_interface (DRoutePath *path,
                            const DRouteMethod   *methods,
                            const DRouteProperty *properties);
 
                            const DRouteMethod   *methods,
                            const DRouteProperty *properties);
 
+DBusMessage *
+droute_not_yet_handled_error (DBusMessage *message);
+
+DBusConnection *
+droute_get_bus (DRouteContext *cnx);
+
 #endif /* _DROUTE_H */
 #endif /* _DROUTE_H */
diff --git a/droute/test.interface.One b/droute/test.interface.One
new file mode 100644 (file)
index 0000000..a8e2206
--- /dev/null
@@ -0,0 +1,15 @@
+<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>
diff --git a/droute/test.interface.Two b/droute/test.interface.Two
new file mode 100644 (file)
index 0000000..ca661ec
--- /dev/null
@@ -0,0 +1,15 @@
+<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>
index 9ed4f19..796e6a2 100644 (file)
@@ -12,8 +12,8 @@
 #along with this program; if not, write to the Free Software
 #Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 #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__ = [
 from factory import accessible_factory
 
 __all__ = [
@@ -22,7 +22,7 @@ __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
         """
         An interface through which a user-actionable user interface component
         can be manipulated. Components which react to mouse or keyboard
@@ -42,7 +42,7 @@ class Action(BaseProxy):
                 Causes the object to perform the specified action.
                 @return : a boolean indicating success or failure.
                 """
                 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 func(index)
 
         def getDescription(self, index):
@@ -56,7 +56,7 @@ class Action(BaseProxy):
                 @return : a string containing the description of the specified
                 action.
                 """
                 @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 func(index)
 
         def getKeyBinding(self, index):
@@ -68,7 +68,7 @@ class Action(BaseProxy):
                 @return : a string containing the key binding for the specified
                 action, or an empty string ("") if none exists.
                 """
                 @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):
                 return func(index)
 
         def getName(self, index):
@@ -81,7 +81,7 @@ class Action(BaseProxy):
                 the result of invoking the action.
                 @return : a string containing the name of the specified action.
                 """
                 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):
                 return func(index)
 
         def get_nActions(self):
@@ -96,6 +96,6 @@ class Action(BaseProxy):
         nActions = property(fget=get_nActions, fset=set_nActions, doc=_nActionsDoc)
 
 # Register the accessible class with the factory.
         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----------------------------------------------------------------------------
 
 #END----------------------------------------------------------------------------
index d545143..a72693b 100644 (file)
 #along with this program; if not, write to the Free Software
 #Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 #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__ = [
 from factory import accessible_factory
 from accessible import Accessible
 
 __all__ = [
-                   "Application",
-                  ]
+                  "Application",
+          ]
 
 #------------------------------------------------------------------------------
 
 
 #------------------------------------------------------------------------------
 
@@ -40,7 +39,7 @@ class Application(Accessible):
                 @return a string compliant with the POSIX standard for locale
                 description.
                 """
                 @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):
                 return func(*args, **kwargs)
 
         def pause(self, *args, **kwargs):
@@ -50,7 +49,7 @@ class Application(Accessible):
                 loop.
                 @return : true if the request succeeded, false otherwise.
                 """
                 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):
                 return func(*args, **kwargs)
 
         def registerObjectEventListener(self, *args, **kwargs):
@@ -63,7 +62,7 @@ class Application(Accessible):
                 being requested. Register with this application toolkit for "Accessibility::Accessible"
                 event notifications.
                 """
                 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):
                 return func(*args, **kwargs)
 
         def registerToolkitEventListener(self, *args, **kwargs):
@@ -78,7 +77,7 @@ class Application(Accessible):
                 Register with this application's toolkit for "toolkit-specific"
                 event notifications.
                 """
                 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):
                 return func(*args, **kwargs)
 
         def resume(self, *args, **kwargs):
@@ -86,7 +85,7 @@ class Application(Accessible):
                 Request that the application resume sending events.
                 @return : True if the request succeeded, False otherwise.
                 """
                 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):
                 return func(*args, **kwargs)
 
         def get_id(self):
@@ -122,6 +121,6 @@ class Application(Accessible):
         version = property(fget=get_version, fset=set_version, doc=_versionDoc)
 
 # Register the accessible class with the factory.
         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----------------------------------------------------------------------------
 
 #END----------------------------------------------------------------------------
index e9aed2b..a5be820 100644 (file)
@@ -12,8 +12,9 @@
 #along with this program; if not, write to the Free Software
 #Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 #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__ = [
 from factory import accessible_factory
 
 __all__ = [
@@ -22,34 +23,34 @@ __all__ = [
 
 #------------------------------------------------------------------------------
 
 
 #------------------------------------------------------------------------------
 
-class Collection(BaseProxy):
+class Collection(Accessible):
 
         def createMatchRule(self, *args, **kwargs):
 
         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):
                 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):
                 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):
                 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):
                 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):
                 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):
                 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):
                 return func(*args, **kwargs)
 
         class MatchType(Enum):
@@ -104,6 +105,6 @@ class Collection(BaseProxy):
         TREE_RESTRICT_SIBLING = TreeTraversalType(1)
 
 # Register the accessible class with the factory.
         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----------------------------------------------------------------------------
 
 #END----------------------------------------------------------------------------
index 1b740c2..cd606db 100644 (file)
 #along with this program; if not, write to the Free Software
 #Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 #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 factory import accessible_factory
-from accessible import BoundingBox
+from accessible import BoundingBox, Accessible
 
 from dbus.types import Int16
 
 
 from dbus.types import Int16
 
@@ -74,7 +74,7 @@ LAYER_WINDOW = ComponentLayer(7)
 
 #------------------------------------------------------------------------------
 
 
 #------------------------------------------------------------------------------
 
-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.
         """
         The Component interface is implemented by objects which occupy
         on-screen space, e.g. objects which have onscreen visual representations.
@@ -92,7 +92,7 @@ class Component(BaseProxy):
                 @return True if the specified point lies within the Component's
                 bounding box, False otherwise.
                 """
                 @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):
                 return func(*args, **kwargs)
 
         def deregisterFocusHandler(self, *args, **kwargs):
@@ -100,7 +100,7 @@ class Component(BaseProxy):
                 Request that an EventListener registered via registerFocusHandler
                 no longer be notified when this object receives keyboard focus.
                 """
                 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):
                 return func(*args, **kwargs)
 
         def getAccessibleAtPoint(self, *args, **kwargs):
@@ -109,7 +109,7 @@ class Component(BaseProxy):
                 specified point.
                 """
                 #TODO this needs a real implementation
                 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):
                 return func(*args, **kwargs)
 
         def getAlpha(self, *args, **kwargs):
@@ -119,7 +119,7 @@ class Component(BaseProxy):
                 alpha value of 0.0 indicates that the object is fully transparent.
                 Negative alpha values have no defined meaning at this time.
                 """
                 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 func(*args, **kwargs)
 
         def getExtents(self, coord_type):
@@ -130,7 +130,7 @@ class Component(BaseProxy):
                 @return a BoundingBox which entirely contains the object's onscreen
                 visual representation.
                 """
                 @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)
 
                 extents = func(Int16(coord_type))
                 return BoundingBox(*extents)
 
@@ -138,7 +138,7 @@ class Component(BaseProxy):
                 """
                 @return the ComponentLayer in which this object resides.
                 """
                 """
                 @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 ComponentLayer(func(*args, **kwargs))
 
         def getMDIZOrder(self):
@@ -150,7 +150,7 @@ class Component(BaseProxy):
                 @return an integer indicating the object's place in the stacking
                 order.
                 """
                 @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):
                 return func()
 
         def getPosition(self, coord_type):
@@ -165,7 +165,7 @@ class Component(BaseProxy):
                 an out parameter which will be back-filled with the returned
                 y coordinate.
                 """
                 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):
                 return func(Int16(coord_type))
 
         def getSize(self, *args, **kwargs):
@@ -178,7 +178,7 @@ class Component(BaseProxy):
                 @param : height
                 the object's vertical extents in the specified coordinate system.
                 """
                 @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 func(*args, **kwargs)
 
         def grabFocus(self, *args, **kwargs):
@@ -187,7 +187,7 @@ class Component(BaseProxy):
                 @return True if keyboard focus was successfully transferred to
                 the Component.
                 """
                 @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):
                 return func(*args, **kwargs)
 
         def registerFocusHandler(self, *args, **kwargs):
@@ -195,10 +195,10 @@ class Component(BaseProxy):
                 Register an EventListener for notification when this object receives
                 keyboard focus.
                 """
                 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.
                 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----------------------------------------------------------------------------
 
 #END----------------------------------------------------------------------------
index 0a2e0e2..1ab2019 100644 (file)
@@ -12,7 +12,7 @@
 #along with this program; if not, write to the Free Software
 #Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 #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
 from base import BaseProxyMeta
 from accessible import BoundingBox
 from state import StateSet
@@ -345,7 +345,7 @@ class Desktop(object):
 
         @property
         def interfaces(self):
 
         @property
         def interfaces(self):
-                return [interfaces.ATSPI_ACCESSIBLE, interfaces.ATSPI_COMPONENT]
+                return [ATSPI_ACCESSIBLE, ATSPI_COMPONENT]
 
         def queryInterface(self, interface):
                 """
 
         def queryInterface(self, interface):
                 """
@@ -353,9 +353,9 @@ class Desktop(object):
                 or raises a NotImplemented error if the given interface
                 is not supported.
                 """
                 or raises a NotImplemented error if the given interface
                 is not supported.
                 """
-                if interface == interfaces.ATSPI_ACCESSIBLE:
+                if interface == ATSPI_ACCESSIBLE:
                                 return self
                                 return self
-                elif interface == interfaces.ATSPI_COMPONENT:
+                elif interface == ATSPI_COMPONENT:
                                 return DesktopComponent()
                 else:
                                 raise NotImplementedError(
                                 return DesktopComponent()
                 else:
                                 raise NotImplementedError(
index 12e2671..be256b6 100644 (file)
@@ -12,8 +12,8 @@
 #along with this program; if not, write to the Free Software
 #Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 #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__ = [
 from factory import accessible_factory
 
 __all__ = [
@@ -22,7 +22,7 @@ __all__ = [
 
 #------------------------------------------------------------------------------
 
 
 #------------------------------------------------------------------------------
 
-class Document(BaseProxy):
+class Document(Accessible):
         """
         Primarily a 'tagging' interface which indicates the start of
         document content in the Accessibility hierarchy. Accessible objects
         """
         Primarily a 'tagging' interface which indicates the start of
         document content in the Accessibility hierarchy. Accessible objects
@@ -44,7 +44,7 @@ class Document(BaseProxy):
                 attribute, or an empty string if the attribute is unspecified
                 for the object.
                 """
                 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 func(*args, **kwargs)
 
         def getAttributes(self, *args, **kwargs):
@@ -55,7 +55,7 @@ class Document(BaseProxy):
                 @return an AttributeSet containing the attributes of the document,
                 as name-value pairs.
                 """
                 @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 func(*args, **kwargs)
 
         def getLocale(self, *args, **kwargs):
@@ -65,10 +65,10 @@ class Document(BaseProxy):
                 @return a string compliant with the POSIX standard for locale
                 description.
                 """
                 @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.
                 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----------------------------------------------------------------------------
 
 #END----------------------------------------------------------------------------
index 084840f..8c9d6a9 100644 (file)
@@ -12,8 +12,7 @@
 #along with this program; if not, write to the Free Software
 #Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 #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 *
 
 from factory import accessible_factory
 from text import *
 
@@ -41,7 +40,7 @@ class EditableText(Text):
                 the offset of the first character past the end of the range of
                 text being copied.
                 """
                 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):
                 return func(*args, **kwargs)
 
         def cutText(self, *args, **kwargs):
@@ -56,7 +55,7 @@ class EditableText(Text):
                 text being cut. 
                 @return True if the text was successfully cut, False otherwise.
                 """
                 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):
                 return func(*args, **kwargs)
 
         def deleteText(self, *args, **kwargs):
@@ -71,7 +70,7 @@ class EditableText(Text):
                 text being deleted. 
                 @return True if the text was successfully deleted, False otherwise.
                 """
                 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 func(*args, **kwargs)
 
         def insertText(self, *args, **kwargs):
@@ -91,7 +90,7 @@ class EditableText(Text):
                 @return True if the text content was successfully inserted, False
                 otherwise.
                 """
                 @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 func(*args, **kwargs)
 
         def pasteText(self, *args, **kwargs):
@@ -103,7 +102,7 @@ class EditableText(Text):
                 @return True if the text was successfully pasted into the Text
                 object, False otherwise.
                 """
                 @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 func(*args, **kwargs)
 
         def setAttributes(self, *args, **kwargs):
@@ -112,7 +111,7 @@ class EditableText(Text):
                 @return True if the text attributes were successfully modified,
                 False otherwise.
                 """
                 @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 func(*args, **kwargs)
 
         def setTextContents(self, *args, **kwargs):
@@ -125,10 +124,10 @@ class EditableText(Text):
                 @return True if the text content was successfully changed, False
                 otherwise.
                 """
                 @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.
                 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----------------------------------------------------------------------------
 
 #END----------------------------------------------------------------------------
index 143984b..a57f646 100644 (file)
@@ -12,8 +12,8 @@
 #along with this program; if not, write to the Free Software
 #Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 #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__ = [
 from factory import accessible_factory
 
 __all__ = [
@@ -22,7 +22,7 @@ __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,
         """
         Instances of Hyperlink are returned by Hypertext objects, and
         are the means by which end users and clients interact with linked,
@@ -48,7 +48,7 @@ class Hyperlink(BaseProxy):
                 ith anchor, or through which the content associated with the
                 ith anchor can be accessed.
                 """
                 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 func(*args, **kwargs)
 
         def getURI(self, *args, **kwargs):
@@ -58,7 +58,7 @@ class Hyperlink(BaseProxy):
                 @return a string corresponding to the URI of the Hyperlink's
                 'ith' anchor, if one exists, or a NIL string otherwise.
                 """
                 @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):
                 return func(*args, **kwargs)
 
         def isValid(self, *args, **kwargs):
@@ -69,7 +69,7 @@ class Hyperlink(BaseProxy):
                 the hyperlink's URI is invalid, or a connection to the resource
                 can not be established.
                 """
                 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):
                 return func(*args, **kwargs)
 
         def get_endIndex(self):
@@ -107,6 +107,6 @@ class Hyperlink(BaseProxy):
         startIndex = property(fget=get_startIndex, fset=set_startIndex, doc=_startIndexDoc)
 
 # Register the accessible class with the factory.
         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----------------------------------------------------------------------------
 
 #END----------------------------------------------------------------------------
index f8e428e..27aebff 100644 (file)
@@ -12,8 +12,8 @@
 #along with this program; if not, write to the Free Software
 #Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 #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__ = [
 from factory import accessible_factory
 
 __all__ = [
@@ -22,7 +22,7 @@ __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 interface used for objects which implement linking between
         multiple resource or content locations, or multiple 'markers'
@@ -39,7 +39,7 @@ class Hypertext(BaseProxy):
                 an integer from 0 to getNLinks() - 1. 
                 @return the Hyperlink in this Hypertext object.
                 """
                 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):
                 return func(*args, **kwargs)
 
         def getLinkIndex(self, *args, **kwargs):
@@ -52,7 +52,7 @@ class Hypertext(BaseProxy):
                 offset characterIndex, or -1 if no Hyperlink is associated with
                 that character offset.
                 """
                 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 func(*args, **kwargs)
 
         def getNLinks(self, *args, **kwargs):
@@ -61,10 +61,10 @@ class Hypertext(BaseProxy):
                 @return the number of Hyperlinks associated with this Hypertext
                 object, as a long integer.
                 """
                 @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.
                 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----------------------------------------------------------------------------
 
 #END----------------------------------------------------------------------------
index 6911692..49c4095 100644 (file)
@@ -13,8 +13,8 @@
 #Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 import dbus
 #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
 
 from factory import accessible_factory
 from accessible import BoundingBox
 
@@ -24,7 +24,7 @@ __all__ = [
 
 #------------------------------------------------------------------------------
 
 
 #------------------------------------------------------------------------------
 
-class Image(BaseProxy):
+class Image(Accessible):
         """
         An interface implemented by objects which render image data or
         pictorial information to the screen. When onscreen components
         """
         An interface implemented by objects which render image data or
         pictorial information to the screen. When onscreen components
@@ -48,7 +48,7 @@ class Image(BaseProxy):
                 to the containing window. 
                 @return a BoundingBox enclosing the image's onscreen representation.
                 """
                 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):
                 return BoundingBox(*func(dbus.Int16(coordType)))
 
         def getImagePosition(self, *args, **kwargs):
@@ -65,7 +65,7 @@ class Image(BaseProxy):
                 to the screen; if 1, they are returned relative to the containing
                 window.
                 """
                 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):
                 return func(*args, **kwargs)
 
         def getImageSize(self, *args, **kwargs):
@@ -81,7 +81,7 @@ class Image(BaseProxy):
                 Back-filled with the y extents of the onscreen image (i.e. the
                 image height in pixels)
                 """
                 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):
                 return func(*args, **kwargs)
 
         def get_imageDescription(self):
@@ -107,6 +107,6 @@ class Image(BaseProxy):
         imageLocale = property(fget=get_imageLocale, fset=set_imageLocale, doc=_imageLocaleDoc)
 
 # Register the accessible class with the factory.
         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----------------------------------------------------------------------------
 
 #END----------------------------------------------------------------------------
index 13e17bb..a8b5183 100644 (file)
@@ -12,8 +12,9 @@
 #along with this program; if not, write to the Free Software
 #Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 #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__ = [
 from factory import accessible_factory
 
 __all__ = [
@@ -22,7 +23,7 @@ __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'
         """
         An interface for use by assistive technologies by which they
         can access system information and services on a 'need to know'
@@ -67,7 +68,7 @@ class LoginHelper(BaseProxy):
                 device I/O required in order to facilitate end-user access to
                 the system.
                 """
                 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):
                 return func(*args, **kwargs)
 
         def getRaiseWindows(self, *args, **kwargs):
@@ -79,7 +80,7 @@ class LoginHelper(BaseProxy):
                 order for the LoginHelper to facilitate end-user access to the
                 system.
                 """
                 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):
                 return func(*args, **kwargs)
 
         def setSafe(self, *args, **kwargs):
@@ -98,7 +99,7 @@ class LoginHelper(BaseProxy):
                 when in "safe" mode.
                 @return : whether the LoginHelper is now "safe" or not.
                 """
                 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):
                 return func(*args, **kwargs)
 
         class DeviceReq(Enum):
@@ -141,6 +142,6 @@ class LoginHelper(BaseProxy):
                 winID = property(fget=_get_winID, fset=_set_winID)
 
 # Register the accessible class with the factory.
                 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----------------------------------------------------------------------------
 
 #END----------------------------------------------------------------------------
index 6a201a8..de665db 100644 (file)
@@ -12,8 +12,8 @@
 #along with this program; if not, write to the Free Software
 #Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 #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__ = [
 from factory import accessible_factory
 
 __all__ = [
@@ -22,7 +22,7 @@ __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.
         """
         An interface which indicates that an object exposes a 'selection'
         model, allowing the selection of one or more of its children.
@@ -41,7 +41,7 @@ class Selection(BaseProxy):
                 @return True if the selections were successfully cleared, False
                 otherwise.
                 """
                 @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):
                 return func(*args, **kwargs)
 
         def deselectChild(self, *args, **kwargs):
@@ -54,7 +54,7 @@ class Selection(BaseProxy):
                 to be selected.
                 @return True if the child was successfully selected, False otherwise.
                 """
                 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 func(*args, **kwargs)
 
         def deselectSelectedChild(self, *args, **kwargs):
@@ -68,7 +68,7 @@ class Selection(BaseProxy):
                 @return True if the child was successfully deselected, False
                 otherwise.
                 """
                 @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 func(*args, **kwargs)
 
         def getSelectedChild(self, *args, **kwargs):
@@ -80,7 +80,7 @@ class Selection(BaseProxy):
                 @return a pointer to a selected Accessible child object, specified
                 by selectedChildIndex.
                 """
                 @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 func(*args, **kwargs)
 
         def isChildSelected(self, *args, **kwargs):
@@ -93,7 +93,7 @@ class Selection(BaseProxy):
                 @return True if the specified child is currently selected, False
                 otherwise.
                 """
                 @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):
                 return func(*args, **kwargs)
 
         def selectAll(self, *args, **kwargs):
@@ -104,7 +104,7 @@ class Selection(BaseProxy):
                 support this operation).
                 @return True if successful, False otherwise.
                 """
                 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):
                 return func(*args, **kwargs)
 
         def selectChild(self, *args, **kwargs):
@@ -115,7 +115,7 @@ class Selection(BaseProxy):
                 be selected.
                 @return True if the child was successfully selected, False otherwise.
                 """
                 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):
                 return func(*args, **kwargs)
 
         def get_nSelectedChildren(self):
@@ -130,6 +130,6 @@ class Selection(BaseProxy):
         nSelectedChildren = property(fget=get_nSelectedChildren, fset=set_nSelectedChildren, doc=_nSelectedChildrenDoc)
 
 # Register the accessible class with the factory.
         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----------------------------------------------------------------------------
 
 #END----------------------------------------------------------------------------
index ceed7ff..a4916c0 100644 (file)
@@ -12,8 +12,9 @@
 #along with this program; if not, write to the Free Software
 #Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 #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 base import BaseProxy, Enum
+from accessible import Accessible
 from factory import accessible_factory
 
 __all__ = [
 from factory import accessible_factory
 
 __all__ = [
@@ -58,12 +59,12 @@ class CommandListener(BaseProxy):
                 The newly-available list of Command objects which may be invoked
                 by the listener.
                 """
                 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)
 
 #------------------------------------------------------------------------------
 
                 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
         """
         This interface is intended for use by assistive technologies
         and related user-agents. Via this interface, an assistive technology
@@ -85,7 +86,7 @@ class Selector(BaseProxy):
                 and the reason for failure if the Command could not be activated
                 or invoked.
                 """
                 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):
                 return func(*args, **kwargs)
 
         def deregisterChangeListener(self, *args, **kwargs):
@@ -95,7 +96,7 @@ class Selector(BaseProxy):
                 @param : listener
                 the CommandListener to remove from the notification list.
                 """
                 @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):
                 return func(*args, **kwargs)
 
         def getCommands(self, *args, **kwargs):
@@ -103,7 +104,7 @@ class Selector(BaseProxy):
                 Query the Selector for the current CommandList.
                 @return the currently available CommandList
                 """
                 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):
                 return func(*args, **kwargs)
 
         def refreshCommands(self, *args, **kwargs):
@@ -111,7 +112,7 @@ class Selector(BaseProxy):
                 Ask the Selector to re-calculate its CommandList. 
                 @return TRUE if the CommandList changed.
                 """
                 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):
                 return func(*args, **kwargs)
 
         def registerChangeListener(self, *args, **kwargs):
@@ -121,7 +122,7 @@ class Selector(BaseProxy):
                 @param : listener
                 the CommandListener to be notified of changes.
                 """
                 @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 func(*args, **kwargs)
 
         def replaceCommands(self, *args, **kwargs):
@@ -129,7 +130,7 @@ class Selector(BaseProxy):
                 @return TRUE if the replacement request was successful, FALSE
                 if the request could not be honored.
                 """
                 @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):
                 return func(*args, **kwargs)
 
         def get_supportsReplace(self):
@@ -163,6 +164,6 @@ class Selector(BaseProxy):
         COMMAND_RESULT_SUCCESS = CommandResult(1)
 
 # Register the accessible class with the factory.
         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----------------------------------------------------------------------------
 
 #END----------------------------------------------------------------------------
index 70c5004..1a52bc4 100644 (file)
@@ -12,8 +12,9 @@
 #along with this program; if not, write to the Free Software
 #Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 #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 base import BaseProxy, Enum
+from accessible import Accessible
 from factory import accessible_factory
 
 __all__ = [
 from factory import accessible_factory
 
 __all__ = [
@@ -35,7 +36,7 @@ class ContentStream(BaseProxy):
                 not perform further operations on a StreamableContent::Stream
                 object after closing it.
                 """
                 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):
                 return func(*args, **kwargs)
 
         def read(self, *args, **kwargs):
@@ -43,7 +44,7 @@ class ContentStream(BaseProxy):
                 Request/read a specified amount of data from a Stream. 
                 @return the number of bytes actually read into the client buffer.
                 """
                 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):
                 return func(*args, **kwargs)
 
         def seek(self, *args, **kwargs):
@@ -59,7 +60,7 @@ class ContentStream(BaseProxy):
                 exception will be raised. 
                 @return the actual resulting offset, if no exception was raised.
                 """
                 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):
                 return func(*args, **kwargs)
 
         class IOError(Exception):
@@ -90,7 +91,7 @@ class ContentStream(BaseProxy):
 
 #------------------------------------------------------------------------------
 
 
 #------------------------------------------------------------------------------
 
-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.
         """
         An interface whereby an object allows its backing content to
         be streamed to clients. Negotiation of content type is allowed.
@@ -103,7 +104,7 @@ class StreamableContent(BaseProxy):
                 """
                 DEPRECATED, use getStream instead.
                 """
                 """
                 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):
                 return func(*args, **kwargs)
 
         def getContentTypes(self, *args, **kwargs):
@@ -111,7 +112,7 @@ class StreamableContent(BaseProxy):
                 getContentTypes: 
                 @return the list of available mimetypes for this object's content.
                 """
                 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 func(*args, **kwargs)
 
         def getStream(self, *args, **kwargs):
@@ -123,7 +124,7 @@ class StreamableContent(BaseProxy):
                 @return a Stream whose mimetype matches contentType, if available,
                 or NIL.
                 """
                 @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 func(*args, **kwargs)
 
         def getURI(self, *args, **kwargs):
@@ -138,10 +139,10 @@ class StreamableContent(BaseProxy):
                 @return a string which constitutes a URI for a stream of the
                 specified content type, or NULL if no such URI can be obtained.
                 """
                 @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.
                 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----------------------------------------------------------------------------
 
 #END----------------------------------------------------------------------------
index 549b54e..7034e4d 100644 (file)
@@ -12,8 +12,8 @@
 #along with this program; if not, write to the Free Software
 #Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 #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__ = [
 from factory import accessible_factory
 
 __all__ = [
@@ -22,7 +22,7 @@ __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
         """
         An interface used by containers whose contained data is arranged
         in a "tabular" (i.e. row-column) fashion. Tables may resemble
@@ -46,7 +46,7 @@ class Table(BaseProxy):
                 @return True if the specified column was successfully selected,
                 False if not.
                 """
                 @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 func(*args, **kwargs)
 
         def addRowSelection(self, *args, **kwargs):
@@ -57,7 +57,7 @@ class Table(BaseProxy):
                 @return True if the specified row was successfully selected,
                 False if not.
                 """
                 @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 func(*args, **kwargs)
 
         def getAccessibleAt(self, *args, **kwargs):
@@ -70,7 +70,7 @@ class Table(BaseProxy):
                 @return an Accessible object representing the specified table
                 cell.
                 """
                 @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 func(*args, **kwargs)
 
         def getColumnAtIndex(self, *args, **kwargs):
@@ -82,7 +82,7 @@ class Table(BaseProxy):
                 @return a long integer indicating the first column spanned by
                 the child of a table, at the specified 1-D (zero-offset) index.
                 """
                 @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 func(*args, **kwargs)
 
         def getColumnDescription(self, *args, **kwargs):
@@ -94,7 +94,7 @@ class Table(BaseProxy):
                 @return a UTF-8 string describing the specified table column,
                 if available.
                 """
                 @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 func(*args, **kwargs)
 
         def getColumnExtentAt(self, *args, **kwargs):
@@ -109,7 +109,7 @@ class Table(BaseProxy):
                 @return a long integer indicating the number of columns spanned
                 by the specified cell.
                 """
                 @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 func(*args, **kwargs)
 
         def getColumnHeader(self, *args, **kwargs):
@@ -122,7 +122,7 @@ class Table(BaseProxy):
                 @return an Accessible representatin of the specified table column,
                 if available.
                 """
                 @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 func(*args, **kwargs)
 
         def getIndexAt(self, *args, **kwargs):
@@ -136,7 +136,7 @@ class Table(BaseProxy):
                 @return a long integer which serves as the index of a specified
                 cell in the table, in a form usable by Accessible::getChildAtIndex.
                 """
                 @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 func(*args, **kwargs)
 
         def getRowAtIndex(self, *args, **kwargs):
@@ -148,7 +148,7 @@ class Table(BaseProxy):
                 @return a long integer indicating the first row spanned by the
                 child of a table, at the specified 1-D (zero-offset) index.
                 """
                 @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):
                 return func(*args, **kwargs)
 
         def getRowColumnExtentsAtIndex(self, *args, **kwargs):
@@ -187,7 +187,7 @@ class Table(BaseProxy):
                 False if the index does not correspond to a cell. If False is
                 returned, the values of the out parameters are undefined.
                 """
                 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 func(*args, **kwargs)
 
         def getRowDescription(self, *args, **kwargs):
@@ -199,7 +199,7 @@ class Table(BaseProxy):
                 @return a UTF-8 string describing the specified table row, if
                 available.
                 """
                 @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 func(*args, **kwargs)
 
         def getRowExtentAt(self, *args, **kwargs):
@@ -214,7 +214,7 @@ class Table(BaseProxy):
                 @return a long integer indicating the number of rows spanned
                 by the specified cell.
                 """
                 @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 func(*args, **kwargs)
 
         def getRowHeader(self, *args, **kwargs):
@@ -226,7 +226,7 @@ class Table(BaseProxy):
                 @return an Accessible representatin of the specified table row,
                 if available.
                 """
                 @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 func(*args, **kwargs)
 
         def getSelectedColumns(self, *args, **kwargs):
@@ -235,7 +235,7 @@ class Table(BaseProxy):
                 @return a sequence of integers comprising the indices of columns
                 currently selected.
                 """
                 @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 func(*args, **kwargs)
 
         def getSelectedRows(self, *args, **kwargs):
@@ -244,7 +244,7 @@ class Table(BaseProxy):
                 @return a sequence of integers comprising the indices of rows
                 currently selected.
                 """
                 @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 func(*args, **kwargs)
 
         def isColumnSelected(self, *args, **kwargs):
@@ -255,7 +255,7 @@ class Table(BaseProxy):
                 @return True if the specified column is currently selected, False
                 if not.
                 """
                 @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 func(*args, **kwargs)
 
         def isRowSelected(self, *args, **kwargs):
@@ -266,7 +266,7 @@ class Table(BaseProxy):
                 @return True if the specified row is currently selected, False
                 if not.
                 """
                 @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 func(*args, **kwargs)
 
         def isSelected(self, *args, **kwargs):
@@ -279,7 +279,7 @@ class Table(BaseProxy):
                 @return True if the specified cell is currently selected, False
                 if not.
                 """
                 @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 func(*args, **kwargs)
 
         def removeColumnSelection(self, *args, **kwargs):
@@ -290,7 +290,7 @@ class Table(BaseProxy):
                 @return True if the specified column was successfully de-selected,
                 False if not.
                 """
                 @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 func(*args, **kwargs)
 
         def removeRowSelection(self, *args, **kwargs):
@@ -301,7 +301,7 @@ class Table(BaseProxy):
                 @return True if the specified row was successfully de-selected,
                 False if not.
                 """
                 @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):
                 return func(*args, **kwargs)
 
         def get_caption(self):
@@ -374,6 +374,6 @@ class Table(BaseProxy):
         summary = property(fget=get_summary, fset=set_summary, doc=_summaryDoc)
 
 # Register the accessible class with the factory.
         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----------------------------------------------------------------------------
 
 #END----------------------------------------------------------------------------
index ed6c5f5..ef22f88 100644 (file)
@@ -14,8 +14,9 @@
 
 import dbus
 
 
 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__ = [
 from factory import accessible_factory
 
 __all__ = [
@@ -73,7 +74,7 @@ TEXT_CLIP_NONE = TEXT_CLIP_TYPE(0)
 
 #------------------------------------------------------------------------------
 
 
 #------------------------------------------------------------------------------
 
-class Text(BaseProxy):
+class Text(Accessible):
         """
         The text interface should be implemented by objects which place
         textual information onscreen as character strings or glyphs.
         """
         The text interface should be implemented by objects which place
         textual information onscreen as character strings or glyphs.
@@ -112,7 +113,7 @@ class Text(BaseProxy):
                 other reasons (for instance if the user does not have permission
                 to copy the text into the relevant selection buffer).
                 """
                 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 func(*args, **kwargs)
 
         def getAttributeRun(self, *args, **kwargs):
@@ -164,7 +165,7 @@ class Text(BaseProxy):
                 @return the AttributeSet defined at offset, optionally including
                 the 'default' attributes.
                 """
                 @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 func(*args, **kwargs)
 
         def getAttributeValue(self, *args, **kwargs):
@@ -189,7 +190,7 @@ class Text(BaseProxy):
                 @return the value of attribute (name-value pair) corresponding
                 to "name", if defined.
                 """
                 @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 func(*args, **kwargs)
 
         def getAttributes(self, offset):
@@ -198,7 +199,7 @@ class Text(BaseProxy):
                 @return the attributes at offset, as a semicolon-delimited set
                 of colon-delimited name-value pairs.
                 """
                 @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):
                 return func(dbus.Int32(offset))
 
         def getBoundedRanges(self, *args, **kwargs):
@@ -229,7 +230,7 @@ class Text(BaseProxy):
                 determines whether text which intersects the bounding box in
                 the y direction is included.
                 """
                 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):
                 return func(*args, **kwargs)
 
         def getCharacterAtOffset(self, *args, **kwargs):
@@ -238,7 +239,7 @@ class Text(BaseProxy):
                 UCS-4 representation of the character at the specified text offset,
                 or 0 if offset is out of range.
                 """
                 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):
                 return func(*args, **kwargs)
 
         def getCharacterExtents(self, *args, **kwargs):
@@ -272,7 +273,7 @@ class Text(BaseProxy):
                 window, with the x axis pointing right and the y axis pointing
                 down.
                 """
                 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):
                 return func(*args, **kwargs)
 
         def getDefaultAttributeSet(self, *args, **kwargs):
@@ -286,7 +287,7 @@ class Text(BaseProxy):
                 whereas an object whose text weight is inspecified may report
                 the default or implied text weight in the default AttributeSet.
                 """
                 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 func(*args, **kwargs)
 
         def getDefaultAttributes(self, *args, **kwargs):
@@ -295,7 +296,7 @@ class Text(BaseProxy):
                 @return the attributes which apply to the entire text content,
                 but which were not explicitly specified by the content creator.
                 """
                 @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 func(*args, **kwargs)
 
         def getNSelections(self, *args, **kwargs):
@@ -310,7 +311,7 @@ class Text(BaseProxy):
                 @return the number of contiguous selections in the current Text
                 object.
                 """
                 @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):
                 return func(*args, **kwargs)
 
         def getOffsetAtPoint(self, *args, **kwargs):
@@ -328,7 +329,7 @@ class Text(BaseProxy):
                 of the glyph whose onscreen bounds contain the point x,y, or
                 -1 if the point is outside the bounds of any glyph.
                 """
                 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):
                 return func(*args, **kwargs)
 
         def getRangeExtents(self, *args, **kwargs):
@@ -359,7 +360,7 @@ class Text(BaseProxy):
                 corner of the screen; if 1, the coordinates are reported relative
                 to the corner of the containing toplevel window.
                 """
                 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):
                 return func(*args, **kwargs)
 
         def getSelection(self, *args, **kwargs):
@@ -368,7 +369,7 @@ class Text(BaseProxy):
                 (i.e. for a selection which does not exist) is not strictly defined,
                 but should set endOffset equal to startOffset.
                 """
                 (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):
                 return func(*args, **kwargs)
 
         def getText(self, startOffset, endOffset):
@@ -380,7 +381,7 @@ class Text(BaseProxy):
                 startOffset (inclusive) up to but not including the character
                 at 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))
                 if not endOffset:
                         endOffset = -1
                 return func(dbus.Int32(startOffset), dbus.Int32(endOffset))
@@ -410,7 +411,7 @@ class Text(BaseProxy):
                 @return a string which is a substring of the text content of
                 the object, delimited by the specified boundary condition.
                 """
                 @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 func(*args, **kwargs)
 
         def getTextAtOffset(self, *args, **kwargs):
@@ -437,7 +438,7 @@ class Text(BaseProxy):
                 @return a string which is a substring of the text content of
                 the object, delimited by the specified boundary condition.
                 """
                 @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 func(*args, **kwargs)
 
         def getTextBeforeOffset(self, *args, **kwargs):
@@ -464,7 +465,7 @@ class Text(BaseProxy):
                 @return a string which is a substring of the text content of
                 the object, delimited by the specified boundary condition.
                 """
                 @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 func(*args, **kwargs)
 
         def removeSelection(self, *args, **kwargs):
@@ -475,7 +476,7 @@ class Text(BaseProxy):
                 @return True if the selection was successfully removed, False
                 otherwise.
                 """
                 @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 func(*args, **kwargs)
 
         def setCaretOffset(self, *args, **kwargs):
@@ -489,7 +490,7 @@ class Text(BaseProxy):
                 @return TRUE if the request was carried out, or FALSE if the
                 caret could not be moved to the requested position.
                 """
                 @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 func(*args, **kwargs)
 
         def setSelection(self, *args, **kwargs):
@@ -508,7 +509,7 @@ class Text(BaseProxy):
                 @return True if the selection corresponding to selectionNum is
                 successfully modified, False otherwise.
                 """
                 @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):
                 return func(*args, **kwargs)
 
         def get_caretOffset(self):
@@ -565,6 +566,6 @@ class Text(BaseProxy):
                 data = property(fget=_get_data, fset=_set_data)
 
 # Register the accessible class with the factory.
                 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----------------------------------------------------------------------------
 
 #END----------------------------------------------------------------------------
index 73dcd39..32c51fe 100644 (file)
@@ -12,8 +12,8 @@
 #along with this program; if not, write to the Free Software
 #Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 #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__ = [
 from factory import accessible_factory
 
 __all__ = [
@@ -22,7 +22,7 @@ __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.
         """
         An interface supporting controls which allow a one-dimensional,
         scalar quantity to be modified or which reflect a scalar quantity.
@@ -73,6 +73,6 @@ class Value(BaseProxy):
         minimumValue = property(fget=get_minimumValue, fset=set_minimumValue, doc=_minimumValueDoc)
 
 # Register the accessible class with the factory.
         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----------------------------------------------------------------------------
 
 #END----------------------------------------------------------------------------
index fe657e0..19b745b 100644 (file)
@@ -4,7 +4,8 @@ at_spi_registryd_CFLAGS = $(DBUS_GLIB_CFLAGS)   \
                          $(GOBJ_CFLAGS)        \
                          $(ATK_CFLAGS)         \
                          $(GDK_CFLAGS)         \
                          $(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)         \
 
 at_spi_registryd_LDADD = $(DBUS_GLIB_LIBS)     \
                         $(GOBJ_CFLAGS)         \
index bfc8258..3f87a4e 100644 (file)
 #include <gdk/gdkkeysyms.h>
 #include <gdk/gdkwindow.h>
 
 #include <gdk/gdkkeysyms.h>
 #include <gdk/gdkwindow.h>
 
-#include <atk-adaptor/spi-private.h>
 #include <spi-common/keymasks.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 <spi-common/spi-dbus.h>
 #include <spi-common/spi-types.h>
 
+#include <droute/droute.h>
+
 #include "deviceeventcontroller.h"
 #include "reentrant-list.h"
 
 #include "deviceeventcontroller.h"
 #include "reentrant-list.h"
 
@@ -348,7 +347,7 @@ static void emit(SpiDEController *controller, const char *name, int first_type,
   va_list arg;
 
   va_start(arg, first_type);
   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);
 }
 
   va_end(arg);
 }
 
@@ -913,7 +912,7 @@ spi_controller_register_device_listener (SpiDEController      *controller,
 
       controller->key_listeners = g_list_prepend (controller->key_listeners,
                                                  key_listener);
 
       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);    
       if (key_listener->mode->global)
         {
          return spi_controller_register_global_keygrabs (controller, key_listener);    
@@ -923,7 +922,7 @@ spi_controller_register_device_listener (SpiDEController      *controller,
       break;
   case SPI_DEVICE_TYPE_MOUSE:
       controller->mouse_listeners = g_list_prepend (controller->mouse_listeners, 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;
       break;
   default:
       break;
@@ -946,7 +945,7 @@ Accessibility_DeviceEventListener_notifyEvent(SpiDEController *controller,
   {
     // TODO: Evaluate performance: perhaps rework this whole architecture
     // to avoid blocking calls
   {
     // 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;
     if (reply)
     {
       DBusError error;
@@ -1915,7 +1914,7 @@ spi_controller_deregister_device_listener (SpiDEController            *controlle
 {
   RemoveListenerClosure  ctx;
 
 {
   RemoveListenerClosure  ctx;
 
-  ctx.bus = controller->droute->bus;
+  ctx.bus = controller->bus;
   ctx.listener = listener;
 
   spi_re_entrant_list_foreach (&controller->mouse_listeners,
   ctx.listener = listener;
 
   spi_re_entrant_list_foreach (&controller->mouse_listeners,
@@ -1928,7 +1927,7 @@ spi_deregister_controller_key_listener (SpiDEController            *controller,
 {
   RemoveListenerClosure  ctx;
 
 {
   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 */
   ctx.listener = (DEControllerListener *) key_listener;
 
   /* special case, copy keyset from existing controller list entry */
@@ -2687,36 +2686,6 @@ static void wait_for_release_event (XEvent          *event,
   check_release_handler = g_timeout_add (CHECK_RELEASE_DELAY, check_release, &pressed_event);
 }
 
   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" },
 static DRouteMethod dev_methods[] =
 {
   { impl_register_keystroke_listener, "registerKeystrokeListener" },
@@ -2730,27 +2699,23 @@ static DRouteMethod dev_methods[] =
   { NULL, NULL }
 };
 
   { NULL, NULL }
 };
 
-static DRouteMethod intro_methods[] = {
-  {impl_introspect, "Introspect"},
-  {NULL, NULL}
-};
-
 SpiDEController *
 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);
 {
   SpiDEController *dec = g_object_new (SPI_DEVICE_EVENT_CONTROLLER_TYPE, NULL);
+  DRoutePath *path;
 
   dec->registry = g_object_ref (reg);
 
   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 */
 
   spi_dec_init_mouse_listener (dec);
   /* TODO: kill mouse listener on finalize */
index c42fe24..fb00a37 100644 (file)
@@ -43,13 +43,12 @@ G_BEGIN_DECLS
 
 struct _SpiDEController {
        GObject parent;
 
 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 {
 };
 
 typedef struct {
@@ -57,7 +56,9 @@ typedef struct {
 } SpiDEControllerClass;
 
 GType            spi_device_event_controller_get_type (void);
 } 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);
 
 
 void spi_remove_device_listeners (SpiDEController *controller, const char *bus_name);
 
index 4559fd7..3b738af 100644 (file)
 #include "registry.h"
 #include "deviceeventcontroller.h"
 
 #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[] =
 static gchar *dbus_name = NULL;
 
 static GOptionEntry optentries[] =
@@ -40,19 +44,13 @@ static GOptionEntry optentries[] =
   {NULL}
 };
 
   {NULL}
 };
 
-static DBusObjectPathVTable droute_vtable =
-{
-  NULL,
-  &droute_message,
-  NULL, NULL, NULL, NULL
-};
-
 int
 main (int argc, char **argv)
 {
   SpiRegistry *registry;
   SpiDEController *dec;
 int
 main (int argc, char **argv)
 {
   SpiRegistry *registry;
   SpiDEController *dec;
-  DRouteData droute;
+  DRouteContext *droute;
+  gchar *introspection_directory;
 
   GMainLoop *mainloop;
   DBusConnection *bus;
 
   GMainLoop *mainloop;
   DBusConnection *bus;
@@ -80,7 +78,6 @@ main (int argc, char **argv)
 
   dbus_error_init (&error);
   bus = dbus_bus_get(DBUS_BUS_SESSION, &error);
 
   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);
   if (!bus)
   {
     g_warning("Couldn't connect to dbus: %s\n", error.message);
@@ -99,20 +96,16 @@ main (int argc, char **argv)
       g_print ("SpiRegistry daemon is running with well-known name - %s\n", dbus_name);
     }
 
       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 */
   /* 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;
 
   g_main_loop_run (mainloop);
   return 0;
index 60b77a0..51aaa4d 100644 (file)
@@ -230,39 +230,6 @@ handle_disconnection (DBusConnection *bus, DBusMessage *message, void *user_data
 /*---------------------------------------------------------------------------*/
 
 static DBusHandlerResult
 /*---------------------------------------------------------------------------*/
 
 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);
 signal_filter (DBusConnection *bus, DBusMessage *message, void *user_data)
 {
   SpiRegistry *registry = SPI_REGISTRY (user_data);
@@ -283,25 +250,34 @@ signal_filter (DBusConnection *bus, DBusMessage *message, void *user_data)
 static gchar *app_sig_match_name_owner =
        "type='signal', interface='org.freedesktop.DBus', member='NameOwnerChanged'";
 
 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 *
 };
 
 SpiRegistry *
-spi_registry_new (DBusConnection *bus)
+spi_registry_new (DBusConnection *bus, DRouteContext *droute)
 {
   SpiRegistry *reg = g_object_new (SPI_REGISTRY_TYPE, NULL);
 {
   SpiRegistry *reg = g_object_new (SPI_REGISTRY_TYPE, NULL);
+  DRoutePath *path;
 
   reg->bus = bus;
 
 
   reg->bus = bus;
 
-  dbus_connection_register_object_path(bus, SPI_DBUS_PATH_REGISTRY, &reg_vtable, reg);
-
   dbus_bus_add_match (bus, app_sig_match_name_owner, NULL);
   dbus_connection_add_filter (bus, signal_filter, reg, NULL);
 
   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;
 }
 
   return reg;
 }
 
index 87f6bed..68ec403 100644 (file)
@@ -27,6 +27,8 @@
 #include <glib.h>
 #include <glib-object.h>
 
 #include <glib.h>
 #include <glib-object.h>
 
+#include <droute/droute.h>
+
 typedef struct _SpiRegistry SpiRegistry;
 typedef struct _SpiRegistryClass SpiRegistryClass;
 
 typedef struct _SpiRegistry SpiRegistry;
 typedef struct _SpiRegistryClass SpiRegistryClass;
 
@@ -50,7 +52,8 @@ struct _SpiRegistryClass {
 };
 
 GType        spi_registry_get_type (void);
 };
 
 GType        spi_registry_get_type (void);
-SpiRegistry *spi_registry_new      (DBusConnection *bus);
+SpiRegistry *spi_registry_new      (DBusConnection *bus,
+                                    DRouteContext  *droute);
 
 G_END_DECLS
 
 
 G_END_DECLS