changeset 2769:ed8cc78cb9dd

Option to change default button for copy/move dialogs Option on Preferences/Behavior to use With Rename as the default button for Copy/Move dialogs. The option is off by default.
author Colin Clark <colin.clark@cclark.uk>
date Thu, 07 Jun 2018 14:13:43 +0100
parents 7d275582e37d
children 2e819f4a7a41
files src/options.c src/options.h src/preferences.c src/rcfile.c src/utilops.c
diffstat 5 files changed, 23 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/options.c	Thu Jun 07 11:44:36 2018 +0100
+++ b/src/options.c	Thu Jun 07 14:13:43 2018 +0100
@@ -82,6 +82,7 @@
 	options->fullscreen.screen = -1;
 
 	options->marks_save = TRUE;
+	options->with_rename = FALSE;
 
 	memset(&options->image.border_color, 0, sizeof(options->image.border_color));
 	memset(&options->image.alpha_color_1, 0, sizeof(options->image.alpha_color_1));
--- a/src/options.h	Thu Jun 07 11:44:36 2018 +0100
+++ b/src/options.h	Thu Jun 07 14:13:43 2018 +0100
@@ -64,6 +64,8 @@
 	gboolean marks_save;		// save marks on exit
 	gchar *marks_tooltips[FILEDATA_MARKS_SIZE];
 
+	gboolean with_rename;
+
 	gchar *help_search_engine;
 
 	/* info sidebar component heights */
--- a/src/preferences.c	Thu Jun 07 11:44:36 2018 +0100
+++ b/src/preferences.c	Thu Jun 07 14:13:43 2018 +0100
@@ -409,6 +409,7 @@
 	options->info_rating.height = c_options->info_rating.height;
 
 	options->marks_save = c_options->marks_save;
+	options->with_rename = c_options->with_rename;
 	config_entry_to_option(help_search_engine_entry, &options->help_search_engine, NULL);
 
 #ifdef DEBUG
@@ -2372,6 +2373,7 @@
 	GtkWidget *spin;
 	GtkWidget *table;
 	GtkWidget *marks;
+	GtkWidget *with_rename;
 
 	vbox = scrolled_notebook_page(notebook, _("Behavior"));
 
@@ -2429,6 +2431,10 @@
 				options->marks_save, &c_options->marks_save);
 	gtk_widget_set_tooltip_text(marks,"Note that marks linked to a keyword will be saved irrespective of this setting");
 
+	with_rename = pref_checkbox_new_int(group, _("Use \"With Rename\" as default for Copy/Move dialogs"),
+				options->with_rename, &c_options->with_rename);
+	gtk_widget_set_tooltip_text(with_rename,"Change the default button for Copy/Move dialogs");
+
 	pref_spin_new_int(group, _("Recent folder list maximum size"), NULL,
 			  1, 50, 1, options->open_recent_list_maxsize, &c_options->open_recent_list_maxsize);
 
--- a/src/rcfile.c	Thu Jun 07 11:44:36 2018 +0100
+++ b/src/rcfile.c	Thu Jun 07 14:13:43 2018 +0100
@@ -346,6 +346,8 @@
 	WRITE_NL(); WRITE_BOOL(*options, marks_save);
 	WRITE_NL(); WRITE_CHAR(*options, help_search_engine);
 
+	WRITE_NL(); WRITE_BOOL(*options, with_rename);
+
 	/* File operations Options */
 	WRITE_NL(); WRITE_BOOL(*options, file_ops.enable_in_place_rename);
 	WRITE_NL(); WRITE_BOOL(*options, file_ops.confirm_delete);
@@ -675,6 +677,8 @@
 		/* Properties dialog options */
 		if (READ_CHAR(*options, properties.tabs_order)) continue;
 
+		if (READ_BOOL(*options, with_rename)) continue;
+
 		/* Image options */
 		if (READ_UINT_CLAMP(*options, image.zoom_mode, 0, ZOOM_RESET_NONE)) continue;
 		if (READ_BOOL(*options, image.zoom_2pass)) continue;
--- a/src/utilops.c	Thu Jun 07 11:44:36 2018 +0100
+++ b/src/utilops.c	Thu Jun 07 14:13:43 2018 +0100
@@ -1584,8 +1584,16 @@
 	gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
 	pref_spacer(GENERIC_DIALOG(fdlg)->vbox, 0);
 
-	file_dialog_add_button(fdlg, GTK_STOCK_EDIT, "With Rename", file_util_fdlg_rename_cb, TRUE);
-	file_dialog_add_button(fdlg, stock_id, ud->messages.title, file_util_fdlg_ok_cb, TRUE);
+	if (options->with_rename)
+		{
+		file_dialog_add_button(fdlg, stock_id, ud->messages.title, file_util_fdlg_ok_cb, TRUE);
+		file_dialog_add_button(fdlg, GTK_STOCK_EDIT, "With Rename", file_util_fdlg_rename_cb, TRUE);
+		}
+	else
+		{
+		file_dialog_add_button(fdlg, GTK_STOCK_EDIT, "With Rename", file_util_fdlg_rename_cb, TRUE);
+		file_dialog_add_button(fdlg, stock_id, ud->messages.title, file_util_fdlg_ok_cb, TRUE);
+		}
 
 	file_dialog_add_path_widgets(fdlg, NULL, ud->dest_path, "move_copy", NULL, NULL);