Rename slideshow options.
authorLaurent Monin <geeqie@norz.org>
Sat, 12 Apr 2008 07:46:01 +0000 (07:46 +0000)
committerLaurent Monin <geeqie@norz.org>
Sat, 12 Apr 2008 07:46:01 +0000 (07:46 +0000)
src/globals.c
src/main.c
src/preferences.c
src/rcfile.c
src/slideshow.c
src/typedefs.h

index 8ed3ed6..89dfd65 100644 (file)
@@ -75,9 +75,9 @@ ConfOptions *init_options(ConfOptions *options)
        options->file_sort_method = SORT_NAME;
        options->file_sort_ascending = TRUE;
        
-       options->slideshow_delay = 150;
-       options->slideshow_random = FALSE;
-       options->slideshow_repeat = FALSE;
+       options->slideshow.delay = 150;
+       options->slideshow.random = FALSE;
+       options->slideshow.repeat = FALSE;
        
        options->mousewheel_scrolls = FALSE;
        options->enable_in_place_rename = TRUE;
index 9940728..dd6f79c 100644 (file)
@@ -403,7 +403,7 @@ static void gr_slideshow_delay(const gchar *text, gpointer data)
 
                return;
                }
-       options->slideshow_delay = (gint)(n * 10.0 + 0.01);
+       options->slideshow.delay = (gint)(n * 10.0 + 0.01);
 }
 
 static void gr_tools_show(const gchar *text, gpointer data)
index 638d4c8..12011f5 100644 (file)
@@ -133,7 +133,7 @@ static void zoom_increment_cb(GtkWidget *spin, gpointer data)
 
 static void slideshow_delay_cb(GtkWidget *spin, gpointer data)
 {
-       c_options->slideshow_delay = (gint)(gtk_spin_button_get_value(GTK_SPIN_BUTTON(spin)) *
+       c_options->slideshow.delay = (gint)(gtk_spin_button_get_value(GTK_SPIN_BUTTON(spin)) *
                                   (double)SLIDESHOW_SUBSECOND_PRECISION + 0.01);
 }
 
@@ -214,9 +214,9 @@ static void config_window_apply(void)
 
        sidecar_ext_parse(gtk_entry_get_text(GTK_ENTRY(sidecar_ext_entry)), FALSE);
 
-       options->slideshow_random = c_options->slideshow_random;
-       options->slideshow_repeat = c_options->slideshow_repeat;
-       options->slideshow_delay = c_options->slideshow_delay;
+       options->slideshow.random = c_options->slideshow.random;
+       options->slideshow.repeat = c_options->slideshow.repeat;
+       options->slideshow.delay = c_options->slideshow.delay;
 
        options->mousewheel_scrolls = c_options->mousewheel_scrolls;
 
@@ -847,15 +847,15 @@ static void config_tab_general(GtkWidget *notebook)
 
        group = pref_group_new(vbox, FALSE, _("Slide show"), GTK_ORIENTATION_VERTICAL);
 
-       c_options->slideshow_delay = options->slideshow_delay;
+       c_options->slideshow.delay = options->slideshow.delay;
        spin = pref_spin_new(group, _("Delay between image change:"), _("seconds"),
                             SLIDESHOW_MIN_SECONDS, SLIDESHOW_MAX_SECONDS, 1.0, 1,
-                            options->slideshow_delay ? (double)options->slideshow_delay / SLIDESHOW_SUBSECOND_PRECISION : 10.0,
+                            options->slideshow.delay ? (double)options->slideshow.delay / SLIDESHOW_SUBSECOND_PRECISION : 10.0,
                             G_CALLBACK(slideshow_delay_cb), NULL);
        gtk_spin_button_set_update_policy(GTK_SPIN_BUTTON(spin), GTK_UPDATE_ALWAYS);
 
-       pref_checkbox_new_int(group, _("Random"), options->slideshow_random, &c_options->slideshow_random);
-       pref_checkbox_new_int(group, _("Repeat"), options->slideshow_repeat, &c_options->slideshow_repeat);
+       pref_checkbox_new_int(group, _("Random"), options->slideshow.random, &c_options->slideshow.random);
+       pref_checkbox_new_int(group, _("Repeat"), options->slideshow.repeat, &c_options->slideshow.repeat);
 }
 
 /* image tab */
