GNOME Bugzilla – Bug 630498
Better support for one-slide slideshows
Last modified: 2011-02-09 12:15:19 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.
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.
I consider that Ray is closer than me to what is a maintainer for GnomeBG, so I'll let Ray review this :-)
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.
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.
The following fix has been pushed: adf18a2 gnome-bg: Do not add timeout for one-slide slideshows
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.