コード例 #1
0
ファイル: collect-io.c プロジェクト: thaidao/Workspace_Ex
void collect_manager_moved(const gchar *oldpath, const gchar *newpath)
{
	CollectManagerAction *action;

	action = collect_manager_action_new(oldpath, newpath, COLLECTION_MANAGER_UPDATE);
	collect_manager_add_action(action);
}
コード例 #2
0
ファイル: collect-io.c プロジェクト: GroupO/geeqie_zas
void collect_manager_moved(FileData *fd)
{
	CollectManagerAction *action;
	const gchar *oldpath = fd->change->source;
	const gchar *newpath = fd->change->dest;

	action = collect_manager_action_new(oldpath, newpath, COLLECTION_MANAGER_UPDATE);
	collect_manager_add_action(action);
}
コード例 #3
0
ファイル: collect-io.c プロジェクト: thaidao/Workspace_Ex
void collect_manager_remove(const gchar *path, const gchar *collection)
{
	CollectManagerAction *action;
	CollectWindow *cw;

	if (!path || !collection) return;

	cw = collection_window_find_by_path(collection);
	if (cw)
		{
		while (collection_remove(cw->cd, path));
		return;
		}

	action = collect_manager_action_new(path, collection, COLLECTION_MANAGER_REMOVE);
	collect_manager_add_action(action);
}
コード例 #4
0
ファイル: collect-io.c プロジェクト: thaidao/Workspace_Ex
void collect_manager_add(const gchar *path, const gchar *collection)
{
	CollectManagerAction *action;
	CollectWindow *cw;

	if (!path || !collection) return;

	cw = collection_window_find_by_path(collection);
	if (cw)
		{
		if (collection_list_find(cw->cd->list, path) == NULL)
			{
			collection_add(cw->cd, path, FALSE);
			}
		return;
		}

	action = collect_manager_action_new(path, collection, COLLECTION_MANAGER_ADD);
	collect_manager_add_action(action);
}
コード例 #5
0
ファイル: collect-io.c プロジェクト: GroupO/geeqie_zas
static void collect_manager_entry_add_action(CollectManagerEntry *entry, CollectManagerAction *action)
{

	CollectManagerAction *orig_action;

	entry->empty = FALSE;

	if (action->oldpath == NULL)
		{
		/* add file */
		if (action->newpath == NULL)
			{
			return;
			}

		orig_action = g_hash_table_lookup(entry->newpath_hash, action->newpath);
		if (orig_action)
			{
			/* target already exists */
			log_printf("collection manager failed to add another action for target %s in collection %s\n",
				action->newpath, entry->path);
			return;
			}
		entry->add_list = g_list_append(entry->add_list, action);
		g_hash_table_insert(entry->newpath_hash, action->newpath, action);
		collect_manager_action_ref(action);
		return;
		}

	orig_action = g_hash_table_lookup(entry->newpath_hash, action->oldpath);
	if (orig_action)
		{
		/* new action with the same file */
		CollectManagerAction *new_action = collect_manager_action_new(orig_action->oldpath, action->newpath, action->type);

		if (new_action->oldpath)
			{
			g_hash_table_steal(entry->oldpath_hash, orig_action->oldpath);
			g_hash_table_insert(entry->oldpath_hash, new_action->oldpath, new_action);
			}
		else
			{
			GList *work = g_list_find(entry->add_list, orig_action);
			work->data = new_action;
			}

		g_hash_table_steal(entry->newpath_hash, orig_action->newpath);
		if (new_action->newpath)
			{
			g_hash_table_insert(entry->newpath_hash, new_action->newpath, new_action);
			}
		collect_manager_action_unref(orig_action);
		return;
		}


	orig_action = g_hash_table_lookup(entry->oldpath_hash, action->oldpath);
	if (orig_action)
		{
		/* another action for the same source, ignore */
		log_printf("collection manager failed to add another action for source %s in collection %s\n",
			action->oldpath, entry->path);
		return;
		}

	g_hash_table_insert(entry->oldpath_hash, action->oldpath, action);
	if (action->newpath)
		{
		g_hash_table_insert(entry->newpath_hash, action->newpath, action);
		}
	collect_manager_action_ref(action);
}