From 06f91028408205fa55ef24c5553d058f5feba3e3 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 6 Jul 2015 21:39:39 -0400 Subject: [PATCH] file chooser: Allow rename-to-self When checking for a name clash for renaming, don't complain if the name is unchanged. That's harmless. --- gtk/gtkfilechooserwidget.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c index c68dde536b..c6370650ee 100644 --- a/gtk/gtkfilechooserwidget.c +++ b/gtk/gtkfilechooserwidget.c @@ -1022,6 +1022,7 @@ check_valid_child_name (GtkFileChooserWidget *impl, GFile *parent, const gchar *name, gboolean is_folder, + GFile *original, GtkWidget *error_label, GtkWidget *button) { @@ -1056,6 +1057,11 @@ check_valid_child_name (GtkFileChooserWidget *impl, gtk_label_set_text (GTK_LABEL (error_label), error->message); g_error_free (error); } + else if (original && g_file_equal (original, file)) + { + gtk_widget_set_sensitive (button, TRUE); + g_object_unref (file); + } else { struct FileExistsData *data; @@ -1106,6 +1112,7 @@ new_folder_name_changed (GtkEntry *entry, priv->current_folder, gtk_entry_get_text (entry), TRUE, + NULL, priv->new_folder_error_label, priv->new_folder_create_button); } @@ -1532,6 +1539,7 @@ rename_file_name_changed (GtkEntry *entry, priv->current_folder, gtk_entry_get_text (entry), file_type == G_FILE_TYPE_DIRECTORY, + priv->rename_file_source_file, priv->rename_file_error_label, priv->rename_file_rename_button); }