After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 630498 - Better support for one-slide slideshows
Better support for one-slide slideshows
Status: RESOLVED FIXED
Product: gnome-desktop
Classification: Core
Component: libgnome-desktop
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Desktop Maintainers
Desktop Maintainers
Depends on:
Blocks:
 
 
Reported: 2010-09-24 09:23 UTC by Vincent Untz
Modified: 2011-02-09 12:15 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GnomeBG: Better support for slideshows with one slide (1.50 KB, patch)
2010-09-24 09:23 UTC, Vincent Untz
reviewed Details | Review
gnome-bg: Do not add timeout for one-slide slideshows (1.71 KB, patch)
2011-02-09 12:15 UTC, Vincent Untz
committed Details | Review

Description Vincent Untz 2010-09-24 09:23:29 UTC
A slideshow with one slide can be useful to support multiple sizes for a background image.

But with only one slide, we do not have to timeout for transitions -- it's just using CPU for nothing, since nautilus will re-render the same image.
Comment 1 Vincent Untz 2010-09-24 09:23:48 UTC
Created attachment 171008 [details] [review]
GnomeBG: Better support for slideshows with one slide

A slideshow with one slide can be useful to support multiple sizes for a
background image.

With only one slide, we do not have to timeout for transitions.
Comment 2 Vincent Untz 2010-09-24 09:33:17 UTC
I consider that Ray is closer than me to what is a maintainer for GnomeBG, so I'll let Ray review this :-)
Comment 3 Ray Strode [halfline] 2010-09-24 14:06:04 UTC
Well, Søren is gnome-bg-man-extraordinaire but he's a pretty busy guy, so I'll be happy to look at this patch for you.
Comment 4 Ray Strode [halfline] 2010-09-24 14:28:04 UTC
Review of attachment 171008 [details] [review]:

Overall, the patch looks okay.  If you just want to commit this after the freeze, I think it's a nice win and probably won't cause any issues.

Looking in get_pixbuf_for_size, though, I see:

→       →       time_until_next_change = G_MAXUINT;•
...
→       →       →       →       time_until_next_change = (guint)get_slide_timeout (slide);•
...
→       →       /* If the next slideshow step is a long time away then•    
→       →          we blow away the expensive stuff (large pixbufs) from•  
→       →          the cache */•                                           
→       →       if (time_until_next_change > KEEP_EXPENSIVE_CACHE_SECS)•   
→       →           blow_expensive_caches_in_idle (bg);•                   

So, if there is an expensive cache, it might be nice to do away with it as well.  I think we can kill both birds with one stone.

In read_slideshow_file, it already examines the queue of slides to see if there are no slides.  It would be natural, then to add 1-slide check after the 0-slide check. If there's only one slide, then override that slide's duration to some sentinal that means "no timeout" (G_MAXUINT is sort of used for that in the above code, so that's probably a good value to use).  Then get_slide_timeout () would return that duration, and ensure_timeout (which also calls get_slide_timeout ()) would just need to refuse to queue a timeout if get_slide_timeout () returns "no timeout".

If you go this route, then you don't need to modify any of the callers of ensure_timeout and everything should "just work" including the cache blowing code I think.
Comment 5 Vincent Untz 2011-02-09 12:15:15 UTC
The following fix has been pushed:
adf18a2 gnome-bg: Do not add timeout for one-slide slideshows
Comment 6 Vincent Untz 2011-02-09 12:15:19 UTC
Created attachment 180458 [details] [review]
gnome-bg: Do not add timeout for one-slide slideshows

If a slideshow is made of only one slide, then there's no animation. So
we just override the duration of the slide to G_MAXUINT, and we do not
add timeouts for such durations.