static G_CONST_RETURN gchar*
jaw_object_get_name (AtkObject *atk_obj)
{
	JawObject *jaw_obj = JAW_OBJECT(atk_obj);
	jobject ac = jaw_obj->acc_context;
	JNIEnv *jniEnv = jaw_util_get_jni_env();

	if (atk_object_get_role(atk_obj) == ATK_ROLE_COMBO_BOX
			&& atk_object_get_n_accessible_children(atk_obj) == 1) {
		AtkSelection *selection = ATK_SELECTION(atk_obj);
		if (selection != NULL) {
			AtkObject *child = atk_selection_ref_selection(selection, 0);
			if (child != NULL) {
				return atk_object_get_name(child);
			}
		}
	}
	
	jclass classAccessibleContext = (*jniEnv)->FindClass( jniEnv, "javax/accessibility/AccessibleContext" );
	jmethodID jmid = (*jniEnv)->GetMethodID( jniEnv, classAccessibleContext, "getAccessibleName", "()Ljava/lang/String;" );
	jstring jstr = (*jniEnv)->CallObjectMethod( jniEnv, ac, jmid );

	if (atk_obj->name != NULL) {
		(*jniEnv)->ReleaseStringUTFChars(jniEnv, jaw_obj->jstrName, atk_obj->name);
		(*jniEnv)->DeleteGlobalRef(jniEnv, jaw_obj->jstrName);
	}

	if (jstr != NULL) {
		jaw_obj->jstrName = (*jniEnv)->NewGlobalRef(jniEnv, jstr);
		atk_obj->name = (gchar*)(*jniEnv)->GetStringUTFChars(jniEnv, jaw_obj->jstrName, NULL);
	}

	return atk_obj->name;
}
JNIEXPORT jlong JNICALL
Java_org_gnome_atk_AtkSelection_atk_1selection_1ref_1selection
(
	JNIEnv* env,
	jclass cls,
	jlong _self,
	jint _i
)
{
	AtkObject* result;
	jlong _result;
	AtkSelection* self;
	gint i;

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

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

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

	// cleanup parameter self

	// cleanup parameter i

	// translate return value to JNI type
	_result = (jlong) result;

	// cleanup return value
	if (result != NULL) {
		bindings_java_memory_cleanup((GObject*)result, FALSE);
	}

	// and finally
	return _result;
}
static void
ea_day_view_main_item_time_change_cb (EDayView *day_view,
                                      gpointer data)
{
	EaDayViewMainItem *ea_main_item;
	AtkObject *item_cell = NULL;

	g_return_if_fail (E_IS_DAY_VIEW (day_view));
	g_return_if_fail (data);
	g_return_if_fail (EA_IS_DAY_VIEW_MAIN_ITEM (data));

	ea_main_item = EA_DAY_VIEW_MAIN_ITEM (data);

#ifdef ACC_DEBUG
	printf ("EvoAcc: ea_day_view_main_item time changed cb\n");
#endif
	/* only deal with the first selected child, for now */
	item_cell = atk_selection_ref_selection (
		ATK_SELECTION (ea_main_item), 0);
	if (item_cell) {
		AtkStateSet *state_set;
		state_set = atk_object_ref_state_set (item_cell);
		atk_state_set_add_state (state_set, ATK_STATE_FOCUSED);
		g_object_unref (state_set);

		g_signal_emit_by_name (
			ea_main_item,
			"active-descendant-changed",
			item_cell);
		g_signal_emit_by_name (data, "selection_changed");

		atk_focus_tracker_notify (item_cell);
		g_object_unref (item_cell);
	}

}
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;
}