Option to change default button for copy/move dialogs
authorColin Clark <colin.clark@cclark.uk>
Thu, 7 Jun 2018 13:13:43 +0000 (14:13 +0100)
committerColin Clark <colin.clark@cclark.uk>
Thu, 7 Jun 2018 13:13:43 +0000 (14:13 +0100)
Option on Preferences/Behavior to use With Rename as the default button
for Copy/Move dialogs.
The option is off by default.

src/options.c
src/options.h
src/preferences.c
src/rcfile.c
src/utilops.c

index 99cb2c0..a3bcdb8 100644 (file)
@@ -82,6 +82,7 @@ ConfOptions *init_options(ConfOptions *options)
        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));
index 7ae033f..403e596 100644 (file)
@@ -64,6 +64,8 @@ struct _ConfOptions
        gboolean marks_save;            // save marks on exit
        gchar *marks_tooltips[FILEDATA_MARKS_SIZE];
 
+       gboolean with_rename;
+
        gchar *help_search_engine;
 
        /* info sidebar component heights */
index d29660c..86915d4 100644 (file)
@@ -409,6 +409,7 @@ static void config_window_apply(void)
        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 @@ static void config_tab_behavior(GtkWidget *notebook)
        GtkWidget *spin;
        GtkWidget *table;
        GtkWidget *marks;
+       GtkWidget *with_rename;
 
        vbox = scrolled_notebook_page(notebook, _("Behavior"));
 
@@ -2429,6 +2431,10 @@ static void config_tab_behavior(GtkWidget *notebook)
                                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);
 
index 1724840..d02c764 100644 (file)
@@ -346,6 +346,8 @@ static void write_global_attributes(GString *outstr, gint indent)
        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 @@ static gboolean load_global_params(const gchar **attribute_names, const gchar **
                /* 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;
index 3792545..4a9473b 100644 (file)
@@ -1584,8 +1584,16 @@ static void file_util_dialog_init_dest_folder(UtilityData *ud)
        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);