Fix spelling of some function names
authorMike Gorse <mgorse@boston.site>
Wed, 28 May 2008 21:46:44 +0000 (17:46 -0400)
committerMike Gorse <mgorse@boston.site>
Wed, 28 May 2008 21:46:44 +0000 (17:46 -0400)
Move keymasks.h to spi-common
Add impl_desktop_get_children
Add spi_dbus_get_simple_property

atk-adaptor/bridge.c
atk-adaptor/devicelistener.h
atk-adaptor/libspi.h
registryd/desktop.c
registryd/deviceeventcontroller.c
spi-common/spi-dbus.c
spi-common/spi-dbus.h

index 4ba944e..7e72ec5 100644 (file)
@@ -915,7 +915,7 @@ static gboolean Accessibility_DeviceEventController_notifyListenersSync(const Ac
   dbus_bool_t consumed = FALSE;
 
   dbus_error_init(&error);
-  if (spi_dbus_marshall_deviceEvent(message, key_event))
+  if (spi_dbus_marshal_deviceEvent(message, key_event))
   {
     DBusMessage *reply = dbus_connection_send_with_reply_and_block(this_app->droute.bus, message, 1000, &error);
     if (reply)
index 9c9e40d..8446d22 100644 (file)
@@ -27,7 +27,7 @@
 #include <bonobo/bonobo-object.h>
 #include <atk/atkobject.h>
 #include <libspi/Accessibility.h>
-#include <libspi/keymasks.h>
+#include <spi-common/keymasks.h>
 
 G_BEGIN_DECLS
 
index 55732e8..ea0fd42 100644 (file)
@@ -44,7 +44,7 @@
 #include <libspi/listener.h>
 #include <libspi/eventlistener.h>
 #include <libspi/devicelistener.h>
-#include <libspi/keymasks.h>
+#include <spi-common/keymasks.h>
 #include <libspi/remoteobject.h>
 #include <libspi/streamablecontent.h>
 
index be0e5b6..c5e438d 100644 (file)
@@ -216,6 +216,42 @@ impl_desktop_get_child_at_index (DBusConnection *bus, DBusMessage *message, void
   return reply;
 }
 
+static DBusMessage *
+impl_desktop_get_children (DBusConnection *bus, DBusMessage *message, void *user_data)
+{
+  SpiDesktop *desktop = SPI_REGISTRY(user_data)->desktop;
+  DBusError error;
+  gint count;
+  gint i;
+  Application *app;
+  const char *path;
+  DBusMessage *reply;
+  DBusMessageIter iter, iter_array;
+
+  reply = dbus_message_new_method_return (message);
+  if (!reply) return NULL;
+  dbus_message_iter_init_append (reply, &iter);
+  if (!dbus_message_iter_open_container (&iter, DBUS_TYPE_ARRAY, "o", &iter_array))
+  {
+    goto oom;
+  }
+  count = g_list_length (desktop->applications);
+  for (i = 0; i < count; i++)
+  {
+    app = g_list_nth_data (desktop->applications, i);
+    path = (app? app->path: SPI_DBUS_PATH_NULL);
+    dbus_message_iter_append_basic (&iter_array, DBUS_TYPE_OBJECT_PATH, &path);
+  }
+  if (!dbus_message_iter_close_container (&iter, &iter_array))
+  {
+    goto oom;
+  }
+  return reply;
+oom:
+  // TODO: Handle out of memory
+  return reply;
+}
+
 static void
 spi_desktop_exiting (void)
 {
@@ -328,6 +364,7 @@ spi_desktop_remove_application (SpiDesktop *desktop,
 static DRouteMethod methods[] =
 {
   { impl_desktop_get_child_at_index, "getChildAtIndex" },
+  { impl_desktop_get_children, "getChildren" },
   { NULL, NULL }
 };
 
@@ -340,6 +377,6 @@ static DRouteProperty properties[] =
 void
 spi_registry_initialize_desktop_interface (DRouteData * data)
 {
-  droute_add_interface (data, "org.freedesktop.atspi.Desktop", methods,
+  droute_add_interface (data, "org.freedesktop.atspi.Accessible", methods,
                        properties, NULL, NULL);
 };
index 24969f5..2af73ae 100644 (file)
@@ -54,7 +54,7 @@
 #include <gdk/gdkwindow.h>
 
 #include <atk-adaptor/spi-private.h>
-#include <atk-adaptor/keymasks.h>
+#include <spi-common/keymasks.h>
 #include <droute/droute.h>
 #include <spi-common/spi-dbus.h>
 #include <spi-common/spi-types.h>
@@ -941,7 +941,7 @@ static gboolean Accessibility_DeviceEventListener_notifyEvent(SpiRegistry *regis
   dbus_bool_t consumed = FALSE;
 
   dbus_error_init(&error);
-  if (spi_dbus_marshall_deviceEvent(message, key_event))
+  if (spi_dbus_marshal_deviceEvent(message, key_event))
   {
     // TODO: Evaluate performance: perhaps rework this whole architecture
     // to avoid blocking calls
@@ -2474,7 +2474,7 @@ impl_notify_listeners_sync (DBusConnection *bus, DBusMessage *message, void *use
   dbus_bool_t ret;
   DBusMessage *reply;
 
-  if (!spi_dbus_demarshall_deviceEvent(message, &event))
+  if (!spi_dbus_demarshal_deviceEvent(message, &event))
   {
     return spi_dbus_general_error (message);
   }
@@ -2501,7 +2501,7 @@ impl_notify_listeners_async (DBusConnection *bus, DBusMessage *message, void *us
   Accessibility_DeviceEvent event;
   DBusMessage *reply;
 
-  if (!spi_dbus_demarshall_deviceEvent(message, &event))
+  if (!spi_dbus_demarshal_deviceEvent(message, &event))
   {
     return spi_dbus_general_error (message);
   }
index bd099d0..65a6641 100644 (file)
@@ -131,7 +131,7 @@ dbus_bool_t spi_dbus_message_iter_append_struct(DBusMessageIter *iter, ...)
   return TRUE;
 }
 
-dbus_bool_t spi_dbus_marshall_deviceEvent(DBusMessage *message, const Accessibility_DeviceEvent *e)
+dbus_bool_t spi_dbus_marshal_deviceEvent(DBusMessage *message, const Accessibility_DeviceEvent *e)
 {
   DBusMessageIter iter;
 
@@ -140,10 +140,39 @@ dbus_bool_t spi_dbus_marshall_deviceEvent(DBusMessage *message, const Accessibil
   return spi_dbus_message_iter_append_struct(&iter, DBUS_TYPE_UINT32, &e->type, DBUS_TYPE_INT32, &e->id, DBUS_TYPE_INT16, &e->hw_code, DBUS_TYPE_INT16, &e->modifiers, DBUS_TYPE_INT32, &e->timestamp, DBUS_TYPE_STRING, &e->event_string, DBUS_TYPE_BOOLEAN, &e->is_text, DBUS_TYPE_INVALID);
 }
 
-dbus_bool_t spi_dbus_demarshall_deviceEvent(DBusMessage *message, Accessibility_DeviceEvent *e)
+dbus_bool_t spi_dbus_demarshal_deviceEvent(DBusMessage *message, Accessibility_DeviceEvent *e)
 {
   DBusMessageIter iter;
 
   dbus_message_iter_init(message, &iter);
   return spi_dbus_message_iter_get_struct(&iter, DBUS_TYPE_UINT32, &e->type, DBUS_TYPE_INT32, &e->id, DBUS_TYPE_INT16, &e->hw_code, DBUS_TYPE_INT16, &e->modifiers, DBUS_TYPE_INT32, &e->timestamp, DBUS_TYPE_STRING, &e->event_string, DBUS_TYPE_BOOLEAN, &e->is_text, DBUS_TYPE_INVALID);
 }
+
+dbus_bool_t spi_dbus_get_simple_property (DBusConnection *bus, const char *dest, const char *path, const char *interface, const char *prop, int *type, void *ptr, DBusError *error)
+{
+  DBusMessage *message, *reply;
+  DBusMessageIter iter, iter_variant;
+  int typ;
+
+  dbus_error_init (error);
+  message = dbus_message_new_method_call (dest, path, "org.freedesktop.DBus.Properties", "get");
+  if (!message) return FALSE;
+  if (!dbus_message_append_args (message, DBUS_TYPE_STRING, &interface, DBUS_TYPE_STRING, &prop, DBUS_TYPE_INVALID))
+  {
+    return FALSE;
+  }
+  reply = dbus_connection_send_with_reply_and_block (bus, message, 1000, error);
+  dbus_message_unref (message);
+  if (!reply) return FALSE;
+  dbus_message_iter_init (reply, &iter);
+  dbus_message_iter_recurse (&iter, &iter_variant);
+  typ = dbus_message_iter_get_arg_type (&iter_variant);
+  if (type) *type = typ;
+  if (typ == DBUS_TYPE_INVALID || typ == DBUS_TYPE_STRUCT || typ == DBUS_TYPE_ARRAY)
+  {
+    return FALSE;
+  }
+  dbus_message_iter_get_basic (&iter_variant, ptr);
+  dbus_message_unref (reply);
+  return TRUE;
+}
index c8c5489..3215748 100644 (file)
@@ -38,6 +38,7 @@ extern int _dbg;
 #define SPI_DBUS_INTERFACE_DEC "org.freedesktop.atspi.deviceEventController"
 #define SPI_DBUS_PATH_DESKTOP "/org/freedesktop/atspi/registry/desktop"
 #define SPI_DBUS_PATH_NULL "/"
+#define SPI_DBUS_INTERFACE_ACCESSIBLE "org.freedesktop.atspi.Accessible"
 
 DBusMessage *spi_dbus_general_error(DBusMessage *message);
 DBusMessage *spi_dbus_return_rect(DBusMessage *message, gint ix, gint iy, gint iwidth, gint iheight);
@@ -49,5 +50,6 @@ dbus_bool_t spi_dbus_message_iter_get_struct(DBusMessageIter *iter, ...);
 dbus_bool_t spi_dbus_message_iter_append_struct(DBusMessageIter *iter, ...);
 dbus_bool_t spi_dbus_marshall_deviceEvent(DBusMessage *message, const Accessibility_DeviceEvent *e);
 dbus_bool_t spi_dbus_demarshall_deviceEvent(DBusMessage *message, Accessibility_DeviceEvent *e);
+dbus_bool_t spi_dbus_get_simple_property (DBusConnection *bus, const char *dest, const char *path, const char *interface, const char *prop, int *type, void *ptr, DBusError *error);
 
 #endif /* SPI_DBUS_H_ */