index 384929b..095e38b 100644 (file)
@@ -372,10 +372,10 @@ void save_options(void)
 
        secure_fprintf(ssi, "\n##### Slideshow Options #####\n\n");
 
-       write_int_unit_option(ssi, "slideshow_delay", options->slideshow_delay, SLIDESHOW_SUBSECOND_PRECISION);
+       write_int_unit_option(ssi, "slideshow.delay", options->slideshow.delay, SLIDESHOW_SUBSECOND_PRECISION);
 
-       write_bool_option(ssi, "slideshow_random", options->slideshow_random);
-       write_bool_option(ssi, "slideshow_repeat", options->slideshow_repeat);
+       write_bool_option(ssi, "slideshow.random", options->slideshow.random);
+       write_bool_option(ssi, "slideshow.repeat", options->slideshow.repeat);
 
        secure_fprintf(ssi, "\n##### Filtering Options #####\n\n");
 
@@ -678,12 +678,12 @@ void load_options(void)
 
                /* slideshow options */
 
-               options->slideshow_delay = read_int_unit_option(f, option,
-                       "slideshow_delay", value, options->slideshow_delay, SLIDESHOW_SUBSECOND_PRECISION);
-               options->slideshow_random = read_bool_option(f, option,
-                       "slideshow_random", value, options->slideshow_random);
-               options->slideshow_repeat = read_bool_option(f, option,
-                       "slideshow_repeat", value, options->slideshow_repeat);
+               options->slideshow.delay = read_int_unit_option(f, option,
+                       "slideshow.delay", value, options->slideshow.delay, SLIDESHOW_SUBSECOND_PRECISION);
+               options->slideshow.random = read_bool_option(f, option,
+                       "slideshow.random", value, options->slideshow.random);
+               options->slideshow.repeat = read_bool_option(f, option,
+                       "slideshow.repeat", value, options->slideshow.repeat);
 
                /* filtering options */
 
index 063e0c5..7d92b97 100644 (file)
@@ -94,7 +94,7 @@ static void slideshow_list_init(SlideShowData *ss, gint start_index)
 
        if (ss->list) g_list_free(ss->list);
 
-       if (options->slideshow_random)
+       if (options->slideshow.random)
                {
                ss->list = generate_random_list(ss);
                }
@@ -209,7 +209,7 @@ static gint slideshow_step(SlideShowData *ss, gint forward)
                        }
                }
 
-       if (!ss->list && options->slideshow_repeat)
+       if (!ss->list && options->slideshow.repeat)
                {
                slideshow_list_init(ss, -1);
                }
@@ -274,10 +274,10 @@ static void slideshow_timer_reset(SlideShowData *ss, gint reset)
 {
        if (reset)
                {
-               if (options->slideshow_delay < 1) options->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(options->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 @@ static SlideShowData *real_slideshow_start(ImageWindow *imd, LayoutWindow *lw,
                {
                collection_ref(ss->cd);
                ss->slide_count = g_list_length(ss->cd->list);
-               if (!options->slideshow_random && start_info)
+               if (!options->slideshow.random && start_info)
                        {
                        start_index = g_list_index(ss->cd->list, start_info);
                        }
@@ -364,7 +364,7 @@ static SlideShowData *real_slideshow_start(ImageWindow *imd, LayoutWindow *lw,
                if (ss->slide_count < 2)
                        {
                        ss->slide_count = layout_list_count(ss->layout, NULL);
-                       if (!options->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;
                                }
index a5c45cf..cf33669 100644 (file)
@@ -786,9 +786,11 @@ struct _ConfOptions
        SortType file_sort_method;
        gint file_sort_ascending;
 
-       gint slideshow_delay;   /* in tenths of a second */
-       gint slideshow_random;
-       gint slideshow_repeat;
+       struct {
+               gint delay;     /* in tenths of a second */
+               gint random;
+               gint repeat;
+       } slideshow;
 
        gint mousewheel_scrolls;
        gint enable_in_place_rename;