[java-atk-wrapper/wip] JNI: Create jaw_action_set_description



commit 62fd94aff45c1dce479911b0b64a2b160b48082a
Author: Magdalen Berns <m berns thismagpie com>
Date:   Fri Jun 26 00:25:53 2015 +0100

    JNI: Create jaw_action_set_description
    
    Bug: https://bugzilla.gnome.org/show_bug.cgi?id=740543

 jni/src/jawaction.c |   31 ++++++++++++++++++++++++++++++-
 1 files changed, 30 insertions(+), 1 deletions(-)
---
diff --git a/jni/src/jawaction.c b/jni/src/jawaction.c
index 9af38d4..cbe62ac 100644
--- a/jni/src/jawaction.c
+++ b/jni/src/jawaction.c
@@ -31,6 +31,7 @@ static gint jaw_action_get_n_actions(AtkAction *action);
 static const gchar* jaw_action_get_description(AtkAction *action, gint i);
 static const gchar* jaw_action_get_name(AtkAction      *action, gint i);
 static const gchar* jaw_action_get_keybinding (AtkAction *action, gint i);
+static gboolean jaw_action_set_description (AtkAction *action, gint i, const gchar *description);
 /*static const gchar*  jaw_get_localized_name                  (AtkAction      *action,
                                                                         gint           i);*/
 
@@ -52,8 +53,8 @@ jaw_action_interface_init (AtkActionIface *iface)
   iface->get_description = jaw_action_get_description;
   iface->get_name = jaw_action_get_name;
   iface->get_keybinding = jaw_action_get_keybinding;
+  iface->set_description = jaw_action_set_description;
   iface->get_localized_name = NULL; /*jaw_get_localized_name;*/
-  iface->set_description = NULL;
 }
 
 gpointer
@@ -190,6 +191,34 @@ jaw_action_get_description (AtkAction *action, gint i)
   return data->action_description;
 }
 
+static gboolean
+jaw_action_set_description (AtkAction *action, gint i, const gchar *description)
+{
+  JawObject *jaw_obj = JAW_OBJECT(action);
+  ActionData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_ACTION);
+  jobject atk_action = data->atk_action;
+
+  JNIEnv *jniEnv = jaw_util_get_jni_env();
+  jclass classAtkAction = (*jniEnv)->FindClass(jniEnv,
+                                               "org/GNOME/Accessibility/AtkAction");
+  jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv,
+                                          classAtkAction,
+                                          "setDescription",
+                                          "(ILjava/lang/String;)Z");
+  jboolean jisset = (*jniEnv)->CallBooleanMethod(jniEnv,
+                                                 atk_action,
+                                                 jmid,
+                                                 (jint)i,
+                                                 (jstring)description);
+
+  if (jisset == JNI_TRUE)
+  {
+    return TRUE;
+  } else {
+    return FALSE;
+  }
+}
+
 static const gchar*
 jaw_action_get_name (AtkAction *action, gint i)
 {


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