diff src/slideshow.c @ 318:b16b9b8979e5

Add a new struct ConfOptions to handle options. Changes were made among the code to use only one global var named "options" of type ConfOptions *. Initialization takes place in new init_options().
author zas_
date Fri, 11 Apr 2008 22:14:36 +0000
parents 9995c5fb202a
children 509b84801d66
line wrap: on
line diff
--- a/src/slideshow.c	Fri Apr 11 20:35:37 2008 +0000
+++ b/src/slideshow.c	Fri Apr 11 22:14:36 2008 +0000
@@ -94,7 +94,7 @@
 
 	if (ss->list) g_list_free(ss->list);
 
-	if (slideshow_random)
+	if (options->slideshow_random)
 		{
 		ss->list = generate_random_list(ss);
 		}
@@ -183,7 +183,7 @@
 	if (ss->filelist)
 		{
 		ss->slide_fd = file_data_ref((FileData *)g_list_nth_data(ss->filelist, row));
-		image_change_fd(ss->imd, ss->slide_fd, image_zoom_get_default(ss->imd, zoom_mode));
+		image_change_fd(ss->imd, ss->slide_fd, image_zoom_get_default(ss->imd, options->zoom_mode));
 		}
 	else if (ss->cd)
 		{
@@ -192,7 +192,7 @@
 		info = g_list_nth_data(ss->cd->list, row);
 		ss->slide_fd = file_data_ref(info->fd);
 
-		image_change_from_collection(ss->imd, ss->cd, info, image_zoom_get_default(ss->imd, zoom_mode));
+		image_change_from_collection(ss->imd, ss->cd, info, image_zoom_get_default(ss->imd, options->zoom_mode));
 		}
 	else
 		{
@@ -200,7 +200,7 @@
 
 		if (ss->from_selection)
 			{
-			image_change_fd(ss->imd, ss->slide_fd, image_zoom_get_default(ss->imd, zoom_mode));
+			image_change_fd(ss->imd, ss->slide_fd, image_zoom_get_default(ss->imd, options->zoom_mode));
 			layout_status_update_info(ss->layout, NULL);
 			}
 		else
@@ -209,7 +209,7 @@
 			}
 		}
 
-	if (!ss->list && slideshow_repeat)
+	if (!ss->list && options->slideshow_repeat)
 		{
 		slideshow_list_init(ss, -1);
 		}
@@ -221,7 +221,7 @@
 
 	/* read ahead */
 
-	if (enable_read_ahead)
+	if (options->enable_read_ahead)
 		{
 		gint r;
 		if (forward)
@@ -274,10 +274,10 @@
 {
 	if (reset)
 		{
-		if (slideshow_delay < 1) slideshow_delay = 1;
+		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(slideshow_delay * 1000 / SLIDESHOW_SUBSECOND_PRECISION,
+		ss->timeout_id = g_timeout_add(options->slideshow_delay * 1000 / SLIDESHOW_SUBSECOND_PRECISION,
 					       slideshow_loop_cb, ss);
 		}
 	else if (ss->timeout_id != -1)
@@ -350,7 +350,7 @@
 		{
 		collection_ref(ss->cd);
 		ss->slide_count = g_list_length(ss->cd->list);
-		if (!slideshow_random && start_info)
+		if (!options->slideshow_random && start_info)
 			{
 			start_index = g_list_index(ss->cd->list, start_info);
 			}
@@ -364,7 +364,7 @@
 		if (ss->slide_count < 2)
 			{
 			ss->slide_count = layout_list_count(ss->layout, NULL);
-			if (!slideshow_random && start_point >= 0 && start_point < ss->slide_count)
+			if (!options->slideshow_random && start_point >= 0 && start_point < ss->slide_count)
 				{
 				start_index = start_point;
 				}