[at-spi2-core] Use stored values for AT-SPI role names



commit 5faed12b8466b621d08a24539c1fbc6e83963254
Author: Mike Gorse <mgorse novell com>
Date:   Wed Jun 15 15:33:33 2011 -0500

    Use stored values for AT-SPI role names
    
    When atspi_accessible_get_role returns a recognized role that isn't
    ATSPI_ROLE_EXTENDED, use a stored role name in order to take advantage
    of roles being cached.

 atspi/atspi-accessible.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/atspi/atspi-accessible.c b/atspi/atspi-accessible.c
index 50b5845..9c21f44 100644
--- a/atspi/atspi-accessible.c
+++ b/atspi/atspi-accessible.c
@@ -202,6 +202,7 @@ static const char *role_names [] =
   "drawing-area",
   "file-chooser",
   "filler",
+  "focus traversable",
   "font-chooser",
   "frame",
   "glass-pane",
@@ -252,7 +253,7 @@ static const char *role_names [] =
   "window",
   NULL,
   "header",
-  "fooler",
+  "footer",
   "paragraph",
   "ruler",
   "application",
@@ -266,8 +267,8 @@ static const char *role_names [] =
   "heading",
   "page",
   "section",
-  "form",
   "redundant object",
+  "form",
   "link",
   "input method window"
 };
@@ -579,9 +580,14 @@ gchar *
 atspi_accessible_get_role_name (AtspiAccessible *obj, GError **error)
 {
   char *retval = NULL;
+  AtspiRole role;
 
   g_return_val_if_fail (obj != NULL, NULL);
 
+  role = atspi_accessible_get_role (obj, error);
+  if (role >= 0 && role < MAX_ROLES && role != ATSPI_ROLE_EXTENDED)
+    return g_strdup (role_names [role]);
+
   _atspi_dbus_call (obj, atspi_interface_accessible, "GetRoleName", error, "=>s", &retval);
 
   if (!retval)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]