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);
+ gchar *retval = NULL;
+ AtspiRole role;
- if (value)
- {
- retval = g_strdup (value->value_nick);
- }
+ g_return_val_if_fail (obj != NULL, NULL);
- if (retval)
- return _atspi_name_compat (g_strdup (retval));
+ role = atspi_accessible_get_role (obj, error);
+ if (role >= 0 && role < ATSPI_ROLE_COUNT && role != ATSPI_ROLE_EXTENDED)
+ return atspi_role_get_name (role);
_atspi_dbus_call (obj, atspi_interface_accessible, "GetRoleName", error, "=>s", &retval);
}
return name;
}
+
+/**
+ * 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)
+{
+ gchar *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 = g_strdup (value->value_nick);
+ }
+
+ if (retval)
+ return _atspi_name_compat (g_strdup (retval));
+
+ return NULL;
+}
void
atspi_set_timeout (gint val, gint startup_time);
+gchar * atspi_role_get_name (AtspiRole role);
G_END_DECLS
#endif /* _ATSPI_MISC_H_ */