#include <gio/gio.h>
#include <glib.h>
#include <stdio.h>

static GMainLoop *loop;

static gboolean copy_finished_cb(GObject *source_object,GAsyncResult *res,gpointer user_data) {
	printf("finished\n");
	GFile *dest=g_file_new_for_path("/home/firari/cia2.jpg");
	g_file_copy_finish(dest,res,NULL);
	g_main_loop_quit(loop);
}

int main() {
	g_type_init();
	GFile *source=NULL, *dest=NULL;
	GError *err=NULL;
	source=g_file_new_for_path("/home/serkan/source.jpg");
	if(source==NULL)
		return 1;
	dest=g_file_new_for_path("/home/serkan/source.jpg");
	if(dest==NULL)
		return 2;
	g_file_copy_async(source,dest,G_FILE_COPY_NONE,G_PRIORITY_DEFAULT,NULL,NULL,NULL,(GAsyncReadyCallback)copy_finished_cb,NULL);
	loop = g_main_loop_new(NULL,FALSE);
	g_main_loop_run(loop);
}
