From 08177bf931e23c1e40c7d848cca6bcee337178ad Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alejandro=20Pi=C3=B1eiro?= Date: Mon, 18 Feb 2013 20:10:22 +0100 Subject: [PATCH] atkobject: Added atk_object_get_object_locale https://bugzilla.gnome.org/show_bug.cgi?id=694117 --- atk/atkobject.c | 37 ++++++++++++++++++++++++++++++++++++- atk/atkobject.h | 5 ++++- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/atk/atkobject.c b/atk/atkobject.c index fe17884..26e6c2f 100755 --- a/atk/atkobject.c +++ b/atk/atkobject.c @@ -340,7 +340,8 @@ static void atk_object_real_remove_property_change_handler guint handler_id); static void atk_object_notify (GObject *obj, GParamSpec *pspec); - +static const gchar* atk_object_real_get_object_locale + (AtkObject *object); static guint atk_object_signals[LAST_SIGNAL] = { 0, }; @@ -497,6 +498,7 @@ atk_object_class_init (AtkObjectClass *klass) atk_object_real_connect_property_change_handler; klass->remove_property_change_handler = atk_object_real_remove_property_change_handler; + klass->get_object_locale = atk_object_real_get_object_locale; /* * We do not define default signal handlers here @@ -1559,6 +1561,39 @@ atk_role_get_localized_name (AtkRole role) return atk_role_get_name (role); } +static const gchar* +atk_object_real_get_object_locale (AtkObject *object) +{ + return setlocale (LC_MESSAGES, NULL); +} + +/** + * atk_object_get_object_locale: + * @accessible: an #AtkObject + * + * Gets a UTF-8 string indicating the POSIX-style LC_MESSAGES locale + * of @accessible. + * + * Since: 2.7.90 + * + * Returns: a UTF-8 string indicating the POSIX-style LC_MESSAGES + * locale of @accessible. + **/ +const gchar* +atk_object_get_object_locale (AtkObject *accessible) +{ + AtkObjectClass *klass; + + g_return_val_if_fail (ATK_IS_OBJECT (accessible), NULL); + + klass = ATK_OBJECT_GET_CLASS (accessible); + if (klass->get_object_locale) + return (klass->get_object_locale) (accessible); + else + return NULL; +} + + /** * atk_role_for_name: * @name: a string which is the (non-localized) name of an ATK role. diff --git a/atk/atkobject.h b/atk/atkobject.h index 83d77fd..4e15919 100755 --- a/atk/atkobject.h +++ b/atk/atkobject.h @@ -531,8 +531,10 @@ void (* initialize) (AtkObject * Since ATK 1.12 */ AtkAttributeSet* (*get_attributes) (AtkObject *accessible); + + const gchar* (*get_object_locale) (AtkObject *accessible); + AtkFunction pad1; - AtkFunction pad2; }; GType atk_object_get_type (void); @@ -613,6 +615,7 @@ gboolean atk_object_remove_relationship (AtkObject * AtkRelationType relationship, AtkObject *target); const gchar* atk_role_get_localized_name (AtkRole role); +const gchar* atk_object_get_object_locale (AtkObject *accessible); /* */ -- 2.11.4.GIT