summaryrefslogtreecommitdiff
path: root/atspi/atspi-accessible.c
diff options
context:
space:
mode:
authorMike Gorse <mgorse@suse.com>2013-05-10 18:56:32 -0500
committerMike Gorse <mgorse@suse.com>2013-05-10 18:56:32 -0500
commite74c40ea4b7616930557ca2e9eda73f5b344a4b5 (patch)
tree85d65785426bede318aa66e7804f4a6fcb24d30d /atspi/atspi-accessible.c
parenta29788df335d9ffc2fd471463ba996ba1aca4665 (diff)
parent7afb51e5093fef46c699d92ee8eee94f5b6886fb (diff)
downloadat-spi2-core-e74c40ea4b7616930557ca2e9eda73f5b344a4b5.tar.gz
Merge branch 'enum-types'
Conflicts: atspi/Makefile.am atspi/atspi-accessible.c
Diffstat (limited to 'atspi/atspi-accessible.c')
-rw-r--r--atspi/atspi-accessible.c155
1 files changed, 16 insertions, 139 deletions
diff --git a/atspi/atspi-accessible.c b/atspi/atspi-accessible.c
index 03bceca7..fc2b48f0 100644
--- a/atspi/atspi-accessible.c
+++ b/atspi/atspi-accessible.c
@@ -201,139 +201,6 @@ atspi_accessible_class_init (AtspiAccessibleClass *klass)
quark_locale = g_quark_from_string ("accessible-locale");
}
-/* TODO: Generate following from spec? */
-static const char *role_names [] =
-{
- "invalid",
- "accelerator label",
- "alert",
- "animation",
- "arrow",
- "calendar",
- "canvas",
- "check box",
- "check menu item",
- "color chooser",
- "column header",
- "combo box",
- "dateeditor",
- "desktop icon",
- "desktop frame",
- "dial",
- "dialog",
- "directory pane",
- "drawing area",
- "file chooser",
- "filler",
- "focus traversable",
- "fontchooser",
- "frame",
- "glass pane",
- "html container",
- "icon",
- "image",
- "internal frame",
- "label",
- "layered pane",
- "list",
- "list item",
- "menu",
- "menu bar",
- "menu item",
- "option pane",
- "page tab",
- "page tab list",
- "panel",
- "password text",
- "popup menu",
- "progress bar",
- "push button",
- "radio button",
- "radio menu item",
- "root pane",
- "row header",
- "scroll bar",
- "scroll pane",
- "separator",
- "slider",
- "spin button",
- "split pane",
- "statusbar",
- "table",
- "table cell",
- "table column header",
- "table row header",
- "tear off menu item",
- "terminal",
- "text",
- "toggle button",
- "tool bar",
- "tool tip",
- "tree",
- "tree table",
- "unknown",
- "viewport",
- "window",
- NULL,
- "header",
- "footer",
- "paragraph",
- "ruler",
- "application",
- "autocomplete",
- "editbar",
- "embedded component",
- "entry",
- "chart",
- "caption",
- "document frame",
- "heading",
- "page",
- "section",
- "redundant object",
- "form",
- "link",
- "input method window",
- "table row",
- "tree item",
- "document spreadsheet",
- "document presentation",
- "document text",
- "document web",
- "document email",
- "comment",
- "list box",
- "grouping",
- "image map",
- "notification",
- "info bar",
- "level bar"
-};
-
-#define MAX_ROLES (sizeof (role_names) / sizeof (char *))
-
-/**
- * atspi_role_get_name:
- * @role: an #AtspiRole object to query.
- *
- * Gets a localizable string that indicates the name of an #AtspiRole.
- * <em>DEPRECATED.</em>
- *
- * Returns: a localizable string name for an #AtspiRole enumerated type.
- **/
-gchar *
-atspi_role_get_name (AtspiRole role)
-{
- if (role < MAX_ROLES && role_names [(int) role])
- {
- return g_strdup (role_names [(int) role]);
- }
- else
- {
- return g_strdup ("");
- }
-}
-
/**
* atspi_accessible_get_name:
* @obj: a pointer to the #AtspiAccessible object on which to operate.
@@ -621,14 +488,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;
- AtspiRole role;
+ GTypeClass *type_class;
+ GEnumValue *value;
+ const gchar *name = NULL;
- g_return_val_if_fail (obj != NULL, 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;
+ }
- role = atspi_accessible_get_role (obj, error);
- if (role >= 0 && role < MAX_ROLES && role != ATSPI_ROLE_EXTENDED)
- return g_strdup (role_names [role]);
+ if (retval)
+ return _atspi_name_compat (g_strdup (retval));
_atspi_dbus_call (obj, atspi_interface_accessible, "GetRoleName", error, "=>s", &retval);
@@ -1480,7 +1357,7 @@ _atspi_accessible_new (AtspiApplication *app, const gchar *path)
* atspi_accessible_set_cache_mask:
* @accessible: The #AtspiAccessible to operate on. Must be the desktop or
* the root of an application.
- * @mask: (type int): An #AtspiCache specifying a bit mask of the types of data to cache.
+ * @mask: An #AtspiCache specifying a bit mask of the types of data to cache.
*
* Sets the type of data to cache for accessibles.
* If this is not set for an application or is reset to ATSPI_CACHE_UNDEFINED,