summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasmine Hassan <[email protected]>2012-12-17 09:01:23 +0200
committerJasmine Hassan <[email protected]>2012-12-17 09:17:20 +0200
commit9f55f8f2358c82e4bb547c8206db0e3340595941 (patch)
treef201a441656d18c87dbac1383b16cd3b9853e495
parent70bcfe5a43b9699fe64a0439d0fb6b7526bd0cfd (diff)
downloadmate-desktop-9f55f8f2358c82e4bb547c8206db0e3340595941.tar.bz2
mate-desktop-9f55f8f2358c82e4bb547c8206db0e3340595941.tar.xz
[mate-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. https://bugzilla.gnome.org/show_bug.cgi?id=630498 http://git.gnome.org/browse/gnome-desktop/commit/?id=adf18a2cf78c26a33c7a00210fc29020e935e0c1
-rw-r--r--libmate-desktop/mate-bg.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/libmate-desktop/mate-bg.c b/libmate-desktop/mate-bg.c
index 08ed5a2..f150622 100644
--- a/libmate-desktop/mate-bg.c
+++ b/libmate-desktop/mate-bg.c
@@ -2096,9 +2096,13 @@ ensure_timeout (MateBG *bg,
{
if (!bg->timeout_id) {
double timeout = get_slide_timeout (slide);
- bg->timeout_id = g_timeout_add_full (
- G_PRIORITY_LOW,
- timeout * 1000, on_timeout, bg, NULL);
+
+ /* G_MAXUINT means "only one slide" */
+ if (timeout < G_MAXUINT) {
+ bg->timeout_id = g_timeout_add_full (
+ G_PRIORITY_LOW,
+ timeout * 1000, on_timeout, bg, NULL);
+ }
}
}
@@ -3053,16 +3057,24 @@ read_slideshow_file (const char *filename,
g_markup_parse_context_free (context);
if (show) {
+ int len;
+
t = mktime (&show->start_tm);
show->start_time = (double)t;
dump_bg (show);
+ len = g_queue_get_length (show->slides);
+
/* no slides, that's not a slideshow */
- if (g_queue_get_length (show->slides) == 0) {
+ if (len == 0) {
slideshow_unref (show);
show = NULL;
+ /* one slide, there's no transition */
+ } else if (len == 1) {
+ Slide *slide = show->slides->head->data;
+ slide->duration = G_MAXUINT;
}
}