diff options
author | Razvan Chitu <razvan.ch95@gmail.com> | 2016-11-04 14:00:20 +0200 |
---|---|---|
committer | Razvan Chitu <razvan.ch95@gmail.com> | 2016-11-08 20:17:50 +0200 |
commit | 56736b5abda3382a2e19781e44fd5f51e138e481 (patch) | |
tree | 8e47caa5b762590e96d5fe7646e6a505029d36e1 /src | |
parent | 3aa5ecff55b2480052f8bab5e6ea6803f1d1366a (diff) | |
download | nautilus-56736b5abda3382a2e19781e44fd5f51e138e481.tar.gz |
rename-file-popover-controller: select entire name for folders
When renaming a file, the extension is not selected for editing, even if the
file is a directory. In order to fix this, deselect the extension only if the
renamed file is of regular type.
https://bugzilla.gnome.org/show_bug.cgi?id=759718
Diffstat (limited to 'src')
-rw-r--r-- | src/nautilus-rename-file-popover-controller.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/nautilus-rename-file-popover-controller.c b/src/nautilus-rename-file-popover-controller.c index 9d47b389e..2f148bbd6 100644 --- a/src/nautilus-rename-file-popover-controller.c +++ b/src/nautilus-rename-file-popover-controller.c @@ -199,13 +199,19 @@ nautilus_rename_file_popover_controller_new (NautilusFile *target_file, gtk_popover_popup (GTK_POPOVER (rename_file_popover)); - /* Select the name part withouth the file extension */ - eel_filename_get_rename_region (nautilus_file_get_display_name (target_file), - &start_offset, &end_offset); - n_chars = g_utf8_strlen (nautilus_file_get_display_name (target_file), -1); - gtk_entry_set_width_chars (GTK_ENTRY (name_entry), - MIN (MAX (n_chars, RENAME_ENTRY_MIN_CHARS), RENAME_ENTRY_MAX_CHARS)); - gtk_editable_select_region (GTK_EDITABLE (name_entry), start_offset, end_offset); + if (nautilus_file_is_regular_file (target_file)) + { + /* Select the name part without the file extension */ + eel_filename_get_rename_region (nautilus_file_get_display_name (target_file), + &start_offset, &end_offset); + n_chars = g_utf8_strlen (nautilus_file_get_display_name (target_file), + -1); + gtk_entry_set_width_chars (GTK_ENTRY (name_entry), + MIN (MAX (n_chars, RENAME_ENTRY_MIN_CHARS), + RENAME_ENTRY_MAX_CHARS)); + gtk_editable_select_region (GTK_EDITABLE (name_entry), + start_offset, end_offset); + } nautilus_directory_unref (containing_directory); |