Add a stub GetItems implementation into at-spi2-registryd
authorMike Gorse <mgorse@novell.com>
Tue, 28 Dec 2010 20:53:12 +0000 (15:53 -0500)
committerMike Gorse <mgorse@novell.com>
Tue, 28 Dec 2010 20:53:12 +0000 (15:53 -0500)
atspi/atspi-misc.c
registryd/paths.h
registryd/registry.c

index 8976abe..62079e4 100644 (file)
@@ -484,7 +484,7 @@ handle_get_items (DBusPendingCall *pending, void *user_data)
   if (dbus_message_get_type (reply) == DBUS_MESSAGE_TYPE_ERROR)
   {
     dbus_message_unref (reply);
-    g_warning ("Atspi: Error in GetItems");
+    g_warning ("Atspi: Error in GetItems, sender=%s", dbus_message_get_sender (reply));
     return;
   }
 
index 61c79f9..913521c 100644 (file)
@@ -39,6 +39,9 @@
 #define SPI_DBUS_INTERFACE_DEC                   SPI_DBUS_INTERFACE_PREFIX "DeviceEventController"
 #define SPI_DBUS_INTERFACE_DEVICE_EVENT_LISTENER SPI_DBUS_INTERFACE_PREFIX "DeviceEventListener"
 
+#define SPI_DBUS_PATH_CACHE                       SPI_DBUS_PATH_PREFIX "cache"
+#define SPI_DBUS_INTERFACE_CACHE                 SPI_DBUS_INTERFACE_PREFIX "Cache"
+
 #define SPI_DBUS_INTERFACE_ACCESSIBLE            SPI_DBUS_INTERFACE_PREFIX "Accessible"
 #define SPI_DBUS_INTERFACE_COMPONENT             SPI_DBUS_INTERFACE_PREFIX "Component"
 #define SPI_DBUS_INTERFACE_EVENT_KEYBOARD        SPI_DBUS_INTERFACE_PREFIX "Keyboard"
index 6a5f4d9..a753ad5 100644 (file)
@@ -795,6 +795,21 @@ impl_GetInterfaces (DBusConnection * bus,
   return reply;
 }
 
+static DBusMessage *
+impl_GetItems (DBusConnection * bus, DBusMessage * message, void *user_data)
+{
+  DBusMessage *reply;
+  DBusMessageIter iter, iter_array;
+
+  reply = dbus_message_new_method_return (message);
+
+  dbus_message_iter_init_append (reply, &iter);
+  dbus_message_iter_open_container (&iter, DBUS_TYPE_ARRAY,
+                                    "((so)(so)(so)a(so)assusau)", &iter_array);
+  dbus_message_iter_close_container (&iter, &iter_array);
+  return reply;
+}
+
 /* I would rather these two be signals, but I'm not sure that dbus-python
  * supports emitting signals except for a service, so implementing as both
  * a method call and signal for now.
@@ -1234,6 +1249,44 @@ handle_method_root (DBusConnection *bus, DBusMessage *message, void *user_data)
 }
 
 static DBusHandlerResult
+handle_method_cache (DBusConnection *bus, DBusMessage *message, void *user_data)
+{
+  DBusHandlerResult result = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+  const gchar *iface   = dbus_message_get_interface (message);
+  const gchar *member  = dbus_message_get_member (message);
+  const gint   type    = dbus_message_get_type (message);
+
+  DBusMessage *reply = NULL;
+
+  /* Check for basic reasons not to handle */
+  if (type   != DBUS_MESSAGE_TYPE_METHOD_CALL ||
+      member == NULL ||
+      iface  == NULL)
+      return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+  if (!strcmp (iface, SPI_DBUS_INTERFACE_CACHE))
+    {
+      result = DBUS_HANDLER_RESULT_HANDLED;
+      if      (!strcmp (member, "GetItems"))
+          reply = impl_GetItems (bus, message, user_data);
+      else
+         result = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+    }
+
+  if (result == DBUS_HANDLER_RESULT_HANDLED)
+    {
+      if (!reply)
+        {
+          reply = dbus_message_new_method_return (message);
+        }
+
+      dbus_connection_send (bus, reply, NULL);
+      dbus_message_unref (reply);
+    }
+}
+
+static DBusHandlerResult
 handle_method_registry (DBusConnection *bus, DBusMessage *message, void *user_data)
 {
   DBusHandlerResult result = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
@@ -1308,6 +1361,13 @@ static DBusObjectPathVTable registry_vtable =
   NULL, NULL, NULL, NULL
 };
 
+static DBusObjectPathVTable cache_vtable =
+{
+  NULL,
+  &handle_method_cache,
+  NULL, NULL, NULL, NULL
+};
+
 static gchar *app_sig_match_name_owner =
        "type='signal', interface='org.freedesktop.DBus', member='NameOwnerChanged'";
 
@@ -1323,6 +1383,8 @@ spi_registry_new (DBusConnection *bus)
 
   dbus_connection_register_object_path (bus, SPI_DBUS_PATH_ROOT, &root_vtable, reg);
 
+  dbus_connection_register_object_path (bus, SPI_DBUS_PATH_CACHE, &cache_vtable, reg);
+
   dbus_connection_register_object_path (bus, SPI_DBUS_PATH_REGISTRY, &registry_vtable, reg);
 
   emit_Available (bus);