diff options
author | Tomas Bzatek <tbzatek@redhat.com> | 2012-06-15 18:22:22 +0200 |
---|---|---|
committer | Tomas Bzatek <tbzatek@redhat.com> | 2012-06-15 18:28:44 +0200 |
commit | 1009c22ee4e633044312f7a21499a422e91cf0be (patch) | |
tree | abc7f2bb5a8c9d7b599acf58a447818fbba6a8ff | |
parent | 75a83428dd70ba2738e99e9215cbdee182faada1 (diff) | |
download | nautilus-1009c22ee4e633044312f7a21499a422e91cf0be.tar.gz |
Fix rename cancellation
This changes the way the wait dialog cancellation callback works. Instead of
cleaning up early we just cancel the operation and wait for proper
rename_callback() carrying the error.
This fixes an assertion failure when the wait dialog has been displayed and user
pressed the Cancel button. Unlikely to happen, found during gvfs testing.
-rw-r--r-- | src/nautilus-error-reporting.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/nautilus-error-reporting.c b/src/nautilus-error-reporting.c index db67dd61e..b6a162d6c 100644 --- a/src/nautilus-error-reporting.c +++ b/src/nautilus-error-reporting.c @@ -264,6 +264,7 @@ rename_callback (NautilusFile *file, GFile *result_location, GError *error, gpointer callback_data) { NautilusRenameData *data; + gboolean cancelled = FALSE; g_assert (NAUTILUS_IS_FILE (file)); g_assert (callback_data == NULL); @@ -271,23 +272,22 @@ rename_callback (NautilusFile *file, GFile *result_location, data = g_object_get_data (G_OBJECT (file), NEW_NAME_TAG); g_assert (data != NULL); - if (error && - !(error->domain == G_IO_ERROR && error->code == G_IO_ERROR_CANCELLED)) { + if (error) { + if (!(error->domain == G_IO_ERROR && error->code == G_IO_ERROR_CANCELLED)) { /* If rename failed, notify the user. */ nautilus_report_error_renaming_file (file, data->name, error, NULL); + } else { + cancelled = TRUE; + } } - finish_rename (file, TRUE, error); + finish_rename (file, ! cancelled, error); } static void cancel_rename_callback (gpointer callback_data) { - GError *error; - - error = g_error_new (G_IO_ERROR, G_IO_ERROR_CANCELLED, "Cancelled"); - finish_rename (NAUTILUS_FILE (callback_data), FALSE, error); - g_error_free (error); + nautilus_file_cancel (NAUTILUS_FILE (callback_data), rename_callback, NULL); } static void |