[nautilus/1344-be-a-little-more-helpful-with-renaming-duplicate-files: 223/223] file-conflict-dialog: Make manual rename more convenient




commit 5aa082a53cce2ef677935dbfdeb6222d3894ed29
Author: António Fernandes <antoniof gnome org>
Date:   Sat Feb 8 19:53:51 2020 +0000

    file-conflict-dialog: Make manual rename more convenient
    
    The suggested name is in the form "original (1).txt", if the the
    conflicting name was "original.txt".
    
    The user may want to replace the "(1)" bits with something more
    meaningful, so select this region for convenience.

 src/nautilus-file-conflict-dialog.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/src/nautilus-file-conflict-dialog.c b/src/nautilus-file-conflict-dialog.c
index c48bd7bfb..92ccc3b57 100644
--- a/src/nautilus-file-conflict-dialog.c
+++ b/src/nautilus-file-conflict-dialog.c
@@ -191,8 +191,6 @@ on_expanded_notify (GtkExpander                *w,
                     GParamSpec                 *pspec,
                     NautilusFileConflictDialog *dialog)
 {
-    int start_pos, end_pos;
-
     if (gtk_expander_get_expanded (w))
     {
         gtk_widget_hide (dialog->replace_button);
@@ -201,11 +199,20 @@ on_expanded_notify (GtkExpander                *w,
 
         gtk_widget_set_sensitive (dialog->checkbox, FALSE);
 
-        if (g_strcmp0 (gtk_entry_get_text (GTK_ENTRY (dialog->entry)), dialog->conflict_name) == 0)
+        gtk_widget_grab_focus (dialog->entry);
+        if (g_strcmp0 (gtk_entry_get_text (GTK_ENTRY (dialog->entry)), dialog->suggested_name) == 0)
         {
-            gtk_widget_grab_focus (dialog->entry);
+            /* The suggested name is in the form "original (1).txt", if the
+             * the conflicting name was "original.txt". The user may want to
+             * replace the "(1)" bits with with something more meaningful, so
+             * select this region for convenience. */
+
+            int start_pos;
+            int end_pos;
+            int ignored;
 
-            eel_filename_get_rename_region (dialog->conflict_name, &start_pos, &end_pos);
+            eel_filename_get_rename_region (dialog->conflict_name, &ignored, &start_pos);
+            eel_filename_get_rename_region (dialog->suggested_name, &ignored, &end_pos);
             gtk_editable_select_region (GTK_EDITABLE (dialog->entry), start_pos, end_pos);
         }
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]