From 746fb37ba66ce815e27080eda8a54101c96e8eec Mon Sep 17 00:00:00 2001 From: Mike Gorse Date: Mon, 25 Feb 2013 18:36:12 -0600 Subject: Add atspi_accessible_get_object_locale https://bugzilla.gnome.org/show_bug.cgi?id=694368 --- atspi/atspi-accessible.c | 35 +++++++++++++++++++++++++++++++++++ atspi/atspi-accessible.h | 2 ++ 2 files changed, 37 insertions(+) (limited to 'atspi') diff --git a/atspi/atspi-accessible.c b/atspi/atspi-accessible.c index 64cbf7ea..03bceca7 100644 --- a/atspi/atspi-accessible.c +++ b/atspi/atspi-accessible.c @@ -26,6 +26,7 @@ #include static gboolean enable_caching = FALSE; +static guint quark_locale; static void atspi_action_interface_init (AtspiAction *action) @@ -196,6 +197,8 @@ atspi_accessible_class_init (AtspiAccessibleClass *klass) object_class->dispose = atspi_accessible_dispose; object_class->finalize = atspi_accessible_finalize; + + quark_locale = g_quark_from_string ("accessible-locale"); } /* TODO: Generate following from spec? */ @@ -1600,3 +1603,35 @@ _atspi_accessible_add_cache (AtspiAccessible *accessible, AtspiCache flag) accessible->cached_properties |= flag & mask; } + +/** + * atspi_accessible_get_locale: + * @accessible: an #AtspiAccessible + * + * Gets a UTF-8 string indicating the POSIX-style LC_MESSAGES locale + * of @accessible. + * + * Since: 2.7.91 + * + * Returns: a UTF-8 string indicating the POSIX-style LC_MESSAGES + * locale of @accessible. + **/ +const gchar* +atspi_accessible_get_object_locale (AtspiAccessible *accessible, GError **error) +{ + gchar *locale; + + g_return_val_if_fail (accessible != NULL, NULL); + + locale = g_object_get_qdata (G_OBJECT (accessible), quark_locale); + if (!locale) + { + if (!_atspi_dbus_get_property (accessible, atspi_interface_accessible, + "Locale", error, "s", &locale)) + return NULL; + if (locale) + g_object_set_qdata_full (G_OBJECT (accessible), quark_locale, locale, + g_free); + } + return locale; +} diff --git a/atspi/atspi-accessible.h b/atspi/atspi-accessible.h index 428967ee..7047016c 100644 --- a/atspi/atspi-accessible.h +++ b/atspi/atspi-accessible.h @@ -132,6 +132,8 @@ AtspiValue * atspi_accessible_get_value (AtspiAccessible *obj); GArray * atspi_accessible_get_interfaces (AtspiAccessible *obj); +const gchar* atspi_accessible_get_object_locale (AtspiAccessible *accessible, GError **error); + void atspi_accessible_set_cache_mask (AtspiAccessible *accessible, AtspiCache mask); void atspi_accessible_clear_cache (AtspiAccessible *accessible); -- cgit v1.2.1