[java-atk-wrapper] JNI: Create jaw_object_get_object_locale



commit 3cb0b94602b2a8c096a9ad7628de3d3a91a9287f
Author: Magdalen Berns <m berns thismagpie com>
Date:   Thu Jun 11 12:11:08 2015 +0100

    JNI: Create jaw_object_get_object_locale
    
    Bug: https://bugzilla.gnome.org/show_bug.cgi?id=745340

 jni/src/jawobject.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/jni/src/jawobject.c b/jni/src/jawobject.c
index fce4d90..156ae25 100644
--- a/jni/src/jawobject.c
+++ b/jni/src/jawobject.c
@@ -50,6 +50,7 @@ static void jaw_object_set_name (AtkObject *atk_obj, const gchar *name);
 static void jaw_object_set_description (AtkObject *atk_obj, const gchar *description);
 static void jaw_object_set_parent(AtkObject *atk_obj, AtkObject *parent);
 static void jaw_object_set_role (AtkObject *atk_obj, AtkRole role);
+static const gchar *jaw_object_get_object_locale (AtkObject *atk_obj);
 
 static gpointer parent_class = NULL;
 
@@ -76,6 +77,7 @@ jaw_object_class_init (JawObjectClass *klass)
   atk_class->set_description = jaw_object_set_description;
   atk_class->set_parent = jaw_object_set_parent;
   atk_class->set_role = jaw_object_set_role;
+  atk_class->get_object_locale = jaw_object_get_object_locale;
 
   klass->get_interface_data = NULL;
 }
@@ -537,3 +539,23 @@ jaw_object_ref_relation_set (AtkObject *atk_obj)
   return atk_obj->relation_set;
 }
 
+static const gchar *jaw_object_get_object_locale (AtkObject *atk_obj)
+{
+  JawObject *jaw_obj = JAW_OBJECT(atk_obj);
+  jobject ac = jaw_obj->acc_context;
+  JNIEnv *jniEnv = jaw_util_get_jni_env();
+
+  jclass classAccessibleContext = (*jniEnv)->FindClass(jniEnv,
+                                                       "javax/accessibility/AccessibleContext" );
+  jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv,
+                                          classAccessibleContext,
+                                          "getLocale",
+                                          "()Ljavax/accessibility/AccessibleContext;");
+  jobject locale = (*jniEnv)->CallObjectMethod( jniEnv, ac, jmid );
+  JawImpl *target_obj = jaw_impl_get_instance(jniEnv, locale);
+  if(target_obj == NULL)
+    return NULL;
+
+  return atk_object_get_object_locale((AtkObject*) target_obj);
+}
+


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]