gboolean setup (void* data)
{
	if (runtime_get_surface_list () == NULL)
		return TRUE;

	Surface *surface = (Surface *) runtime_get_surface_list ()->data; 

	if (surface == NULL)
		return TRUE;
 
	TimeManager *manager = surface_get_time_manager (surface);
	ManualTimeSource *source = (ManualTimeSource *) manager->GetSource ();
    
	printf ("Setting up...\n");
	surface->SetExposeHandoffFunc (expose_handoff, NULL);
	g_idle_add (increase_timer, NULL);

	return FALSE;    
}
gboolean increase_timer (void *data)
{
	if (runtime_get_surface_list () == NULL)
		return TRUE;

	Surface *surface = (Surface *) runtime_get_surface_list ()->data; 

	if (surface == NULL)
		return TRUE;
    
	TimeManager *manager = surface_get_time_manager (surface);
	ManualTimeSource *source = (ManualTimeSource *) manager->GetSource ();

	source->SetCurrentTime (TimeSpan_FromSecondsFloat (current_time));
	current_time += 0.04; // 25 frames per second
	image_no++;

	if (current_time > 5.0) {
		printf ("ALL DONE! %d images captured\n", image_no - 1);
		exit (0);
	}

	return FALSE;
}