GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Tue Oct 21, 2014 7:03 am

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Need help in slideshow
PostPosted: Sat Nov 26, 2011 8:28 pm 
Offline

Joined: Sun Oct 02, 2011 4:47 pm
Posts: 2
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 :)


Top
 Profile  
 
 Post subject: Re: Need help in slideshow
PostPosted: Sun Nov 27, 2011 7:25 pm 
Offline
Never Seen the Sunlight

Joined: Mon Apr 28, 2008 5:52 am
Posts: 764
Location: UK
Hi,

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.

_________________
E.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


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

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group