[nautilus] files-view: adapt rename entry length
- From: Carlos Soriano Sánchez <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] files-view: adapt rename entry length
- Date: Fri, 13 Nov 2015 00:31:55 +0000 (UTC)
commit bf09c8fc2793e0db4b67c967252dd7be29888344
Author: Carlos Soriano <csoriano gnome org>
Date: Thu Nov 12 13:29:55 2015 +0100
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
src/nautilus-files-view.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index 8f6fc37..2eaf4e9 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]