Commit 5e2edee2 authored by Cosimo Cecchi's avatar Cosimo Cecchi

list-view: make sure not to select the extension on rename

Delay calling gtk_editable_select_region() until after
parent a9515134
......@@ -1206,7 +1206,6 @@ cell_renderer_editing_started_cb (GtkCellRenderer *renderer,
NautilusListView *list_view)
GtkEntry *entry;
gint start_offset, end_offset;
entry = GTK_ENTRY (editable);
list_view->details->editable_widget = editable;
......@@ -1215,9 +1214,6 @@ cell_renderer_editing_started_cb (GtkCellRenderer *renderer,
g_free (list_view->details->original_name);
list_view->details->original_name = g_strdup (gtk_entry_get_text (entry));
eel_filename_get_rename_region (list_view->details->original_name,
&start_offset, &end_offset);
gtk_editable_select_region (GTK_EDITABLE (entry), start_offset, end_offset);
g_signal_connect (entry, "focus-out-event",
G_CALLBACK (editable_focus_out_cb), list_view);
......@@ -2889,6 +2885,7 @@ nautilus_list_view_start_renaming_file (NautilusView *view,
NautilusListView *list_view;
GtkTreeIter iter;
GtkTreePath *path;
gint start_offset, end_offset;
list_view = NAUTILUS_LIST_VIEW (view);
......@@ -2923,6 +2920,15 @@ nautilus_list_view_start_renaming_file (NautilusView *view,
/* set cursor also triggers editing-started, where we save the editable widget */
if (list_view->details->editable_widget != NULL) {
eel_filename_get_rename_region (list_view->details->original_name,
&start_offset, &end_offset);
gtk_editable_select_region (GTK_EDITABLE (list_view->details->editable_widget),
start_offset, end_offset);
gtk_tree_path_free (path);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment