[at-spi2-core] Add a stub GetItems implementation into at-spi2-registryd
- From: Mike Gorse <mgorse src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [at-spi2-core] Add a stub GetItems implementation into at-spi2-registryd
- Date: Tue, 28 Dec 2010 20:50:43 +0000 (UTC)
commit 52352f27c9bae49dc09655e44a557e0018997d10
Author: Mike Gorse <mgorse novell com>
Date: Tue Dec 28 15:53:12 2010 -0500
Add a stub GetItems implementation into at-spi2-registryd
atspi/atspi-misc.c | 2 +-
registryd/paths.h | 3 ++
registryd/registry.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 66 insertions(+), 1 deletions(-)
---
diff --git a/atspi/atspi-misc.c b/atspi/atspi-misc.c
index 8976abe..62079e4 100644
--- a/atspi/atspi-misc.c
+++ b/atspi/atspi-misc.c
@@ -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;
}
diff --git a/registryd/paths.h b/registryd/paths.h
index 61c79f9..913521c 100644
--- a/registryd/paths.h
+++ b/registryd/paths.h
@@ -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"
diff --git a/registryd/registry.c b/registryd/registry.c
index 6a5f4d9..a753ad5 100644
--- a/registryd/registry.c
+++ b/registryd/registry.c
@@ -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, ®istry_vtable, reg);
emit_Available (bus);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]