summaryrefslogtreecommitdiff
path: root/libnautilus-private/nautilus-directory.c
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2008-10-17 17:38:31 +0000
committerAlexander Larsson <alexl@src.gnome.org>2008-10-17 17:38:31 +0000
commit43e13a685763b3da75cb6560c5fa7f2aeb56cebc (patch)
tree54f93e8b3c10a1981605a38299731e98b13e9d29 /libnautilus-private/nautilus-directory.c
parent082fc7479627a3d2c1343d3184db01ce7c3fb6bb (diff)
downloadnautilus-43e13a685763b3da75cb6560c5fa7f2aeb56cebc.tar.gz
Add nautilus_directory_has_active_request_for_file which returns true if
2008-10-17 Alexander Larsson <alexl@redhat.com> * libnautilus-private/nautilus-directory-async.c: * libnautilus-private/nautilus-directory-private.h: Add nautilus_directory_has_active_request_for_file which returns true if monitoring or call_when_ready the file or all the files in the directory. * libnautilus-private/nautilus-directory.c: (nautilus_directory_add_file): When adding a file to a directory, if there is an outstanding request for the file, add it to the work queue so we make sure to do i/o on it. Otherwise we could for instance block a call_when_ready with file=NULL because we're waiting for something to happen on all files in the dir but the newly added file never has any i/o happen to it. svn path=/trunk/; revision=14736
Diffstat (limited to 'libnautilus-private/nautilus-directory.c')
-rw-r--r--libnautilus-private/nautilus-directory.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/libnautilus-private/nautilus-directory.c b/libnautilus-private/nautilus-directory.c
index 75ab6e1ce..10a308a5f 100644
--- a/libnautilus-private/nautilus-directory.c
+++ b/libnautilus-private/nautilus-directory.c
@@ -633,6 +633,7 @@ void
nautilus_directory_add_file (NautilusDirectory *directory, NautilusFile *file)
{
GList *node;
+ gboolean add_to_work_queue;
g_assert (NAUTILUS_IS_DIRECTORY (directory));
g_assert (NAUTILUS_IS_FILE (file));
@@ -647,9 +648,19 @@ nautilus_directory_add_file (NautilusDirectory *directory, NautilusFile *file)
directory->details->confirmed_file_count++;
- /* Ref if we are monitoring. */
+ add_to_work_queue = FALSE;
if (nautilus_directory_is_file_list_monitored (directory)) {
+ /* Ref if we are monitoring, since monitoring owns the file list. */
nautilus_file_ref (file);
+ add_to_work_queue = TRUE;
+ } else if (nautilus_directory_has_active_request_for_file (directory, file)) {
+ /* We're waiting for the file in a call_when_ready. Make sure
+ we add the file to the work queue so that said waiter won't
+ wait forever for e.g. all files in the directory to be done */
+ add_to_work_queue = TRUE;
+ }
+
+ if (add_to_work_queue) {
nautilus_directory_add_file_to_work_queue (directory, file);
}
}