* has not found and assume that they need to be leased.
*/
static void
-maybe_lease (AtkObject *obj)
+maybe_lease (GObject *obj)
{
- if (!spi_cache_in (spi_global_cache, G_OBJECT (obj)))
+ if (!spi_cache_in (spi_global_cache, obj))
{
- spi_leasing_take (spi_global_leasing, G_OBJECT (obj));
+ spi_leasing_take (spi_global_leasing, obj);
}
}
*/
void
+spi_object_append_null_reference (DBusMessageIter * iter)
+{
+ DBusMessageIter iter_struct;
+ const char *name;
+ const char *path = SPI_DBUS_PATH_NULL;
+
+ name = dbus_bus_get_unique_name (spi_global_app_data->bus);
+
+ dbus_message_iter_open_container (iter, DBUS_TYPE_STRUCT, NULL,
+ &iter_struct);
+ dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_STRING, &name);
+ dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_OBJECT_PATH, &path);
+ dbus_message_iter_close_container (iter, &iter_struct);
+}
+
+void
spi_object_append_reference (DBusMessageIter * iter, AtkObject * obj)
{
DBusMessageIter iter_struct;
const gchar *name;
gchar *path;
- maybe_lease (obj);
+ if (!obj) {
+ spi_object_append_null_reference (iter);
+ return;
+ }
+
+ maybe_lease (G_OBJECT (obj));
+
+ name = dbus_bus_get_unique_name (spi_global_app_data->bus);
+ path = spi_register_object_to_path (spi_global_register, G_OBJECT (obj));
+
+ if (!path)
+ path = g_strdup (SPI_DBUS_PATH_NULL);
+
+ dbus_message_iter_open_container (iter, DBUS_TYPE_STRUCT, NULL,
+ &iter_struct);
+ dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_STRING, &name);
+ dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_OBJECT_PATH, &path);
+ dbus_message_iter_close_container (iter, &iter_struct);
+
+ g_free (path);
+}
+
+/* TODO: Perhaps combine with spi_object_append_reference. Leaving separate
+ * for now in case we want to use a different path for hyperlinks. */
+void
+spi_hyperlink_append_reference (DBusMessageIter * iter, AtkHyperlink * obj)
+{
+ DBusMessageIter iter_struct;
+ const gchar *name;
+ gchar *path;
+
+ if (!obj) {
+ spi_object_append_null_reference (iter);
+ return;
+ }
+
+ maybe_lease (G_OBJECT (obj));
name = dbus_bus_get_unique_name (spi_global_app_data->bus);
path = spi_register_object_to_path (spi_global_register, G_OBJECT (obj));
spi_object_append_desktop_reference (DBusMessageIter * iter)
{
DBusMessageIter iter_struct;
- const char *name = SPI_DBUS_NAME_REGISTRY;
- const char *path = SPI_DBUS_PATH_ROOT;
+ const char *name = spi_global_app_data->desktop_name;
+ const char *path = spi_global_app_data->desktop_path;
dbus_message_iter_open_container (iter, DBUS_TYPE_STRUCT, NULL,
&iter_struct);
dbus_message_iter_close_container (iter, &iter_struct);
}
-void
-spi_object_append_null_reference (DBusMessageIter * iter)
+DBusMessage *
+spi_object_return_reference (DBusMessage * msg, AtkObject * obj)
{
- DBusMessageIter iter_struct;
- const char *name;
- const char *path = "/org/at_spi/null";
+ DBusMessage *reply;
- name = dbus_bus_get_unique_name (spi_global_app_data->bus);
+ reply = dbus_message_new_method_return (msg);
+ if (reply)
+ {
+ DBusMessageIter iter;
+ dbus_message_iter_init_append (reply, &iter);
+ spi_object_append_reference (&iter, obj);
+ }
+ if (obj)
+ g_object_unref (G_OBJECT (obj));
- dbus_message_iter_open_container (iter, DBUS_TYPE_STRUCT, NULL,
- &iter_struct);
- dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_STRING, &name);
- dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_OBJECT_PATH, &path);
- dbus_message_iter_close_container (iter, &iter_struct);
+ return reply;
}
DBusMessage *
-spi_object_return_reference (DBusMessage * msg, AtkObject * obj)
+spi_hyperlink_return_reference (DBusMessage * msg, AtkHyperlink * obj)
{
DBusMessage *reply;
{
DBusMessageIter iter;
dbus_message_iter_init_append (reply, &iter);
- spi_object_append_reference (&iter, obj);
+ spi_hyperlink_append_reference (&iter, obj);
}
- g_object_unref (G_OBJECT (obj));
+ if (obj)
+ g_object_unref (G_OBJECT (obj));
return reply;
}
dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &itf);
}
+ if (atk_object_get_role (obj) == ATK_ROLE_APPLICATION)
+ {
+ itf = SPI_DBUS_INTERFACE_APPLICATION;
+ dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &itf);
+ }
+
if (ATK_IS_COMPONENT (obj))
{
itf = SPI_DBUS_INTERFACE_COMPONENT;
#if 0
if (ATK_IS_STREAMABLE_CONTENT (obj))
{
- itf = "org.freedesktop.atspi.StreamableContent";
+ itf = "org.a11y.atspi.StreamableContent";
dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &itf);
}
#endif
if (ATK_IS_DOCUMENT (obj))
{
- itf = "org.freedesktop.atspi.Collection";
+ itf = "org.a11y.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);