summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nautilus-directory-async.c24
-rw-r--r--src/nautilus-directory-private.h6
-rw-r--r--src/nautilus-directory.c23
3 files changed, 53 insertions, 0 deletions
diff --git a/src/nautilus-directory-async.c b/src/nautilus-directory-async.c
index d5b93b5ac..813f2fb25 100644
--- a/src/nautilus-directory-async.c
+++ b/src/nautilus-directory-async.c
@@ -578,6 +578,9 @@ new_files_cancel (NautilusDirectory *directory)
g_list_free (directory->details->new_files_in_progress);
directory->details->new_files_in_progress = NULL;
}
+
+ g_clear_list (&directory->details->new_files_in_progress_changes,
+ (GDestroyNotify) g_object_unref);
}
static int
@@ -931,6 +934,23 @@ should_skip_file (NautilusDirectory *directory,
return FALSE;
}
+static void
+process_files_changed_while_being_added (NautilusDirectory *directory)
+{
+ if (directory->details->new_files_in_progress_changes == NULL)
+ {
+ return;
+ }
+
+ directory->details->new_files_in_progress_changes =
+ g_list_reverse (directory->details->new_files_in_progress_changes);
+
+ nautilus_directory_notify_files_changed (directory->details->new_files_in_progress_changes);
+
+ g_clear_list (&directory->details->new_files_in_progress_changes,
+ (GDestroyNotify) g_object_unref);
+}
+
static gboolean
dequeue_pending_idle_callback (gpointer callback_data)
{
@@ -1084,6 +1104,10 @@ dequeue_pending_idle_callback (gpointer callback_data)
directory->details->directory_loaded_sent_notification = TRUE;
}
+ /* Process changes received for files while they were still being added.
+ * See Bug 703179 and issue #1576 for a situation this happens. */
+ process_files_changed_while_being_added (directory);
+
drain:
g_list_free_full (pending_file_info, g_object_unref);
diff --git a/src/nautilus-directory-private.h b/src/nautilus-directory-private.h
index 8f1a23590..d0b3f3dad 100644
--- a/src/nautilus-directory-private.h
+++ b/src/nautilus-directory-private.h
@@ -100,6 +100,12 @@ struct NautilusDirectoryDetails
GList *new_files_in_progress; /* list of NewFilesState * */
+ /* List of GFile's that received CHANGE events while new files were being added in
+ * that same folder. We will process this CHANGE events after new_files_in_progress
+ * list is finished. See Bug 703179 and issue #1576 for a case when this happens.
+ */
+ GList *new_files_in_progress_changes;
+
DirectoryCountState *count_in_progress;
NautilusFile *deep_count_file;
diff --git a/src/nautilus-directory.c b/src/nautilus-directory.c
index 527b6bf93..a0e3dd34f 100644
--- a/src/nautilus-directory.c
+++ b/src/nautilus-directory.c
@@ -1319,6 +1319,8 @@ nautilus_directory_notify_files_changed (GList *files)
GHashTable *changed_lists;
GList *node;
GFile *location;
+ GFile *parent;
+ NautilusDirectory *dir;
NautilusFile *file;
/* Make a list of changed files in each directory. */
@@ -1345,6 +1347,27 @@ nautilus_directory_notify_files_changed (GList *files)
hash_table_list_prepend (changed_lists, directory, file);
}
+ else
+ {
+ parent = g_file_get_parent (location);
+ dir = nautilus_directory_get_existing (parent);
+ if (dir != NULL && dir->details->new_files_in_progress != NULL &&
+ files != dir->details->new_files_in_progress_changes)
+ {
+ dir->details->new_files_in_progress_changes =
+ g_list_prepend (dir->details->new_files_in_progress_changes,
+ g_object_ref (location));
+ }
+
+ if (dir != NULL)
+ {
+ nautilus_directory_unref (dir);
+ }
+ if (parent != NULL)
+ {
+ g_object_unref (parent);
+ }
+ }
}
/* Now send out the changed signals. */