From 6d7165445f4749a11e14e71a7bb953e8230d4efb Mon Sep 17 00:00:00 2001 From: billh Date: Mon, 1 Dec 2003 17:36:07 +0000 Subject: [PATCH] Fix for 127463, add api for Accessible_getLocalizedRoleName. git-svn-id: http://svn.gnome.org/svn/at-spi/trunk@563 e2bd861d-eb25-0410-b326-f6ed22b6b98c --- ChangeLog | 19 +++++++++++++++++++ cspi/spi.h | 1 + cspi/spi_accessible.c | 26 ++++++++++++++++++++++++++ idl/Accessibility_Accessible.idl | 10 +++++++++- libspi/accessible.c | 23 +++++++++++++++++++++++ 5 files changed, 78 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index c6d6b76..277828c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,24 @@ 2003-12-01 Bill Haneman + Fix for bug/rfe #127463. + + * idl/Accessibility_Accessible.idl: + (getLocalizedRoleName): New. + (unimplemented4): Removed (replaced by above). + + * libspi/accessible.c: + (impl_accessibility_accessible_get_local_role_name): New. + (spi_accessible_class_init): Add getLocalizedRoleName entry to + epv. + + * cspi/spi.h: + (Accessible_getLocalizedRoleName): New. + + * cspi/spi_accessible.c: + (Accessible_getLocalizedRoleName): New. + +2003-12-01 Bill Haneman + Fix for bug #118581. * idl/Accessibility_Text.idl: (getDefaultAttributes): New. diff --git a/cspi/spi.h b/cspi/spi.h index f9e4b0c..eea3257 100644 --- a/cspi/spi.h +++ b/cspi/spi.h @@ -405,6 +405,7 @@ long Accessible_getIndexInParent (Accessible *obj); AccessibleRelation **Accessible_getRelationSet (Accessible *obj); AccessibleRole Accessible_getRole (Accessible *obj); char * Accessible_getRoleName (Accessible *obj); +char * Accessible_getLocalizedRoleName (Accessible *obj); AccessibleStateSet * Accessible_getStateSet (Accessible *obj); /* Interface query methods */ diff --git a/cspi/spi_accessible.c b/cspi/spi_accessible.c index 86e27b6..82ad11d 100644 --- a/cspi/spi_accessible.c +++ b/cspi/spi_accessible.c @@ -499,6 +499,32 @@ Accessible_getRoleName (Accessible *obj) } /** + * Accessible_getLocalizedRoleName: + * @obj: a pointer to the #Accessible object on which to operate. + * + * Get a UTF-8 string describing the (localized) role this object plays in the UI. + * This method will return useful values for roles that fall outside the + * enumeration used in Accessible_getRole (). + * + * Returns: a UTF-8 string specifying the role of this #Accessible object. + * + **/ +char * +Accessible_getLocalizedRoleName (Accessible *obj) +{ + char *retval; + + cspi_return_val_if_fail (obj != NULL, CORBA_string_dup ("invalid")); + + retval = + Accessibility_Accessible_getLocalizedRoleName (CSPI_OBJREF (obj), cspi_ev ()); + + cspi_return_val_if_ev ("getLocalizedRoleName", CORBA_string_dup ("invalid")); + + return retval; +} + +/** * Accessible_getStateSet: * @obj: a pointer to the #Accessible object on which to operate. * diff --git a/idl/Accessibility_Accessible.idl b/idl/Accessibility_Accessible.idl index 191ef7d..d9bccd9 100644 --- a/idl/Accessibility_Accessible.idl +++ b/idl/Accessibility_Accessible.idl @@ -118,6 +118,15 @@ module Accessibility { string getRoleName (); /** + * getLocalizedRoleName: + * Get a string indicating the type of UI role played by this object, + * translated to the current locale. + * + * Returns: a UTF-8 string indicating the type of UI role played by this object. + **/ + string getLocalizedRoleName (); + + /** * getState: * * Get the current state of the object as a @StateSet. @@ -128,7 +137,6 @@ module Accessibility { void unImplemented (); void unImplemented2 (); void unImplemented3 (); - void unImplemented4 (); }; }; diff --git a/libspi/accessible.c b/libspi/accessible.c index 9ff6a38..db49f5b 100644 --- a/libspi/accessible.c +++ b/libspi/accessible.c @@ -405,6 +405,28 @@ impl_accessibility_accessible_get_role_name (PortableServer_Servant servant, return CORBA_string_dup (""); } +/* + * CORBA Accessibility::Accessible::getLocalizedRole method implementation + */ +static CORBA_char * +impl_accessibility_accessible_get_local_role_name (PortableServer_Servant servant, + CORBA_Environment *ev) +{ + const gchar *role_name; + AtkRole role; + AtkObject *object = get_atkobject_from_servant (servant); + + g_return_val_if_fail (object != NULL, 0); + + role = atk_object_get_role (object); + + role_name = atk_role_get_localized_name (role); + if (role_name) + return CORBA_string_dup (role_name); + else + return CORBA_string_dup (""); +} + static void spi_accessible_class_init (SpiAccessibleClass *klass) { @@ -424,6 +446,7 @@ spi_accessible_class_init (SpiAccessibleClass *klass) epv->getState = impl_accessibility_accessible_get_state; epv->getRole = impl_accessibility_accessible_get_role; epv->getRoleName = impl_accessibility_accessible_get_role_name; + epv->getLocalizedRoleName = impl_accessibility_accessible_get_local_role_name; } static void -- 2.7.4