[nautilus/gnome-3-22] rename-file-popover-controller: select entire name for folders
- From: Carlos Soriano <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/gnome-3-22] rename-file-popover-controller: select entire name for folders
- Date: Fri, 9 Dec 2016 23:40:24 +0000 (UTC)
commit 5a37fea5d3811239ef49a7c4bb7e384946a11508
Author: Razvan Chitu <razvan ch95 gmail com>
Date: Fri Nov 4 14:00:20 2016 +0200
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
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 9d47b38..2f148bb 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]