diff options
author | Mike Gorse <mgorse@novell.com> | 2011-05-25 13:00:24 -0500 |
---|---|---|
committer | Mike Gorse <mgorse@novell.com> | 2011-05-25 13:00:24 -0500 |
commit | 9ddf777a096440afe521c094544942e85e3ee838 (patch) | |
tree | ab1bae6b1f00c575d7d3304d88433b9d4cc4c35b | |
parent | a72bb4c6521304c0e5dc678ce900ba7c78a86eda (diff) | |
download | at-spi2-core-9ddf777a096440afe521c094544942e85e3ee838.tar.gz |
Install enum header, and try to get role name from enum
Have atspi_accessible_get_role_name try to use the internal string associated
with the accessible's role rather than calling GetRoleName. This avoids
making a DBus call when the role is cached.
Also, atspi.h now includes atspi-enum-types.h, and the latter is now installed.
-rw-r--r-- | atspi/Makefile.am | 1 | ||||
-rw-r--r-- | atspi/atspi-accessible.c | 17 | ||||
-rw-r--r-- | atspi/atspi.h | 2 |
3 files changed, 20 insertions, 0 deletions
diff --git a/atspi/Makefile.am b/atspi/Makefile.am index 4d38ee4f..28551853 100644 --- a/atspi/Makefile.am +++ b/atspi/Makefile.am @@ -27,6 +27,7 @@ libatspiinclude_HEADERS = \ atspi-device-listener-private.h \ atspi-document.h \ atspi-editabletext.h \ + atspi-enum-types.h \ atspi-event-listener.h \ atspi-event-listener-private.h \ atspi-gmain.c \ diff --git a/atspi/atspi-accessible.c b/atspi/atspi-accessible.c index f1f07885..f8f72c03 100644 --- a/atspi/atspi-accessible.c +++ b/atspi/atspi-accessible.c @@ -576,7 +576,24 @@ atspi_accessible_get_role (AtspiAccessible *obj, GError **error) gchar * atspi_accessible_get_role_name (AtspiAccessible *obj, GError **error) { + AtspiRole role = atspi_accessible_get_role (obj, error); char *retval = NULL; + GTypeClass *type_class; + GEnumValue *value; + const gchar *name = NULL; + + type_class = g_type_class_ref (ATSPI_TYPE_ROLE); + g_return_val_if_fail (G_IS_ENUM_CLASS (type_class), NULL); + + value = g_enum_get_value (G_ENUM_CLASS (type_class), role); + + if (value) + { + retval = value->value_nick; + } + + if (retval) + return g_strdup (retval); g_return_val_if_fail (obj != NULL, NULL); diff --git a/atspi/atspi.h b/atspi/atspi.h index 79157601..7f66d2ac 100644 --- a/atspi/atspi.h +++ b/atspi/atspi.h @@ -50,4 +50,6 @@ #include "atspi-value.h" #include "atspi-gmain.h" + +#include "atspi-enum-types.h" #endif |