Skip to content

Commit

Permalink
Rename slideshow options.
Browse files Browse the repository at this point in the history
  • Loading branch information
Laurent Monin committed Apr 12, 2008
1 parent 4c1a8d7 commit e671126
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 30 deletions.
6 changes: 3 additions & 3 deletions src/globals.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
16 changes: 8 additions & 8 deletions src/preferences.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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 */
Expand Down
18 changes: 9 additions & 9 deletions src/rcfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down Expand Up @@ -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 */

Expand Down
12 changes: 6 additions & 6 deletions src/slideshow.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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);
}
Expand All @@ -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;
}
Expand Down
8 changes: 5 additions & 3 deletions src/typedefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit e671126

Please sign in to comment.