Dump AtkSelection properties

Also make get_name() deal with object that are not GtkAccessible,
but implement AtkText. An example of this is GailNotebookPage.
This commit is contained in:
Matthias Clasen 2011-06-19 17:18:47 -04:00
parent a6d741b6a4
commit 913c5241ae

View File

@ -115,8 +115,15 @@ get_name (AtkObject *accessible)
name = g_strdup (gtk_buildable_get_name (GTK_BUILDABLE (widget)));
}
else if (ATK_IS_TEXT (accessible))
{
name = atk_text_get_text (ATK_TEXT (accessible), 0, -1);
}
else
name = NULL;
{
g_warning ("get_name called on a %s\n", g_type_name_from_instance ((GTypeInstance *)accessible));
name = NULL;
}
if (name == NULL)
{
@ -315,6 +322,27 @@ dump_atk_action (AtkAction *atk_action,
}
}
static void
dump_atk_selection (AtkSelection *atk_selection,
guint depth,
GString *string)
{
gint i;
g_string_append_printf (string, "%*sselection count: %d\n", depth, "", atk_selection_get_selection_count (atk_selection));
if (atk_selection_get_selection_count (atk_selection) > 0)
{
g_string_append_printf (string, "%*sselected children:", depth, "");
for (i = 0; i < atk_object_get_n_accessible_children (ATK_OBJECT (atk_selection)); i++)
{
if (atk_selection_is_child_selected (atk_selection, i))
g_string_append_printf (string, " %d", i);
}
g_string_append_c (string, '\n');
}
}
static void
dump_accessible (AtkObject *accessible,
guint depth,
@ -337,13 +365,19 @@ dump_accessible (AtkObject *accessible,
dump_relation_set (string, depth, atk_object_ref_relation_set (accessible));
dump_state_set (string, depth, atk_object_ref_state_set (accessible));
dump_attribute_set (string, depth, atk_object_get_attributes (accessible));
if (ATK_IS_TEXT (accessible))
dump_atk_text (ATK_TEXT (accessible), depth, string);
if (ATK_IS_IMAGE (accessible))
dump_atk_image (ATK_IMAGE (accessible), depth, string);
if (ATK_IS_ACTION (accessible))
dump_atk_action (ATK_ACTION (accessible), depth, string);
if (ATK_IS_SELECTION (accessible))
dump_atk_selection (ATK_SELECTION (accessible), depth, string);
for (i = 0; i < atk_object_get_n_accessible_children (accessible); i++)
{
AtkObject *child = atk_object_ref_accessible_child (accessible, i);