[java-atk-wrapper] JNI: create jaw_object_ref_child
- From: Magdalen Berns <mberns src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [java-atk-wrapper] JNI: create jaw_object_ref_child
- Date: Tue, 9 Jun 2015 14:04:35 +0000 (UTC)
commit 317befbd83a102e66927c26bceb6fe2726bd4dd0
Author: Magdalen Berns <m berns thismagpie com>
Date: Tue Jun 9 15:02:56 2015 +0100
JNI: create jaw_object_ref_child
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=750640
HACKING | 5 -----
jni/src/jawimpl.c | 36 ------------------------------------
jni/src/jawobject.c | 36 ++++++++++++++++++++++++++++++++++++
jni/src/jawobject.h | 2 --
4 files changed, 36 insertions(+), 43 deletions(-)
---
diff --git a/HACKING b/HACKING
index 30d64fc..cfb2390 100644
--- a/HACKING
+++ b/HACKING
@@ -39,17 +39,12 @@ TODO Currently Not fully documented by ATK
Object base class:
AtkFunction
implementor_ref_accessible
- get_parent
peek_parent
- get_n_accessible_children # get_n_children currently implemented
- ref_accessible_child
ref_relation_set
set_name
set_description
set_parent
set_role
- notify_state_change
- object_initialize
add_relationship
remove_relationship
get_attributes
diff --git a/jni/src/jawimpl.c b/jni/src/jawimpl.c
index 104642f..3693cd3 100644
--- a/jni/src/jawimpl.c
+++ b/jni/src/jawimpl.c
@@ -43,7 +43,6 @@ static gpointer jaw_impl_get_interface_data(JawObject *jaw_obj, guint iface);
/* AtkObject */
static void jaw_impl_initialize(AtkObject *atk_obj, gpointer data);
static AtkObject* jaw_impl_get_parent(AtkObject *atk_obj);
-static AtkObject* jaw_impl_ref_child (AtkObject *atk_obj, gint i);
static AtkRelationSet* jaw_impl_ref_relation_set(AtkObject *atk_obj);
extern void jaw_action_interface_init(AtkActionIface*);
@@ -452,7 +451,6 @@ jaw_impl_class_init(JawImplClass *klass)
AtkObjectClass *atk_class = ATK_OBJECT_CLASS (klass);
atk_class->initialize = jaw_impl_initialize;
atk_class->get_parent = jaw_impl_get_parent;
- atk_class->ref_child = jaw_impl_ref_child;
atk_class->ref_relation_set = jaw_impl_ref_relation_set;
JawObjectClass *jaw_class = JAW_OBJECT_CLASS (klass);
@@ -578,43 +576,9 @@ jaw_impl_get_parent (AtkObject *atk_obj)
return obj;
}
}
-
return ATK_OBJECT(atk_get_root());
}
-static AtkObject*
-jaw_impl_ref_child (AtkObject *atk_obj, gint i)
-{
- 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,
- "getAccessibleChild",
- "(I)Ljavax/accessibility/Accessible;" );
- jobject jchild = (*jniEnv)->CallObjectMethod( jniEnv, ac, jmid, i );
- if (jchild == NULL)
- {
- return NULL;
- }
-
- jclass classAccessible = (*jniEnv)->FindClass( jniEnv, "javax/accessibility/Accessible" );
- jmid = (*jniEnv)->GetMethodID(jniEnv,
- classAccessible,
- "getAccessibleContext",
- "()Ljavax/accessibility/AccessibleContext;" );
- jobject child_ac = (*jniEnv)->CallObjectMethod( jniEnv, jchild, jmid );
-
- AtkObject *obj = (AtkObject*) jaw_impl_get_instance( jniEnv, child_ac );
- if (G_OBJECT(obj) != NULL)
- g_object_ref(G_OBJECT(obj));
-
- return obj;
-}
-
static jstring
get_java_relation_key_constant (JNIEnv *jniEnv, const gchar* strKey)
{
diff --git a/jni/src/jawobject.c b/jni/src/jawobject.c
index 469bd12..adf3f21 100644
--- a/jni/src/jawobject.c
+++ b/jni/src/jawobject.c
@@ -23,6 +23,7 @@
#include "jawobject.h"
#include "jawwindow.h"
#include "jawutil.h"
+#include "jawimpl.h"
#include "jawtoplevel.h"
static void jaw_object_class_init(JawObjectClass *klass);
@@ -43,6 +44,7 @@ static AtkObject* jaw_object_get_parent(AtkObject *obj);
static void jaw_object_state_change (AtkObject *atk_obj,
const gchar *state,
gboolean state_set);
+static AtkObject * jaw_object_ref_child (AtkObject *atk_obj, gint i);
static gpointer parent_class = NULL;
@@ -65,6 +67,7 @@ jaw_object_class_init (JawObjectClass *klass)
atk_class->ref_state_set = jaw_object_ref_state_set;
atk_class->initialize = jaw_object_initialize;
atk_class->state_change = jaw_object_state_change;
+ atk_class->ref_child = jaw_object_ref_child;
/* atk_class->set_name = jaw_object_set_name;
atk_class->set_description = jaw_object_set_description;
atk_class->set_parent = jaw_object_set_parent;
@@ -280,6 +283,39 @@ jaw_object_get_role (AtkObject *atk_obj)
return atk_obj->role;
}
+static AtkObject*
+jaw_object_ref_child (AtkObject *atk_obj, gint i)
+{
+ 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,
+ "getAccessibleChild",
+ "(I)Ljavax/accessibility/Accessible;" );
+ jobject jchild = (*jniEnv)->CallObjectMethod( jniEnv, ac, jmid, i );
+ if (jchild == NULL)
+ {
+ return NULL;
+ }
+
+ jclass classAccessible = (*jniEnv)->FindClass( jniEnv, "javax/accessibility/Accessible" );
+ jmid = (*jniEnv)->GetMethodID(jniEnv,
+ classAccessible,
+ "getAccessibleContext",
+ "()Ljavax/accessibility/AccessibleContext;" );
+ jobject child_ac = (*jniEnv)->CallObjectMethod( jniEnv, jchild, jmid );
+
+ AtkObject *obj = (AtkObject*) jaw_impl_get_instance( jniEnv, child_ac );
+ if (G_OBJECT(obj) != NULL)
+ g_object_ref(G_OBJECT(obj));
+
+ return obj;
+}
+
static AtkStateSet*
jaw_object_ref_state_set (AtkObject *atk_obj)
{
diff --git a/jni/src/jawobject.h b/jni/src/jawobject.h
index b81677f..ad9e159 100644
--- a/jni/src/jawobject.h
+++ b/jni/src/jawobject.h
@@ -39,12 +39,10 @@ typedef struct _JawObjectClass JawObjectClass;
struct _JawObject
{
AtkObject parent;
-
jobject acc_context;
jstring jstrName;
jstring jstrDescription;
AtkStateSet *state_set;
-
GHashTable *storedData;
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]