Mercurial > hg > forks > geeqie
changeset 2504:130acea2daa0
Fix #280: Set defaults for Auto Rename
https://github.com/BestImageViewer/geeqie/issues/280
Remember last used settings
author | Colin Clark <colin.clark@cclark.uk> |
---|---|
date | Sat, 17 Jun 2017 09:14:58 +0100 |
parents | 91954495cca3 |
children | d01e5b8e80d9 |
files | src/options.h src/rcfile.c src/utilops.c |
diffstat | 3 files changed, 30 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/options.h Fri Jun 16 09:45:57 2017 +0100 +++ b/src/options.h Sat Jun 17 09:14:58 2017 +0100 @@ -257,6 +257,14 @@ gboolean fs_temp_disable; } tmp; } stereo; + + /* copy move rename */ + struct { + gint auto_start; + gchar *auto_end; + gint auto_padding; + gint formatted_start; + } cp_mv_rn; }; ConfOptions *options;
--- a/src/rcfile.c Fri Jun 16 09:45:57 2017 +0100 +++ b/src/rcfile.c Sat Jun 17 09:14:58 2017 +0100 @@ -463,6 +463,12 @@ WRITE_NL(); WRITE_INT(*options, stereo.fixed_y1); WRITE_NL(); WRITE_INT(*options, stereo.fixed_x2); WRITE_NL(); WRITE_INT(*options, stereo.fixed_y2); + + /* copy move rename */ + WRITE_NL(); WRITE_INT(*options, cp_mv_rn.auto_start); + WRITE_NL(); WRITE_INT(*options, cp_mv_rn.auto_padding); + WRITE_NL(); WRITE_CHAR(*options, cp_mv_rn.auto_end); + WRITE_NL(); WRITE_INT(*options, cp_mv_rn.formatted_start); } static void write_color_profile(GString *outstr, gint indent) @@ -747,6 +753,12 @@ if (READ_INT(*options, stereo.fixed_x2)) continue; if (READ_INT(*options, stereo.fixed_y2)) continue; + /* copy move rename */ + if (READ_INT(*options, cp_mv_rn.auto_start)) continue; + if (READ_INT(*options, cp_mv_rn.auto_padding)) continue; + if (READ_CHAR(*options, cp_mv_rn.auto_end)) continue; + if (READ_INT(*options, cp_mv_rn.formatted_start)) continue; + /* Dummy options */ if (READ_DUMMY(*options, image.dither_quality, "deprecated since 2012-08-13")) continue;
--- a/src/utilops.c Fri Jun 16 09:45:57 2017 +0100 +++ b/src/utilops.c Sat Jun 17 09:14:58 2017 +0100 @@ -1291,13 +1291,19 @@ format = gtk_entry_get_text(GTK_ENTRY(ud->format_entry)); + g_free(options->cp_mv_rn.auto_end); + options->cp_mv_rn.auto_end = g_strdup(end); + options->cp_mv_rn.auto_padding = padding; + if (mode == UTILITY_RENAME_FORMATTED) { start_n = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(ud->format_spin)); + options->cp_mv_rn.formatted_start = start_n; } else { start_n = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(ud->auto_spin_start)); + options->cp_mv_rn.auto_start = start_n; } store = gtk_tree_view_get_model(GTK_TREE_VIEW(ud->listview)); @@ -1687,19 +1693,19 @@ box2 = furm_simple_vlabel(hbox, _("Start #"), FALSE); ud->auto_spin_start = pref_spin_new(box2, NULL, NULL, - 0.0, 1000000.0, 1.0, 0, 1.0, + 0.0, 1000000.0, 1.0, 0, options->cp_mv_rn.auto_start, G_CALLBACK(file_util_rename_preview_adj_cb), ud); box2 = furm_simple_vlabel(hbox, _("End text"), TRUE); - combo = history_combo_new(&ud->auto_entry_end, "", "numerical_rename_suffix", -1); + combo = history_combo_new(&ud->auto_entry_end, options->cp_mv_rn.auto_end, "numerical_rename_suffix", -1); g_signal_connect(G_OBJECT(ud->auto_entry_end), "changed", G_CALLBACK(file_util_rename_preview_entry_cb), ud); gtk_box_pack_start(GTK_BOX(box2), combo, TRUE, TRUE, 0); gtk_widget_show(combo); ud->auto_spin_pad = pref_spin_new(page, _("Padding:"), NULL, - 1.0, 8.0, 1.0, 0, 1.0, + 1.0, 8.0, 1.0, 0, options->cp_mv_rn.auto_padding, G_CALLBACK(file_util_rename_preview_adj_cb), ud); page = gtk_vbox_new(FALSE, PREF_PAD_GAP); @@ -1719,7 +1725,7 @@ box2 = furm_simple_vlabel(hbox, _("Start #"), FALSE); ud->format_spin = pref_spin_new(box2, NULL, NULL, - 0.0, 1000000.0, 1.0, 0, 1.0, + 0.0, 1000000.0, 1.0, 0, options->cp_mv_rn.formatted_start, G_CALLBACK(file_util_rename_preview_adj_cb), ud); // gtk_combo_box_set_active(GTK_COMBO_BOX(ud->combo_type), 0); /* callback will take care of the rest */