I want to make a slideshow of all the images in a current directory. I have prepared a function which gets the name of the next image(if any) and displays it, i.e, I have a function which is capable of displaying the next image. However, I don't know how to turn this into a slideshow. I've tried using a for loop in the next function along with clock() function from time.h for waiting but this isn't working. Most probably after entering the loop my program can't interact with gtk so gtk stops updating the window or sth(I am not sure why exactly this happens). Can anyone kindly suggest how to achieve this? Thanks a lot for the help :)

It sounds like you are trying to do a busy loop, which is a very bad thing in an event driven system. What that would do is stop GTK+ working on doing its visual updates and also consumes CPU time slowing down the rest of your system.

What you need to use is the functions g_timeout_add_seconds() or g_timeout_add() see http://developer.gnome.org/glib/stable/glib-The-Main-Event-Loop.html. These functions add a call back, which is called after a set time. This can be repeatedly or one time and can be stopped at any time. These do not use any more CPU time by busy waiting and still allows GTK to complete its own work.

Who is online

Users browsing this forum: Google [Bot] and 6 guests

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum