summaryrefslogtreecommitdiff
path: root/src/nautilus-files-view.c
diff options
context:
space:
mode:
authorCarlos Soriano <csoriano@gnome.org>2015-11-12 13:29:55 +0100
committerCarlos Soriano <csoriano@gnome.org>2015-11-13 01:31:31 +0100
commitbf09c8fc2793e0db4b67c967252dd7be29888344 (patch)
tree11ea579fb3628e0fda66158ca83617af8e6451ba /src/nautilus-files-view.c
parent42ef7dba7fdbc6190630e4b18d412eda29891a04 (diff)
downloadnautilus-bf09c8fc2793e0db4b67c967252dd7be29888344.tar.gz
files-view: adapt rename entry length
We are having some problems given that the rename entry is kind of small for some file names, and that makes the rename popover vs inline renaming kind of a problem. For that, increase the default entry length and adapt for longer names with a MIN/MAX length. https://bugzilla.gnome.org/show_bug.cgi?id=757180 https://bugzilla.gnome.org/show_bug.cgi?id=757694
Diffstat (limited to 'src/nautilus-files-view.c')
-rw-r--r--src/nautilus-files-view.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index 8f6fc377e..2eaf4e952 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -115,6 +115,9 @@
#define DUPLICATE_HORIZONTAL_ICON_OFFSET 70
#define DUPLICATE_VERTICAL_ICON_OFFSET 30
+#define RENAME_ENTRY_MIN_CHARS 20
+#define RENAME_ENTRY_MAX_CHARS 35
+
#define MAX_QUEUED_UPDATES 500
#define MAX_MENU_LEVELS 5
@@ -2058,6 +2061,7 @@ nautilus_files_view_rename_file_popover_new (NautilusFilesView *view,
GtkBuilder *builder;
gint start_offset, end_offset;
GdkRectangle *relative_to;
+ gint n_chars;
if (view->details->rename_file_popover != NULL)
return;
@@ -2109,6 +2113,9 @@ nautilus_files_view_rename_file_popover_new (NautilusFilesView *view,
/* 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 (widget_data->name_entry),
+ MIN (MAX (n_chars, RENAME_ENTRY_MIN_CHARS), RENAME_ENTRY_MAX_CHARS));
gtk_editable_select_region (GTK_EDITABLE (widget_data->name_entry),
start_offset, end_offset);