diff options
author | Mike Gorse <mgorse@novell.com> | 2010-11-23 18:00:46 -0500 |
---|---|---|
committer | Mike Gorse <mgorse@novell.com> | 2010-11-23 18:00:46 -0500 |
commit | 1261f77b828844e305cbd9fa6e4ad2c2156f8f8a (patch) | |
tree | ab1836bb5430e33441f3ce1c8e9cef2a7ea7ad09 | |
parent | 585683c4e828aaa1dbb883df9274d14753a58088 (diff) | |
download | at-spi2-core-1261f77b828844e305cbd9fa6e4ad2c2156f8f8a.tar.gz |
Add first pass at MatchRule/Collection implementation
-rw-r--r-- | atspi/Makefile.am | 4 | ||||
-rw-r--r-- | atspi/atspi-accessible.c | 2 | ||||
-rw-r--r-- | atspi/atspi-accessible.h | 2 | ||||
-rw-r--r-- | atspi/atspi-collection.c | 296 | ||||
-rw-r--r-- | atspi/atspi-collection.h | 57 | ||||
-rw-r--r-- | atspi/atspi-constants.h | 2 | ||||
-rw-r--r-- | atspi/atspi-matchrule.c | 185 | ||||
-rw-r--r-- | atspi/atspi-matchrule.h | 73 | ||||
-rw-r--r-- | atspi/atspi-misc-private.h | 1 | ||||
-rw-r--r-- | atspi/atspi-misc.c | 1 | ||||
-rw-r--r-- | atspi/atspi-types.h | 2 | ||||
-rw-r--r-- | atspi/atspi.h | 2 |
12 files changed, 624 insertions, 3 deletions
diff --git a/atspi/Makefile.am b/atspi/Makefile.am index 58f2d762..aab0393c 100644 --- a/atspi/Makefile.am +++ b/atspi/Makefile.am @@ -20,6 +20,8 @@ libatspi_la_SOURCES = \ atspi-action.h \ atspi-application.c \ atspi-application.h \ + atspi-collection.c \ + atspi-collection.h \ atspi-component.c \ atspi-component.h \ atspi-constants.h \ @@ -39,6 +41,8 @@ libatspi_la_SOURCES = \ atspi-hypertext.h \ atspi-image.c \ atspi-image.h \ + atspi-matchrule.c \ + atspi-matchrule.h \ atspi-misc.c \ atspi-misc.h \ atspi-misc-private.h \ diff --git a/atspi/atspi-accessible.c b/atspi/atspi-accessible.c index da2b53fe..356e7fe0 100644 --- a/atspi/atspi-accessible.c +++ b/atspi/atspi-accessible.c @@ -836,7 +836,7 @@ AtspiCollection * atspi_accessible_get_collection (AtspiAccessible *accessible) { return (_atspi_accessible_is_a (accessible, atspi_interface_collection) ? - accessible : NULL); + g_object_ref (ATSPI_COLLECTION (accessible)) : NULL); } #endif diff --git a/atspi/atspi-accessible.h b/atspi/atspi-accessible.h index e2a95fef..edb5c1de 100644 --- a/atspi/atspi-accessible.h +++ b/atspi/atspi-accessible.h @@ -96,6 +96,8 @@ AtspiAccessible * atspi_accessible_get_host_application (AtspiAccessible *obj, G AtspiAction * atspi_accessible_get_action (AtspiAccessible *obj); +AtspiCollection * atspi_accessible_get_collection (AtspiAccessible *obj); + AtspiComponent * atspi_accessible_get_component (AtspiAccessible *obj); AtspiDocument * atspi_accessible_get_document (AtspiAccessible *obj); diff --git a/atspi/atspi-collection.c b/atspi/atspi-collection.c new file mode 100644 index 00000000..9841369e --- /dev/null +++ b/atspi/atspi-collection.c @@ -0,0 +1,296 @@ +/* + * AT-SPI - Assistive Technology Service Provider Interface + * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap) + * + * Copyright 2007 IBM Corp. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "atspi-private.h" + +/* TODO: Improve documentation and implement some missing functions */ + +/** + * atspi_collection_is_ancester_of: + * + * @collection: The #AtspiCollection to test against. + * @test: The #AtspiAccessible to test. + * + * Returns: TRUE if @collection is an ancestor of @test; FALSE otherwise. + * + * Not yet implemented. + **/ +gboolean +atspi_collection_is_ancestor_of (AtspiCollection *collection, + AtspiAccessible *test, + GError **error) +{ + g_warning ("Atspi: TODO: Implement is_ancester_of"); + return FALSE; +} + +static DBusMessage * +new_message (AtspiCollection *collection, char *method) +{ + AtspiAccessible *accessible; + + if (!collection) + return NULL; + + accessible = ATSPI_ACCESSIBLE (collection); + return dbus_message_new_method_call (accessible->parent.app->bus_name, + accessible->parent.path, + atspi_interface_collection, + method); +} + +static gboolean +append_match_rule (DBusMessage *message, AtspiMatchRule *rule) +{ + DBusMessageIter iter; + + dbus_message_iter_init_append (message, &iter); + return _atspi_match_rule_marshal (&iter, rule); +} + +static gboolean +append_accessible (DBusMessage *message, AtspiAccessible *accessible) +{ + DBusMessageIter iter, iter_struct; + + dbus_message_iter_init_append (message, &iter); + dbus_message_iter_open_container (&iter, DBUS_TYPE_STRUCT, NULL, &iter_struct); + dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_STRING, + &accessible->parent.app->bus_name); + dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_OBJECT_PATH, + &accessible->parent.path); +} + +static GArray * +return_accessibles (DBusMessage *message) +{ + DBusMessageIter iter, iter_array; + GArray *ret = g_array_new (TRUE, TRUE, sizeof (AtspiAccessible *)); + + _ATSPI_DBUS_CHECK_SIG (message, "(so)", NULL); + + dbus_message_iter_init (message, &iter); + dbus_message_iter_recurse (&iter, &iter_array); + + while (dbus_message_iter_get_arg_type (&iter_array) != DBUS_TYPE_INVALID) + { + AtspiAccessible *accessible; + GArray *new_array; + accessible = _atspi_dbus_return_accessible_from_iter (&iter_array); + new_array = g_array_append_val (ret, accessible); + if (new_array) + ret = new_array; + dbus_message_iter_next (&iter_array); + } + dbus_message_unref (message); + return ret; +} + +/** + * atspi_collection_get_matches: + * + * @collection: The #AtspiCollection. + * @rule: A #AtspiMatchRule describing the match criteria. + * @sortby: An #AtspiCollectionSortOrder specifying the way the results are to + * be sorted. + * @count: The maximum number of results to return, or 0 for no limit. + * @traverse: TODO + * + * Returns: (element-type AtspiAccessible*) (transfer full): A #GArray of + * #AtspiAccessibles matching the given match rule. + **/ +GArray * +atspi_collection_get_matches (AtspiCollection *collection, + AtspiMatchRule *rule, + AtspiCollectionSortOrder sortby, + gint count, + gboolean traverse, + GError **error) +{ + DBusMessage *message = new_message (collection, "GetMatches"); + DBusMessage *reply; + dbus_int32_t d_sortby = sortby; + dbus_int32_t d_count = count; + dbus_bool_t d_traverse = traverse; + + if (!message) + return NULL; + + if (!append_match_rule (message, rule)) + return NULL; + dbus_message_append_args (message, DBUS_TYPE_INT32, &d_sortby, + DBUS_TYPE_INT32, &d_count, + DBUS_TYPE_BOOLEAN, &d_traverse, + DBUS_TYPE_INVALID); + reply = _atspi_dbus_send_with_reply_and_block (message); + if (!reply) + return NULL; + return return_accessibles (reply); +} + +/** + * atspi_collection_get_matches_to: + * + * @collection: The #AtspiCollection. + * @current_object: The object at which to start searching. + * @rule: A #AtspiMatchRule describing the match criteria. + * @sortby: An #AtspiCollectionSortOrder specifying the way the results are to + * be sorted. + * @tree: An #AtspiCollectionTreeTraversalType specifying restrictions on + * the objects to be traversed. + * @recurse: TODO + * @count: The maximum number of results to return, or 0 for no limit. + * @traverse: TODO + * + * Returns: (element-type AtspiAccessible*) (transfer full): A #GArray of + * #AtspiAccessibles matching the given match rule after + * @current_object. + **/ +GArray * +atspi_collection_get_matches_to (AtspiCollection *collection, + AtspiAccessible *current_object, + AtspiMatchRule *rule, + AtspiCollectionSortOrder sortby, + AtspiCollectionTreeTraversalType tree, + gboolean recurse, + gint count, + gboolean traverse, + GError **error) +{ + DBusMessage *message = new_message (collection, "GetMatchesTo"); + DBusMessage *reply; + dbus_int32_t d_sortby = sortby; + dbus_int32_t d_tree = tree; + dbus_bool_t d_recurse = recurse; + dbus_int32_t d_count = count; + dbus_bool_t d_traverse = traverse; + + if (!message) + return NULL; + + if (!append_accessible (message, current_object)) + return NULL; + if (!append_match_rule (message, rule)) + return NULL; + dbus_message_append_args (message, DBUS_TYPE_INT32, &d_sortby, + DBUS_TYPE_INT32, &d_tree, + DBUS_TYPE_BOOLEAN, &d_recurse, + DBUS_TYPE_INT32, &d_count, + DBUS_TYPE_BOOLEAN, &d_traverse, + DBUS_TYPE_INVALID); + reply = _atspi_dbus_send_with_reply_and_block (message); + if (!reply) + return NULL; + return return_accessibles (reply); +} + +/** + * atspi_collection_get_matches_from: + * + * @collection: The #AtspiCollection. + * @current_object: Upon reaching this object, searching should stop. + * @rule: A #AtspiMatchRule describing the match criteria. + * @sortby: An #AtspiCollectionSortOrder specifying the way the results are to + * be sorted. + * @tree: An #AtspiCollectionTreeTraversalType specifying restrictions on + * the objects to be traversed. + * @count: The maximum number of results to return, or 0 for no limit. + * @traverse: TODO + * + * Returns: (element-type AtspiAccessible*) (transfer full): A #GArray of + * #AtspiAccessibles matching the given match rule that preceed + * @current_object. + **/ +GArray * +atspi_collection_get_matches_from (AtspiCollection *collection, + AtspiAccessible *current_object, + AtspiMatchRule *rule, + AtspiCollectionSortOrder sortby, + AtspiCollectionTreeTraversalType tree, + gint count, + gboolean traverse, + GError **error) +{ + DBusMessage *message = new_message (collection, "GetMatchesFrom"); + DBusMessage *reply; + dbus_int32_t d_sortby = sortby; + dbus_int32_t d_tree = tree; + dbus_int32_t d_count = count; + dbus_bool_t d_traverse = traverse; + + if (!message) + return NULL; + + if (!append_accessible (message, current_object)) + return NULL; + if (!append_match_rule (message, rule)) + return NULL; + dbus_message_append_args (message, DBUS_TYPE_INT32, &d_sortby, + DBUS_TYPE_INT32, &d_tree, + DBUS_TYPE_INT32, &d_count, + DBUS_TYPE_BOOLEAN, &d_traverse, + DBUS_TYPE_INVALID); + reply = _atspi_dbus_send_with_reply_and_block (message); + if (!reply) + return NULL; + return return_accessibles (reply); +} + +/** + * atspi_collection_get_active_descendant: + * + * @collection: The #AtspiCollection to query. + * + * Returns: (transfer full): The active descendant of #collection. + * + * Not yet implemented. + **/ +AtspiAccessible * +atspi_collection_get_active_descendant (AtspiCollection *collection, GError **error) +{ + g_warning ("atspi: TODO: Implement get_active_descendants"); + return NULL; +} + +static void +atspi_collection_base_init (AtspiCollection *klass) +{ +} + +GType +atspi_collection_get_type (void) +{ + static GType type = 0; + + if (!type) { + static const GTypeInfo tinfo = + { + sizeof (AtspiCollection), + (GBaseInitFunc) atspi_collection_base_init, + (GBaseFinalizeFunc) NULL, + }; + + type = g_type_register_static (G_TYPE_INTERFACE, "AtspiCollection", &tinfo, 0); + + } + return type; +} diff --git a/atspi/atspi-collection.h b/atspi/atspi-collection.h new file mode 100644 index 00000000..f0a54c29 --- /dev/null +++ b/atspi/atspi-collection.h @@ -0,0 +1,57 @@ +/* + * AT-SPI - Assistive Technology Service Provider Interface + * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap) + * + * Copyright 2002 Ximian, Inc. + * 2002 Sun Microsystems Inc. + * + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef _ATSPI_COLLECTION_H_ +#define _ATSPI_COLLECTION_H_ + +#include "glib-object.h" + +#include "atspi-constants.h" + +#include "atspi-types.h" +#include "atspi-matchrule.h" + +#define ATSPI_TYPE_COLLECTION (atspi_collection_get_type ()) +#define ATSPI_IS_COLLECTION(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_COLLECTION) +#define ATSPI_COLLECTION(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_COLLECTION, AtspiCollection) +#define ATSPI_COLLECTION_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATSPI_TYPE_COLLECTION, AtspiCollection)) + +GType atspi_collection_get_type (); + +struct _AtspiCollection +{ + GTypeInterface parent; +}; + +gboolean atspi_collection_is_ancestor_of (AtspiCollection *collection, AtspiAccessible *test, GError **error); + +GArray * atspi_collection_get_matches (AtspiCollection *collection, AtspiMatchRule *rule, AtspiCollectionSortOrder sortby, gint count, gboolean traverse, GError **error); + +GArray * atspi_collection_get_matches_to (AtspiCollection *collection, AtspiAccessible *current_object, AtspiMatchRule *rule, AtspiCollectionSortOrder sortby, AtspiCollectionTreeTraversalType tree, gboolean recurse, gint count, gboolean traverse, GError **error); + +GArray * atspi_collection_get_matches_from (AtspiCollection *collection, AtspiAccessible *current_object, AtspiMatchRule *rule, AtspiCollectionSortOrder sortby, AtspiCollectionTreeTraversalType tree, gint count, gboolean traverse, GError **error); + +AtspiAccessible * atspi_collection_get_active_descendant (AtspiCollection *collection, GError **error); + +#endif /* _ATSPI_COLLECTION_H_ */ diff --git a/atspi/atspi-constants.h b/atspi/atspi-constants.h index 80d7976e..42dc1209 100644 --- a/atspi/atspi-constants.h +++ b/atspi/atspi-constants.h @@ -173,7 +173,7 @@ typedef enum { /** * ATSPI_MATCHTYPE_COUNT: * - * 1 higher than the highest valid value of #AtspiCollection_MatchType. + * 1 higher than the highest valid value of #AtspiCollectionMatchType. */ #define ATSPI_MATCHTYPES_COUNT (5+1) diff --git a/atspi/atspi-matchrule.c b/atspi/atspi-matchrule.c new file mode 100644 index 00000000..e867d0ea --- /dev/null +++ b/atspi/atspi-matchrule.c @@ -0,0 +1,185 @@ +/* + * AT-SPI - Assistive Technology Service Provider Interface + * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap) + * + * Copyright 2001, 2002 Sun Microsystems Inc., + * Copyright 2001, 2002 Ximian, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "atspi-private.h" + +G_DEFINE_TYPE (AtspiMatchRule, atspi_match_rule, G_TYPE_OBJECT) + +static void +atspi_match_rule_init (AtspiMatchRule *match_rule) +{ +} + +static void +atspi_match_rule_finalize (GObject *obj) +{ + AtspiMatchRule *rule = ATSPI_MATCH_RULE (obj); + + if (rule->states) + g_object_unref (rule->states); + if (rule->attributes) + g_hash_table_unref (rule->attributes); + if (rule->roles) + g_array_free (rule->roles, TRUE); + /* TODO: Check that interfaces don't leak */ + if (rule->interfaces) + g_array_free (rule->interfaces, TRUE); +} + +static void +atspi_match_rule_class_init (AtspiMatchRuleClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->finalize = atspi_match_rule_finalize; +} + +/** + * atspi_match_rule_new: + * + * @states: An #AtspiStateSet specifying the states to match or NULL if none. + * @statematchtype: An #AtspiCollectionMatchType specifying how to interpret + * @states. + * @attributes: (element-type gchar* gchar*): A #GHashTable specifying + * attributes to match. + * @attributematchtype: An #AtspiCollectionMatchType specifying how to + * interpret @attributes. + * @roles: (element-type AtspiRole): A #GArray of roles to match, or NULL if + * not applicable. + * @interfaces: (element-type gchar*): An array of interfaces to match, or + * NUL if not appliable. Interface names should be specified + * by their DBus names (org.a11y.Atspi.Accessible, + * org.a11y.Atspi.Component, etc). + * @interfacematchtype: An #AtspiCollectionMatchType specifying how to + * interpret @interfaces. + * @invert: Specifies whether results should be inverted. + * TODO: Document this parameter better. + * + * Returns: (transfer full): A new #AtspiMatchRule. + */ +AtspiMatchRule * +atspi_match_rule_new (AtspiStateSet *states, + AtspiCollectionMatchType statematchtype, + GHashTable *attributes, + AtspiCollectionMatchType attributematchtype, + GArray *roles, + AtspiCollectionMatchType rolematchtype, + gboolean invert) +{ + AtspiMatchRule *rule = g_object_new (ATSPI_TYPE_MATCH_RULE, NULL); + + if (!rule) + return NULL; + + if (states) + rule->states = g_object_ref (states); + rule->statematchtype = statematchtype; + + if (attributes) + rule->attributes = g_object_ref (attributes); + rule->attributematchtype = attributematchtype; + + if (roles) + rule->roles = g_array_ref(roles); + rule->rolematchtype = rolematchtype; + + rule->invert = invert; + + return rule; +} + +static void +append_entry (gpointer *key, gpointer *val, gpointer data) +{ + DBusMessageIter *iter = data; + DBusMessageIter iter_entry; + + if (!dbus_message_iter_open_container (iter, DBUS_TYPE_DICT_ENTRY, NULL, + &iter_entry)) + return; + dbus_message_iter_append_basic (&iter_entry, DBUS_TYPE_STRING, &key); + dbus_message_iter_append_basic (&iter_entry, DBUS_TYPE_STRING, &val); + dbus_message_iter_close_container (iter, &iter_entry); +} + +gboolean +_atspi_match_rule_marshal (AtspiMatchRule *rule, DBusMessageIter *iter) +{ + DBusMessageIter iter_struct, iter_array, iter_dict; + dbus_int32_t states [2]; + dbus_int32_t d_statematchtype = rule->statematchtype; + dbus_int32_t d_attributematchtype = rule->attributematchtype; + dbus_int32_t d_interfacematchtype = rule->interfacematchtype; + dbus_uint32_t d_rolematchtype = rule->rolematchtype; + dbus_bool_t d_invert = rule->invert; + gint i; + + if (!dbus_message_iter_open_container (iter, DBUS_TYPE_STRUCT, "(aiiasiaiisib)", + &iter_struct)) + return FALSE; + + /* states */ + if (rule->states) + { + states [0] = rule->states->states & 0xffffffff; + states [1] = rule->states->states >> 32; + } + else + { + states [0] = states [1] = 0; + } + dbus_message_iter_open_container (&iter_struct, DBUS_TYPE_ARRAY, "u", &iter_array); + dbus_message_iter_append_basic (&iter_array, DBUS_TYPE_INT32, &states [0]); + dbus_message_iter_append_basic (&iter_array, DBUS_TYPE_INT32, &states [1]); + dbus_message_iter_close_container (&iter_struct, &iter_array); + dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_INT32, &d_statematchtype); + + /* attributes */ + if (!dbus_message_iter_open_container (iter, DBUS_TYPE_ARRAY, "{ss}", + &iter_dict)) + return FALSE; + g_hash_table_foreach (rule->attributes, append_entry, &iter_dict); + dbus_message_iter_close_container (iter, &iter_dict); + dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_INT32, &d_attributematchtype); + + /* roles */ + if (!dbus_message_iter_open_container (&iter_struct, DBUS_TYPE_ARRAY, "i", + &iter_array)) + return FALSE; + if (rule->roles) + { + for (i = 0; i < rule->roles->len; i++) + { + dbus_int32_t d_role = g_array_index (rule->roles, AtspiRole, i); + dbus_message_iter_append_basic (&iter_array, DBUS_TYPE_INT32, &d_role); + } + } + dbus_message_iter_close_container (&iter_struct, &iter_array); + dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_INT32, + &d_rolematchtype); + + dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_BOOLEAN, &d_invert); + + dbus_message_iter_close_container (iter, &iter_struct); + return TRUE; +} diff --git a/atspi/atspi-matchrule.h b/atspi/atspi-matchrule.h new file mode 100644 index 00000000..ff3a685c --- /dev/null +++ b/atspi/atspi-matchrule.h @@ -0,0 +1,73 @@ +/* + * AT-SPI - Assistive Technology Service Provider Interface + * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap) + * + * Copyright 2002 Ximian, Inc. + * 2002 Sun Microsystems Inc. + * + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef _ATSPI_MATCH_RULE_H_ +#define _ATSPI_MATCH_RULE_H_ + +#include "glib-object.h" + +#include "atspi-stateset.h" +#include "atspi-constants.h" +#include "atspi-types.h" + +#define ATSPI_TYPE_MATCH_RULE (atspi_match_rule_get_type ()) +#define ATSPI_MATCH_RULE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_MATCH_RULE, AtspiMatchRule)) +#define ATSPI_MATCH_RULE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ATSPI_TYPE_MATCH_RULE, AtspiMatchRuleClass)) +#define ATSPI_IS_MATCH_RULE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_MATCH_RULE)) +#define ATSPI_IS_MATCH_RULE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ATSPI_TYPE_MATCH_RULE)) +#define ATSPI_MATCH_RULE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ATSPI_TYPE_MATCH_RULE, AtspiMatchRuleClass)) + +typedef struct _AtspiMatchRule AtspiMatchRule; +struct _AtspiMatchRule +{ + AtspiStateSet *states; + AtspiCollectionMatchType statematchtype; + GHashTable *attributes; + AtspiCollectionMatchType attributematchtype; + GArray *roles; + AtspiCollectionMatchType rolematchtype; + GArray *interfaces; + AtspiCollectionMatchType interfacematchtype; + gboolean invert; +}; + +typedef struct _AtspiMatchRuleClass AtspiMatchRuleClass; +struct _AtspiMatchRuleClass +{ + GObjectClass parent_class; +}; + +AtspiMatchRule * +atspi_match_rule_new (AtspiStateSet *states, + AtspiCollectionMatchType statematchtype, + GHashTable *attributes, + AtspiCollectionMatchType attributematchtype, + GArray *roles, + AtspiCollectionMatchType rolematchtype, + gboolean invert); + +gboolean +_atspi_match_rule_marshal (AtspiMatchRule *rule, DBusMessageIter *iter); + +#endif /* _ATSPI_MATCH_RULE_H_ */ diff --git a/atspi/atspi-misc-private.h b/atspi/atspi-misc-private.h index d9ae868b..9953c299 100644 --- a/atspi/atspi-misc-private.h +++ b/atspi/atspi-misc-private.h @@ -87,6 +87,7 @@ extern const char *atspi_bus_registry; extern const char *atspi_interface_accessible; extern const char *atspi_interface_action; extern const char *atspi_interface_application; +extern const char *atspi_interface_collection; extern const char *atspi_interface_component; extern const char *atspi_interface_dec; extern const char *atspi_interface_device_event_listener; diff --git a/atspi/atspi-misc.c b/atspi/atspi-misc.c index 76479e17..eeea8766 100644 --- a/atspi/atspi-misc.c +++ b/atspi/atspi-misc.c @@ -45,6 +45,7 @@ const char *atspi_bus_registry = ATSPI_DBUS_NAME_REGISTRY; const char *atspi_interface_accessible = ATSPI_DBUS_INTERFACE_ACCESSIBLE; const char *atspi_interface_action = ATSPI_DBUS_INTERFACE_ACTION; const char *atspi_interface_application = ATSPI_DBUS_INTERFACE_APPLICATION; +const char *atspi_interface_collection = ATSPI_DBUS_INTERFACE_COLLECTION; const char *atspi_interface_component = ATSPI_DBUS_INTERFACE_COMPONENT; const char *atspi_interface_dec = ATSPI_DBUS_INTERFACE_DEC; const char *atspi_interface_device_event_listener = ATSPI_DBUS_INTERFACE_DEVICE_EVENT_LISTENER; diff --git a/atspi/atspi-types.h b/atspi/atspi-types.h index 6769935e..0f84d238 100644 --- a/atspi/atspi-types.h +++ b/atspi/atspi-types.h @@ -31,7 +31,7 @@ typedef struct _AtspiAccessible AtspiAccessible; typedef struct _AtspiAction AtspiAction; -typedef struct _AtspiAccessible AtspiCollection; +typedef struct _AtspiCollection AtspiCollection; typedef struct _AtspiComponent AtspiComponent; typedef struct _AtspiDocument AtspiDocument; typedef struct _AtspiEditableText AtspiEditableText; diff --git a/atspi/atspi.h b/atspi/atspi.h index 18cbdd7b..fbf712aa 100644 --- a/atspi/atspi.h +++ b/atspi/atspi.h @@ -30,6 +30,7 @@ #include "atspi-types.h" #include "atspi-accessible.h" #include "atspi-action.h" +#include "atspi-collection.h" #include "atspi-component.h" #include "atspi-device-listener.h" #include "atspi-document.h" @@ -38,6 +39,7 @@ #include "atspi-hyperlink.h" #include "atspi-hypertext.h" #include "atspi-image.h" +#include "atspi-matchrule.h" #include "atspi-misc.h" #include "atspi-registry.h" #include "atspi-selection.h" |