/*  Copyright (C) 2001-2002  Kenichi Suto
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/


#include "defs.h"

void set_link(CONTENT_AREA *content_area, LINK *link)
{
	LINK *l;

	g_assert(link != NULL);

	l = calloc(sizeof(LINK), 1);
	l->type = link->type;
	l->start_x = link->start_x;
	l->start_y = link->start_y;
	l->end_x = link->end_x;
	l->end_y = link->end_y;
	l->page = link->page;
	l->offset = link->offset;
	l->size = link->size;
	if(strlen(link->filename) <= 255)
		strcpy(l->filename, link->filename);

	content_area->link = g_list_append(content_area->link, l);

}


void clear_link(CONTENT_AREA *content_area)
{
	GList *item;

	item = g_list_first(content_area->link);
	while(item){
		free(item->data);
		item = g_list_next(item);
	}
	g_list_free(content_area->link);
	content_area->link = NULL;
}


syntax highlighted by Code2HTML, v. 0.9.1