示例#1
0
文件: UgData1.c 项目: erdincay/uget2
gpointer	ug_datalist_copy (gpointer datalist)
{
	UgDatalist*		newlist;
	UgDatalist*		newdata;
	UgDatalist*		src;

	newlist = NULL;
	for (src = ug_datalist_last (datalist);  src;  src = src->prev) {
		if (src->iface->assign) {
			newdata = ug_data1_copy (src);
			newlist = ug_datalist_prepend (newlist, newdata);
		}
	}
	return newlist;
}
示例#2
0
gpointer	ug_dataset_alloc_front (UgDataset* dataset, const UgData1Interface* iface)
{
	UgDatalist**	list;
	UgDatalist*		link;

//	assert (iface != NULL);

	list = ug_dataset_get_list (dataset, iface);
	if (list == NULL)
		list = ug_dataset_alloc_list (dataset, iface);

	link = ug_data1_new (iface);
	*list = ug_datalist_prepend (*list, link);

	return link;
}
示例#3
0
文件: UgPlugin.c 项目: Endz0/uget
void	ug_plugin_post (UgPlugin* plugin, UgMessage* message)
{
	UgMessage*	link;

	message->src = plugin;

	g_mutex_lock (&plugin->lock);
	// Remove repeated progress message from queue
	link = plugin->messages;
	if (message->type == UG_MESSAGE_PROGRESS && link && link->type == UG_MESSAGE_PROGRESS)
		plugin->messages = link->next;
	else
		link = NULL;
	// prepend new message
	plugin->messages = ug_datalist_prepend (plugin->messages, message);
	g_mutex_unlock (&plugin->lock);

	// free repeated progress message here to reduce lock time
	if (link)
		ug_data_free (link);
}