예제 #1
0
/* Change View */
static void
toolbar_it_cb(void *data, Evas_Object *obj, void *event_info)
{
	Evas_Object *nf = data;
	Evas_Object *sub_view;
	Elm_Object_Item *it;
	const char *str = NULL;

	it = event_info;

	str = elm_object_item_text_get(it);

	if (str == NULL || !strcmp(str, "Main")) {
		sub_view = create_main_list(nf);
	} else if (!strcmp(str, "Playlist")) {
		sub_view = create_play_list(nf);
	} else if (!strcmp(str, "Artists list")) {
		sub_view = create_artists_list(nf);
	} else if (!strcmp(str, "Songs")) {
		sub_view = create_song_list(nf);
	} else if (!strcmp(str, "Dialer")) {
		sub_view = create_dialer_list(nf);
	} else {
		sub_view = create_main_list(nf);
	}

	elm_object_content_set(nf, sub_view);
}
void test_for_memory_leaks() {
	int x;
	board *board;
	play *play;
	play_list *pl;
	
	/*
	printf( "Hit enter to test board creation and deletion\n" );
	getchar();
	*/
	printf( "Testing board creation and deletion\n" );
	for( x = 0; x < 100000; x++ ) {
		board = create_board( );
		// printf( "%d\n", board );
		delete_board( board );
	}
		// printf( "%d\n", board );

	/*
	printf( "Hit enter to test play creation and deletion\n" );
	getchar();
	*/
	printf( "Testing play creation and deletion\n" );
	for( x = 0; x < 100000; x++ ) {
		play = create_play( );
		printf( "%d\n", play );
		delete_play( play );
	}
	printf( "%d\n", play );

	/*
	printf( "Hit enter to test play list creation and deletion\n" );
	getchar();
	*/

	printf( "Testing play list creation and deletion\n" );
	for( x = 0; x < 1000000; x++ ) { 
		pl = create_play_list( 5 );
		/* print_play_list( pl ); */
		printf( "%d\n", pl );
		delete_play_list( pl );
	}
	printf( "%d\n", pl );
}
play_list *create_possible_plays( board *b, int player ) {
	play_list *pl;
	play *p, *cp;
	int cur, x, y, xn, yn, play_count;

	/* count the possible places to move */
	play_count = 0;
	for( x = 0; x < 3; x++ ){
		for( y = 0; y < 3; y++ ){
			if( b->state[x][y] == BLANK ) {
				play_count++;
			}
		}
	}

	pl = create_play_list( play_count );

	cur = 0;
	for( x = 0; x < 3; x++ ){
		for( y = 0; y < 3; y++ ){
			if( b->state[x][y] == BLANK ) {
				/* populate new board with values of new play */
				for( xn = 0; xn < 3; xn++ ){
					for( yn = 0; yn < 3; yn++ ){
						if ( ( xn == x ) && ( yn == y ) ) {
							pl->plays[cur]->board->state[xn][yn] = player;
						} else {
							pl->plays[cur]->board->state[xn][yn] = b->state[xn][yn];
						}
					}
				}
				cur++;
			}
		}
	}
	return pl;
}
예제 #4
0
RET_CODE win_set_imageplay_param(PlayListHandle *pplaylist, UINT32 idx, UINT8 folder_flag)
{
	UINT8 back_saved;
	RET_CODE retcode = RET_SUCCESS;
	FileInfo filenode;
	char image_name[FULL_PATH_SIZE];
	int playlist_idx;

	image_folderloop_flag = folder_flag;
	if(image_folderloop_flag == 1)
	{
		if(*pplaylist != NULL)
		{
			if(RET_SUCCESS != delete_play_list(*pplaylist))
			{
				return RET_FAILURE;
			}
		}
		*pplaylist = create_play_list(IMAGE_PLAY_LIST, "folder_image");
		if(*pplaylist == NULL)
		{
			return RET_FAILURE;
		}
		
		get_file_from_file_list(cur_filelist, idx, &filenode);
		win_get_fullname(image_name, filenode.path, filenode.name);
		win_compopup_init(WIN_POPUP_TYPE_SMSG);
		win_compopup_set_frame(200, 200, 200, 100);
		win_compopup_set_msg(NULL, NULL,RS_DISPLAY_PLEASE_WAIT);
		win_compopup_open_ext(&back_saved);
		retcode = add_all_file_list_items_to_play_list(*pplaylist, cur_filelist);
		osal_task_sleep(500);
		win_compopup_smsg_restoreback();
		if(retcode != RET_SUCCESS)
		{
			return RET_FAILURE;
		}
		if((filenode.filetype == F_JPG) || (filenode.filetype == F_BMP))
		{
			playlist_idx = get_play_list_index_by_name(*pplaylist, image_name);
		}
		else
		{
			playlist_idx = 1;
		}
		if(playlist_idx == -1)
		{
			return RET_FAILURE;
		}
		cur_playlist_image = *pplaylist;
		cur_image_idx = playlist_idx;
	}
	else
	{
		cur_playlist_image = *pplaylist;
		cur_image_idx = idx;
	}
	set_play_list_info(cur_playlist_image, &cur_image_idx, NULL);

	return RET_SUCCESS;
}