#include <atk/atk.h>
#include <droute/droute.h>
-#include "accessible-register.h"
-#include "accessible-marshaller.h"
-
#include "common/bitarray.h"
#include "common/spi-dbus.h"
#include "common/spi-stateset.h"
+#include "accessible-register.h"
+#include "object.h"
+#include "introspection.h"
+
typedef struct _MatchRulePrivate MatchRulePrivate;
struct _MatchRulePrivate
{
child_interface_p (AtkObject * child, gchar * repo_id)
{
if (!strcasecmp (repo_id, "action"))
- return atk_is_action (child);
+ return ATK_IS_ACTION (child);
if (!strcasecmp (repo_id, "component"))
- return atk_is_component (child);
+ return ATK_IS_COMPONENT (child);
if (!strcasecmp (repo_id, "editabletext"))
- return atk_is_editable_text (child);
+ return ATK_IS_EDITABLE_TEXT (child);
if (!strcasecmp (repo_id, "text"))
- return atk_is_text (child);
+ return ATK_IS_TEXT (child);
if (!strcasecmp (repo_id, "hypertext"))
- return atk_is_hypertext (child);
+ return ATK_IS_HYPERTEXT (child);
if (!strcasecmp (repo_id, "image"))
- return atk_is_image (child);
+ return ATK_IS_IMAGE (child);
if (!strcasecmp (repo_id, "selection"))
- return atk_is_selection (child);
+ return ATK_IS_SELECTION (child);
if (!strcasecmp (repo_id, "table"))
- return atk_is_table (child);
+ return ATK_IS_TABLE (child);
if (!strcasecmp (repo_id, "value"))
- return atk_is_value (child);
+ return ATK_IS_VALUE (child);
if (!strcasecmp (repo_id, "streamablecontent"))
- return atk_is_streamable_content (child);
+ return ATK_IS_STREAMABLE_CONTENT (child);
if (!strcasecmp (repo_id, "document"))
- return atk_is_document (child);
+ return ATK_IS_DOCUMENT (child);
return FALSE;
}
gint i;
gboolean ret = TRUE;
- if (set == NULL)
+ if (set == NULL || set[0] == BITARRAY_SEQ_TERM)
return TRUE;
chs = atk_object_ref_state_set (child);
gint i;
gboolean ret = FALSE;
- if (set == NULL)
+ if (set == NULL || set[0] == BITARRAY_SEQ_TERM)
return TRUE;
chs = atk_object_ref_state_set (child);
gint i;
gboolean ret = TRUE;
- if (set == NULL)
+ if (set == NULL || set[0] == BITARRAY_SEQ_TERM)
return TRUE;
chs = atk_object_ref_state_set (child);
AtkAttribute *attr = g_slist_nth_data (attributes, i);
for (k = 0; k < oa_length; k++)
{
- AtkAttribute *oa_attr = g_slist_nth_data (attributes, i);
+ AtkAttribute *oa_attr = g_slist_nth_data (oa, k);
if (!g_ascii_strcasecmp (oa_attr->name, attr->name) &&
!g_ascii_strcasecmp (oa_attr->value, attr->value))
{
/* Add to the list if it matches */
if (flag && match_interfaces_lookup (obj, mrp)
&& match_states_lookup (obj, mrp)
- && match_roles_lookup (obj, mrp) && match_attributes_lookup (obj, mrp))
+ && match_roles_lookup (obj, mrp) && match_attributes_lookup (obj, mrp)
+ && (max == 0 || kount < max))
{
ls = g_list_append (ls, obj);
kount++;
indexinparent = atk_object_get_index_in_parent (obj);
parent = atk_object_get_parent (obj);
- if (indexinparent > 0)
+ if (indexinparent > 0 && (max == 0 || kount < max))
{
/* there are still some siblings to visit so get the previous sibling
and get it's last descendant.
kount = sort_order_rev_canonical (mrp, ls, kount, max,
nextobj, TRUE, pobj);
}
- else
+ else if (max == 0 || kount < max)
{
/* no more siblings so next node must be the parent */
kount = sort_order_rev_canonical (mrp, ls, kount, max,
static dbus_bool_t
read_mr (DBusMessageIter * iter, MatchRulePrivate * mrp)
{
- DBusMessageIter mrc, arrayc;
+ DBusMessageIter iter_struct, iter_array, iter_dict, iter_dict_entry;
dbus_uint32_t *array;
dbus_int32_t matchType;
int array_count;
const char *str;
char *interfaces = NULL;
- dbus_message_iter_recurse (iter, &mrc);
- dbus_message_iter_recurse (&mrc, &arrayc);
- dbus_message_iter_get_fixed_array (&arrayc, &array, &array_count);
+ dbus_message_iter_recurse (iter, &iter_struct);
+
+ /* states */
+ dbus_message_iter_recurse (&iter_struct, &iter_array);
+ dbus_message_iter_get_fixed_array (&iter_array, &array, &array_count);
bitarray_to_seq (array, array_count, &mrp->states);
for (i = 0; mrp->states[i] != BITARRAY_SEQ_TERM; i++)
{
mrp->states[i] = spi_atk_state_from_spi_state (mrp->states[i]);
}
- dbus_message_iter_next (&mrc);
- dbus_message_iter_get_basic (&mrc, &matchType);
- dbus_message_iter_next (&mrc);
+ dbus_message_iter_next (&iter_struct);
+ dbus_message_iter_get_basic (&iter_struct, &matchType);
+ dbus_message_iter_next (&iter_struct);
mrp->statematchtype = matchType;;
+
/* attributes */
mrp->attributes = NULL;
- if (dbus_message_iter_get_arg_type (&mrc) == DBUS_TYPE_STRING)
+ dbus_message_iter_recurse (&iter_struct, &iter_dict);
+ while (dbus_message_iter_get_arg_type (&iter_dict) != DBUS_TYPE_INVALID)
{
- char *str;
- gchar **attributes;
- gchar **pp;
- dbus_message_iter_get_basic (&mrc, &str);
- attributes = g_strsplit (str, "\n", -1);
- for (pp = attributes; *pp; pp++)
- {
- str = *pp;
- attr = g_new (AtkAttribute, 1);
- if (attr)
- {
- int len = strcspn (str, ":");
- attr->name = g_strndup (str, len);
- if (str[len] == ':')
- {
- len++;
- if (str[len] == ' ')
- len++;
- attr->value = g_strdup (str + len);
- }
- else
- attr->value = NULL;
- mrp->attributes = g_slist_prepend (mrp->attributes, attr);
- }
- }
- g_strfreev (attributes);
- }
- else
- {
- dbus_message_iter_recurse (&mrc, &arrayc);
- while (dbus_message_iter_get_arg_type (&arrayc) != DBUS_TYPE_INVALID)
- {
- dbus_message_iter_get_basic (&arrayc, &str);
- // TODO: remove this print
- g_print ("Got attribute: %s\n", str);
- attr = g_new (AtkAttribute, 1);
- if (attr)
- {
- int len = strcspn (str, ":");
- attr->name = g_strndup (str, len);
- if (str[len] == ':')
- {
- len++;
- if (str[len] == ' ')
- len++;
- attr->value = g_strdup (str + len);
- }
- else
- attr->value = NULL;
- mrp->attributes = g_slist_prepend (mrp->attributes, attr);
- }
- dbus_message_iter_next (&arrayc);
- }
+ const char *key, *val;
+ dbus_message_iter_recurse (&iter_dict, &iter_dict_entry);
+ dbus_message_iter_get_basic (&iter_dict_entry, &key);
+ dbus_message_iter_next (&iter_dict_entry);
+ dbus_message_iter_get_basic (&iter_dict_entry, &val);
+ attr = g_new (AtkAttribute, 1);
+ attr->name = g_strdup (key);
+ attr->value = g_strdup (val);
+ mrp->attributes = g_slist_prepend (mrp->attributes, attr);
+ dbus_message_iter_next (&iter_dict);
}
- dbus_message_iter_next (&mrc);
- dbus_message_iter_get_basic (&mrc, &matchType);
+ dbus_message_iter_next (&iter_struct);
+ dbus_message_iter_get_basic (&iter_struct, &matchType);
mrp->attributematchtype = matchType;;
- dbus_message_iter_next (&mrc);
+ dbus_message_iter_next (&iter_struct);
+
/* Get roles and role match */
- dbus_message_iter_recurse (&mrc, &arrayc);
- dbus_message_iter_get_fixed_array (&arrayc, &array, &array_count);
+ dbus_message_iter_recurse (&iter_struct, &iter_array);
+ dbus_message_iter_get_fixed_array (&iter_array, &array, &array_count);
bitarray_to_seq (array, array_count, &mrp->roles);
- dbus_message_iter_next (&mrc);
- dbus_message_iter_get_basic (&mrc, &matchType);
+ dbus_message_iter_next (&iter_struct);
+ dbus_message_iter_get_basic (&iter_struct, &matchType);
mrp->rolematchtype = matchType;;
- dbus_message_iter_next (&mrc);
+ dbus_message_iter_next (&iter_struct);
+
/* Get interfaces and interface match */
- dbus_message_iter_get_basic (&mrc, &interfaces);
- dbus_message_iter_next (&mrc);
- mrp->ifaces = g_strsplit (interfaces, ";", 0);
- dbus_message_iter_get_basic (&mrc, &matchType);
+ dbus_message_iter_recurse (&iter_struct, &iter_array);
+ mrp->ifaces = g_new0 (gchar *, 16);
+ i = 0;
+ while (i < 15 && dbus_message_iter_get_arg_type (&iter_array) != DBUS_TYPE_INVALID)
+ {
+ char *iface;
+ dbus_message_iter_get_basic (&iter_array, &iface);
+ mrp->ifaces [i] = g_strdup (iface);
+ i++;
+ dbus_message_iter_next (&iter_array);
+ }
+ dbus_message_iter_next (&iter_struct);
+ dbus_message_iter_get_basic (&iter_struct, &matchType);
mrp->interfacematchtype = matchType;;
- dbus_message_iter_next (&mrc);
+ dbus_message_iter_next (&iter_struct);
/* get invert */
- dbus_message_iter_get_basic (&mrc, &mrp->invert);
+ dbus_message_iter_get_basic (&iter_struct, &mrp->invert);
dbus_message_iter_next (iter);
return TRUE;
}
goto oom;
for (item = ls; item; item = g_list_next (item))
{
- spi_dbus_append_name_and_path (message, &iter_array,
- ATK_OBJECT (item->data), TRUE, FALSE);
+ spi_object_append_reference (&iter_array, ATK_OBJECT (item->data));
}
if (!dbus_message_iter_close_container (&iter, &iter_array))
goto oom;
obj = parent;
}
- if (kount < max)
+ if (max == 0 || kount < max)
{
kount = sort_order_canonical (mrp, ls, kount, max,
obj, i + 1, TRUE, FALSE, TRUE, TRUE);
ls = g_list_append (ls, current_object);
- obj = atk_dbus_path_to_object (dbus_message_get_path (message));
+ obj = ATK_OBJECT(spi_register_path_to_object (spi_global_register, dbus_message_get_path (message)));
kount = inorder (obj, mrp, ls, 0, count,
current_object, TRUE, NULL, traverse);
ls = g_list_append (ls, current_object);
- collection = atk_dbus_path_to_object (dbus_message_get_path (message));
+ collection = ATK_OBJECT(spi_register_path_to_object (spi_global_register, dbus_message_get_path (message)));
kount = sort_order_rev_canonical (mrp, ls, 0, count, current_object,
FALSE, collection);
if (recurse)
{
- obj = atk_object_get_parent (current_object);
+ obj = ATK_OBJECT (atk_object_get_parent (current_object));
kount = query_exec (mrp, sortby, ls, 0, count,
obj, 0, TRUE, current_object, TRUE, traverse);
}
else
{
- obj = atk_dbus_path_to_object (dbus_message_get_path (message));
+ obj = ATK_OBJECT (spi_register_path_to_object (spi_global_register, dbus_message_get_path (message)));
kount = query_exec (mrp, sortby, ls, 0, count,
obj, 0, TRUE, current_object, TRUE, traverse);
const char *signature;
signature = dbus_message_get_signature (message);
- if (strcmp (signature, "o(aiisiaiisib)uuib") != 0 &&
- strcmp (signature, "o(aii(as)iaiisib)uuib") != 0)
+ if (strcmp (signature, "o(aiia{ss}iaiiasib)uuib") != 0)
{
return droute_invalid_arguments_error (message);
}
dbus_message_iter_init (message, &iter);
dbus_message_iter_get_basic (&iter, ¤t_object_path);
- current_object = atk_dbus_path_to_object (current_object_path);
+ current_object = ATK_OBJECT (spi_register_path_to_object (spi_global_register, current_object_path));
if (!current_object)
{
// TODO: object-not-found error
const char *signature;
signature = dbus_message_get_signature (message);
- if (strcmp (signature, "o(aiisiaiisib)uubib") != 0 &&
- strcmp (signature, "o(aii(as)iaiisib)uubib") != 0)
+ if (strcmp (signature, "o(aiia{ss}iaiiasib)uubib") != 0)
{
return droute_invalid_arguments_error (message);
}
dbus_message_iter_init (message, &iter);
dbus_message_iter_get_basic (&iter, ¤t_object_path);
- current_object = atk_dbus_path_to_object (current_object_path);
+ current_object = ATK_OBJECT (spi_register_path_to_object (spi_global_register, current_object_path));
if (!current_object)
{
// TODO: object-not-found error
static DBusMessage *
impl_GetMatches (DBusConnection * bus, DBusMessage * message, void *user_data)
{
- AtkObject *obj = atk_dbus_path_to_object (dbus_message_get_path (message));
+ AtkObject *obj = ATK_OBJECT (spi_register_path_to_object (spi_global_register, dbus_message_get_path (message)));
DBusMessageIter iter;
MatchRulePrivate rule;
dbus_uint32_t sortby;
const char *signature;
signature = dbus_message_get_signature (message);
- if (strcmp (signature, "(aiisiaiisib)uib") != 0 &&
- strcmp (signature, "(aii(as)iaiisib)uib") != 0)
+ if (strcmp (signature, "(aiia{ss}iaiiasib)uib") != 0)
{
return droute_invalid_arguments_error (message);
}
spi_initialize_collection (DRoutePath * path)
{
droute_path_add_interface (path,
- SPI_DBUS_INTERFACE_COLLECTION, methods, NULL);
+ SPI_DBUS_INTERFACE_COLLECTION, spi_org_a11y_atspi_Collection, methods, NULL);
};