a11y: Add getters for GtkAtSpiContext

We are going to use them in order to implement atspi.Cache.
This commit is contained in:
Emmanuele Bassi 2020-11-16 15:21:58 +00:00
parent 125442297f
commit bc4f71a107
3 changed files with 53 additions and 0 deletions

View File

@ -1798,6 +1798,42 @@ gtk_at_spi_context_to_ref (GtkAtSpiContext *self)
return g_variant_new ("(so)", name, self->context_path); return g_variant_new ("(so)", name, self->context_path);
} }
GVariant *
gtk_at_spi_context_get_interfaces (GtkAtSpiContext *self)
{
g_return_val_if_fail (GTK_IS_AT_SPI_CONTEXT (self), NULL);
return self->interfaces;
}
GVariant *
gtk_at_spi_context_get_states (GtkAtSpiContext *self)
{
GVariantBuilder builder = G_VARIANT_BUILDER_INIT (G_VARIANT_TYPE ("au"));
collect_states (self, &builder);
return g_variant_builder_end (&builder);
}
GVariant *
gtk_at_spi_context_get_parent_ref (GtkAtSpiContext *self)
{
g_return_val_if_fail (GTK_IS_AT_SPI_CONTEXT (self), NULL);
GtkAccessible *accessible = gtk_at_context_get_accessible (GTK_AT_CONTEXT (self));
return get_parent_context_ref (accessible);
}
GtkAtSpiRoot *
gtk_at_spi_context_get_root (GtkAtSpiContext *self)
{
g_return_val_if_fail (GTK_IS_AT_SPI_CONTEXT (self), NULL);
return self->root;
}
/* }}} */ /* }}} */
/* vim:set foldmethod=marker expandtab: */ /* vim:set foldmethod=marker expandtab: */

View File

@ -21,6 +21,7 @@
#pragma once #pragma once
#include "gtkatcontextprivate.h" #include "gtkatcontextprivate.h"
#include "gtkatspiprivate.h"
G_BEGIN_DECLS G_BEGIN_DECLS
@ -39,4 +40,16 @@ gtk_at_spi_context_get_context_path (GtkAtSpiContext *self);
GVariant * GVariant *
gtk_at_spi_context_to_ref (GtkAtSpiContext *self); gtk_at_spi_context_to_ref (GtkAtSpiContext *self);
GtkAtSpiRoot *
gtk_at_spi_context_get_root (GtkAtSpiContext *self);
GVariant *
gtk_at_spi_context_get_parent_ref (GtkAtSpiContext *self);
GVariant *
gtk_at_spi_context_get_interfaces (GtkAtSpiContext *self);
GVariant *
gtk_at_spi_context_get_states (GtkAtSpiContext *self);
G_END_DECLS G_END_DECLS

View File

@ -273,4 +273,8 @@ typedef enum {
ATSPI_SCROLL_ANYWHERE ATSPI_SCROLL_ANYWHERE
} AtspiScrollType; } AtspiScrollType;
typedef struct _GtkAtSpiRoot GtkAtSpiRoot;
typedef struct _GtkAtSpiCache GtkAtSpiCache;
typedef struct _GtkAtSpiContext GtkAtSpiContext;
G_END_DECLS G_END_DECLS