diff options
author | Mike Gorse <mgorse@suse.com> | 2013-02-25 18:36:12 -0600 |
---|---|---|
committer | Mike Gorse <mgorse@suse.com> | 2013-02-27 15:28:12 -0600 |
commit | 746fb37ba66ce815e27080eda8a54101c96e8eec (patch) | |
tree | d471f00e0d6e8c50358e3b92386f5f9da4204b7c /atspi/atspi-accessible.c | |
parent | bdb83fac4adcd096977ca95bcc794d42695037eb (diff) | |
download | at-spi2-core-746fb37ba66ce815e27080eda8a54101c96e8eec.tar.gz |
Add atspi_accessible_get_object_locale
https://bugzilla.gnome.org/show_bug.cgi?id=694368
Diffstat (limited to 'atspi/atspi-accessible.c')
-rw-r--r-- | atspi/atspi-accessible.c | 35 |
1 files changed, 35 insertions, 0 deletions
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 <string.h> 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; +} |