changeset 744:eb7e0d3206a2

Move code from slideshow_timer_reset() to new slideshow_timer_stop() and simplify calls.
author zas_
date Fri, 23 May 2008 12:19:42 +0000
parents 77ff94c0490a
children 41dc324ee014
files src/slideshow.c
diffstat 1 files changed, 18 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/src/slideshow.c	Fri May 23 00:20:56 2008 +0000
+++ b/src/slideshow.c	Fri May 23 12:19:42 2008 +0000
@@ -22,14 +22,14 @@
 #include "ui_fileops.h"
 
 
-static void slideshow_timer_reset(SlideShowData *ss, gint reset);
+static void slideshow_timer_stop(SlideShowData *ss);
 
 
 void slideshow_free(SlideShowData *ss)
 {
 	if (!ss) return;
 
-	slideshow_timer_reset(ss, FALSE);
+	slideshow_timer_stop(ss);
 
 	if (ss->stop_func) ss->stop_func(ss, ss->stop_data);
 
@@ -271,21 +271,21 @@
 	return TRUE;
 }
 
-static void slideshow_timer_reset(SlideShowData *ss, gint reset)
+static void slideshow_timer_stop(SlideShowData *ss)
 {
-	if (reset)
-		{
-		if (options->slideshow.delay < 1) options->slideshow.delay = 1;
+	if (ss->timeout_id == -1) return;
+
+	g_source_remove(ss->timeout_id);
+	ss->timeout_id = -1;
+}
 
-		if (ss->timeout_id != -1) g_source_remove(ss->timeout_id);
-		ss->timeout_id = g_timeout_add(options->slideshow.delay * 1000 / SLIDESHOW_SUBSECOND_PRECISION,
-					       slideshow_loop_cb, ss);
-		}
-	else if (ss->timeout_id != -1)
-		{
-		g_source_remove(ss->timeout_id);
-		ss->timeout_id = -1;
-		}
+static void slideshow_timer_reset(SlideShowData *ss)
+{
+	if (options->slideshow.delay < 1) options->slideshow.delay = 1;
+
+	if (ss->timeout_id != -1) g_source_remove(ss->timeout_id);
+	ss->timeout_id = g_timeout_add(options->slideshow.delay * 1000 / SLIDESHOW_SUBSECOND_PRECISION,
+				       slideshow_loop_cb, ss);
 }
 
 void slideshow_next(SlideShowData *ss)
@@ -298,7 +298,7 @@
 		return;
 		}
 
-	slideshow_timer_reset(ss, TRUE);
+	slideshow_timer_reset(ss);
 }
 
 void slideshow_prev(SlideShowData *ss)
@@ -311,7 +311,7 @@
 		return;
 		}
 
-	slideshow_timer_reset(ss, TRUE);
+	slideshow_timer_reset(ss);
 }
 
 static SlideShowData *real_slideshow_start(ImageWindow *imd, LayoutWindow *lw,
@@ -381,7 +381,7 @@
 	ss->slide_fd = file_data_ref(image_get_fd(ss->imd));
 	if (slideshow_step(ss, TRUE))
 		{
-		slideshow_timer_reset(ss, TRUE);
+		slideshow_timer_reset(ss);
 
 		ss->stop_func = stop_func;
 		ss->stop_data = stop_data;