PDA

View Full Version : GTK SlideShow



sgtlaugh
November 27th, 2011, 12:06 PM
How do I create a slideshow with gtk? I've written a next function which displays the next image but it's not working:


void start_slide()
{
for(; ;){

g_usleep(1000000); // Wait for 1 second
show_next(); // Displays the next image
}
}

Please help. Thank you.

crdlb
November 27th, 2011, 09:19 PM
You're blocking the whole program when you sleep like that. Instead, use g_timeout_add or g_timeout_add_seconds to make the mainloop call a function after the specified time interval. In this case, you should probably use the _seconds variant for power efficiency.