[java-atk-wrapper] JNI: create jaw_object_set_description
- From: Magdalen Berns <mberns src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [java-atk-wrapper] JNI: create jaw_object_set_description
- Date: Sun, 21 Jun 2015 18:28:42 +0000 (UTC)
commit d6dc33cf9c7b4ee00023a47e4fb4332233169d53
Author: Magdalen Berns <m berns thismagpie com>
Date: Sun Jun 21 19:27:53 2015 +0100
JNI: create jaw_object_set_description
Patch d24df6e does not apply
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=750649
jni/src/jawobject.c | 37 +++++++++++++++++++++++++++++++++++++
1 files changed, 37 insertions(+), 0 deletions(-)
---
diff --git a/jni/src/jawobject.c b/jni/src/jawobject.c
index e8999bc..c2f71a8 100644
--- a/jni/src/jawobject.c
+++ b/jni/src/jawobject.c
@@ -43,6 +43,7 @@ static AtkStateSet* jaw_object_ref_state_set(AtkObject *atk_obj);
static AtkObject* jaw_object_get_parent(AtkObject *obj);
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 gpointer parent_class = NULL;
@@ -89,6 +90,7 @@ jaw_object_class_init (JawObjectClass *klass)
atk_class->get_name = jaw_object_get_name;
atk_class->set_name = jaw_object_set_name;
atk_class->get_description = jaw_object_get_description;
+ atk_class->set_description = jaw_object_set_description;
atk_class->get_n_children = jaw_object_get_n_children;
atk_class->get_index_in_parent = jaw_object_get_index_in_parent;
atk_class->get_role = jaw_object_get_role;
@@ -314,6 +316,41 @@ jaw_object_get_description (AtkObject *atk_obj)
return atk_obj->description;
}
+static void jaw_object_set_description (AtkObject *atk_obj, const gchar *description)
+{
+ 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,
+ "setAccessibleDescription",
+ "(Ljava/lang/String;)");
+ jstring jstr = (*jniEnv)->CallObjectMethod( jniEnv, ac, jmid );
+
+ if (description != NULL)
+ {
+ (*jniEnv)->ReleaseStringUTFChars(jniEnv, jaw_obj->jstrDescription, description);
+ (*jniEnv)->DeleteGlobalRef(jniEnv, jaw_obj->jstrDescription);
+ description = NULL;
+ }
+
+ if (jstr != NULL)
+ {
+ jaw_obj->jstrDescription = (*jniEnv)->NewGlobalRef(jniEnv, jstr);
+ description = (gchar*)(*jniEnv)->GetStringUTFChars(jniEnv,
+ jaw_obj->jstrDescription,
+ NULL);
+ }
+ if (jstr != NULL)
+ {
+ description = "";
+ }
+}
+
+
static gint
jaw_object_get_n_children (AtkObject *atk_obj)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]