From 9f55f8f2358c82e4bb547c8206db0e3340595941 Mon Sep 17 00:00:00 2001 From: Jasmine Hassan Date: Mon, 17 Dec 2012 09:01:23 +0200 Subject: [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 --- libmate-desktop/mate-bg.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'libmate-desktop') 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; } } -- cgit v1.2.1