Example #1
0
JNIEXPORT jstring JNICALL
Java_org_gnome_atk_AtkAction_atk_1action_1get_1description
(
	JNIEnv* env,
	jclass cls,
	jlong _self,
	jint _i
)
{
	const gchar* result;
	jstring _result;
	AtkAction* self;
	gint i;

	// convert parameter self
	self = (AtkAction*) _self;

	// convert parameter i
	i = (gint) _i;

	// call function
	result = atk_action_get_description(self, i);

	// cleanup parameter self

	// cleanup parameter i

	// translate return value to JNI type
	_result = (jstring) bindings_java_newString(env, result);

	// and finally
	return _result;
}
Example #2
0
static DBusMessage *
impl_get_description (DBusConnection * bus, DBusMessage * message,
                      void *user_data)
{
  AtkAction *action = (AtkAction *) user_data;
  DBusMessage *reply;
  dbus_int32_t index;
  const char *desc;

  g_return_val_if_fail (ATK_IS_ACTION (user_data),
                        droute_not_yet_handled_error (message));
  if (!dbus_message_get_args
      (message, NULL, DBUS_TYPE_INT32, &index, DBUS_TYPE_INVALID))
    {
      return droute_invalid_arguments_error (message);
    }
  desc = atk_action_get_description (action, index);
  if (!desc)
    desc = "";
  reply = dbus_message_new_method_return (message);
  if (reply)
    {
      dbus_message_append_args (reply, DBUS_TYPE_STRING, &desc,
                                DBUS_TYPE_INVALID);
    }
  return reply;
}
Example #3
0
static DBusMessage *
impl_GetActions (DBusConnection * bus, DBusMessage * message, void *user_data)
{
  AtkAction *action = (AtkAction *) user_data;
  DBusMessage *reply;
  gint count;
  gint i;
  DBusMessageIter iter, iter_array, iter_struct;

  g_return_val_if_fail (ATK_IS_ACTION (user_data),
                        droute_not_yet_handled_error (message));
  count = atk_action_get_n_actions (action);
  reply = dbus_message_new_method_return (message);
  if (!reply)
    goto oom;
  dbus_message_iter_init_append (reply, &iter);
  if (!dbus_message_iter_open_container
      (&iter, DBUS_TYPE_ARRAY, "(sss)", &iter_array))
    goto oom;
  for (i = 0; i < count; i++)
    {
      const char *name = atk_action_get_name (action, i);
      const char *lname = atk_action_get_localized_name (action, i);
      const char *desc = atk_action_get_description (action, i);
      const char *kb = atk_action_get_keybinding (action, i);
      if (!name)
        name = "";
      if (!lname)
        lname = "";
      if (!desc)
        desc = "";
      if (!kb)
        kb = "";
      if (!dbus_message_iter_open_container
          (&iter_array, DBUS_TYPE_STRUCT, NULL, &iter_struct))
        goto oom;
      dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_STRING, &name);
      dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_STRING, &lname);
      dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_STRING, &desc);
      dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_STRING, &kb);
      if (!dbus_message_iter_close_container (&iter_array, &iter_struct))
        goto oom;
    }
  if (!dbus_message_iter_close_container (&iter, &iter_array))
    goto oom;
  return reply;
oom:
  // TODO: handle out-of-memory
  return reply;
}
static void
_test_slideshow_object(AtkObject *obj)
{
   int child_count, selection_count, action_count;
   AtkObject *child, *selection;
   gboolean result;
   const gchar *action_name, *action_description;
   /*sometimes this is called several times*/
   static int tested = 0;
   fprintf(stdout, "Testing slideshow\n");
   if (tested > 0) return;
   tested++;

   g_object_ref(obj);

   g_assert(eailu_is_object_with_role(obj, ATK_ROLE_LIST));

   child_count = atk_object_get_n_accessible_children(obj);
   g_assert(child_count == 9);

   for (int i = 0; i < child_count; i++)
     {
        child = atk_object_ref_accessible_child(obj, i);
        AtkRole role = atk_object_get_role(child);
        fprintf(stdout, "index %d child role: %s\n", i,
                atk_role_get_name(role));
        g_assert(eailu_is_object_with_role(child, ATK_ROLE_IMAGE));
        g_object_unref(child);
     }

   /*test AtkSelectionIface*/
   g_assert(ATK_IS_SELECTION(obj));
   selection = atk_selection_ref_selection(ATK_SELECTION(obj), 0);
   /*this may fail due to a problem with  slideshow cache*/
   g_assert(ATK_IS_OBJECT(selection));
   g_assert(eailu_is_object_with_role(selection, ATK_ROLE_IMAGE));
   g_object_unref(selection);
   selection_count = atk_selection_get_selection_count(ATK_SELECTION(obj));
   g_assert(selection_count == 1);
   result = atk_selection_add_selection(ATK_SELECTION(obj), 5);
   g_assert(result);
   result = atk_selection_is_child_selected(ATK_SELECTION(obj), 5);
   g_assert(result);

   /*test AtkActionIface*/
   g_assert(ATK_IS_ACTION(obj));
   /* test set/get action description */
   eailu_test_action_description_all(ATK_ACTION(obj));
   action_count = atk_action_get_n_actions(ATK_ACTION(obj));
   g_assert(4 == action_count);
   action_name = atk_action_get_name(ATK_ACTION(obj), 0);
   g_assert(!strcmp("next", action_name));
   action_name = atk_action_get_name(ATK_ACTION(obj), 1);
   g_assert(!strcmp("previous", action_name));
   result = atk_action_set_description(ATK_ACTION(obj), 2,
                                       "start the slideshow");
   g_assert(result);
   action_description = atk_action_get_description(ATK_ACTION(obj), 2);
   g_assert(!strcmp("start the slideshow", action_description));
   result = atk_action_do_action(ATK_ACTION(obj), 0);
   g_assert(result);
   result = atk_selection_is_child_selected(ATK_SELECTION(obj), 6);
   g_assert(result);

   eailu_test_atk_focus(obj, TRUE);

   g_object_unref(obj);
   eail_test_code_called = TRUE;
}