Index: libnautilus-private/nautilus-directory-async.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-directory-async.c,v
retrieving revision 1.218
diff -u -p -r1.218 nautilus-directory-async.c
--- libnautilus-private/nautilus-directory-async.c	12 Dec 2005 16:59:10 -0000	1.218
+++ libnautilus-private/nautilus-directory-async.c	23 Feb 2006 22:34:07 -0000
@@ -130,12 +130,6 @@ static void     link_info_done          
 					     const char             *icon,
 					     gulong                  drive_id,
 					     gulong                  volume_id);
-static gboolean file_needs_high_priority_work_done (NautilusDirectory *directory,
-						    NautilusFile      *file);
-static gboolean file_needs_low_priority_work_done  (NautilusDirectory *directory,
-						    NautilusFile      *file);
-static gboolean file_needs_extension_work_done  (NautilusDirectory *directory,
-						 NautilusFile      *file);
 static void     move_file_to_low_priority_queue    (NautilusDirectory *directory,
 						    NautilusFile      *file);
 static void     move_file_to_extension_queue    (NautilusDirectory *directory,
@@ -2180,7 +2174,7 @@ directory_count_stop (NautilusDirectory 
 
 static void
 directory_count_start (NautilusDirectory *directory,
-		       NautilusFile *file)
+		       NautilusFile *file, gboolean *needy)
 {
 	char *uri;
 
@@ -2193,6 +2187,7 @@ directory_count_start (NautilusDirectory
 		       wants_directory_count)) {
 		return;
 	}
+	*needy = TRUE;
 
 	if (!nautilus_file_is_directory (file)) {
 		file->details->directory_count_is_up_to_date = TRUE;
@@ -2359,7 +2354,7 @@ deep_count_stop (NautilusDirectory *dire
 
 static void
 deep_count_start (NautilusDirectory *directory,
-		  NautilusFile *file)
+		  NautilusFile *file, gboolean *needy)
 {
 	char *uri;
 
@@ -2372,6 +2367,7 @@ deep_count_start (NautilusDirectory *dir
 		       wants_deep_count)) {
 		return;
 	}
+	*needy = TRUE;
 
 	if (!nautilus_file_is_directory (file)) {
 		file->details->deep_counts_status = NAUTILUS_REQUEST_DONE;
@@ -2507,7 +2503,7 @@ mime_list_stop (NautilusDirectory *direc
 
 static void
 mime_list_start (NautilusDirectory *directory,
-		 NautilusFile *file)
+		 NautilusFile *file, gboolean *needy)
 {
 	char *uri;
 
@@ -2523,6 +2519,7 @@ mime_list_start (NautilusDirectory *dire
 		       wants_mime_list)) {
 		return;
 	}
+	*needy = TRUE;
 
 	if (!nautilus_file_is_directory (file)) {
 		g_list_free (file->details->mime_list);
@@ -2637,7 +2634,7 @@ top_left_stop (NautilusDirectory *direct
 
 static void
 top_left_start (NautilusDirectory *directory,
-		NautilusFile *file)
+		NautilusFile *file, gboolean *needy)
 {
 	char *uri;
 
@@ -2651,6 +2648,7 @@ top_left_start (NautilusDirectory *direc
 		       wants_top_left)) {
 		return;
 	}
+	*needy = TRUE;
 
 	if (!nautilus_file_contains_text (file)) {
 		g_free (file->details->top_left_text);
@@ -2763,7 +2761,7 @@ file_info_stop (NautilusDirectory *direc
 
 static void
 file_info_start (NautilusDirectory *directory,
-		 NautilusFile *file)
+		 NautilusFile *file, gboolean *needy)
 {
 	char *uri;
 	GnomeVFSURI *vfs_uri;
@@ -2781,6 +2779,8 @@ file_info_start (NautilusDirectory *dire
 	    !is_needy (file, lacks_slow_mime_type, wants_slow_mime_type)) {
 		return;
 	}
+	*needy = TRUE;
+
 	need_slow_mime = is_needy (file, always_lacks, wants_slow_mime_type);
 	
 	uri = nautilus_file_get_uri (file);
@@ -2967,7 +2967,7 @@ link_info_stop (NautilusDirectory *direc
 
 static void
 link_info_start (NautilusDirectory *directory,
-		 NautilusFile *file)
+		 NautilusFile *file, gboolean *needy)
 {
 	char *uri;
 	gboolean nautilus_style_link;
@@ -2984,6 +2984,7 @@ link_info_start (NautilusDirectory *dire
 		       wants_link_info)) {
 		return;
 	}
+	*needy = TRUE;
 
 	/* Figure out if it is a link. */
 	nautilus_style_link = nautilus_file_is_nautilus_link (file);
@@ -3129,7 +3130,7 @@ info_provider_callback (NautilusInfoProv
 
 static void
 extension_info_start (NautilusDirectory *directory,
-		      NautilusFile *file)
+		      NautilusFile *file, gboolean *needy)
 {
 	NautilusInfoProvider *provider;
 	NautilusOperationResult result;
@@ -3143,6 +3144,7 @@ extension_info_start (NautilusDirectory 
 	if (!is_needy (file, lacks_extension_info, wants_extension_info)) {
 		return;
 	}
+	*needy = TRUE;
 
 	if (!async_job_start (directory, "extension info")) {
 		return;
@@ -3179,6 +3181,7 @@ static void
 start_or_stop_io (NautilusDirectory *directory)
 {
 	NautilusFile *file;
+	gboolean needy = FALSE;
 
 	/* Start or stop reading files. */
 	file_list_start_or_stop (directory);
@@ -3196,45 +3199,45 @@ start_or_stop_io (NautilusDirectory *dir
 	while (!nautilus_file_queue_is_empty (directory->details->high_priority_queue)) {
 		file = nautilus_file_queue_head (directory->details->high_priority_queue);
 
-		if (file_needs_high_priority_work_done (directory, file)) {
-			/* Start getting attributes if possible */
-			file_info_start (directory, file);
-			link_info_start (directory, file);
+		/* Start getting attributes if possible */
+		file_info_start (directory, file, &needy);
+		link_info_start (directory, file, &needy);
+
+		if (needy) {
 			return;
-		} else {
-			move_file_to_low_priority_queue (directory, file);
 		}
+
+		move_file_to_low_priority_queue (directory, file);
 	}
 
 	/* High priority queue must be empty */
 	while (!nautilus_file_queue_is_empty (directory->details->low_priority_queue)) {
 		file = nautilus_file_queue_head (directory->details->low_priority_queue);
 
-		if (file_needs_low_priority_work_done (directory, file)) {
-			/* Start getting attributes if possible */
-			directory_count_start (directory, file);
-			deep_count_start (directory, file);
-			mime_list_start (directory, file);
-			top_left_start (directory, file);
-			return;
-		} else {
-			move_file_to_extension_queue (directory, file);
+		/* Start getting attributes if possible */
+		directory_count_start (directory, file, &needy);
+		deep_count_start (directory, file, &needy);
+		mime_list_start (directory, file, &needy);
+		top_left_start (directory, file, &needy);
 
+		if (needy) {
+			return;
 		}
+
+		move_file_to_extension_queue (directory, file);
 	}
 
 	/* Low priority queue must be empty */
 	while (!nautilus_file_queue_is_empty (directory->details->extension_queue)) {
 		file = nautilus_file_queue_head (directory->details->extension_queue);
 
-		if (file_needs_extension_work_done (directory, file)) {
-			/* Start getting attributes if possible */
-			extension_info_start (directory, file);
+		/* Start getting attributes if possible */
+		extension_info_start (directory, file, &needy);
+		if (needy) {
 			return;
-		} else {
-			nautilus_directory_remove_file_from_work_queue (directory, file);
-
 		}
+
+		nautilus_directory_remove_file_from_work_queue (directory, file);
 	}
 }
 
@@ -3427,80 +3430,12 @@ nautilus_directory_cancel_loading_file_a
 }
 
 
-
-static gboolean
-file_needs_high_priority_work_done (NautilusDirectory *directory,
-				    NautilusFile *file)
-{
-	if (is_needy (file, lacks_info, wants_info)) {
-		return TRUE;
-	}
-
-	if (is_needy (file, lacks_link_info, wants_link_info)) {
-		return TRUE;
-	}
-
-	if (is_needy (file, lacks_slow_mime_type, wants_slow_mime_type)) {
-		return TRUE;
-	}
-
-	return FALSE;
-}
-
-static gboolean
-file_needs_low_priority_work_done (NautilusDirectory *directory,
-				   NautilusFile *file)
-{
-	if (is_needy (file, lacks_directory_count, wants_directory_count)) {
-		return TRUE;
-	}
-
-	if (is_needy (file, lacks_deep_count, wants_deep_count)) {
-		return TRUE;
-	}
-
-	if (is_needy (file, lacks_mime_list, wants_mime_list)) {
-		return TRUE;
-	}
-
-	if (is_needy (file, lacks_top_left, wants_top_left)) {
-		return TRUE;
-	}
-
-	return FALSE;
-}
-
-static gboolean
-file_needs_extension_work_done (NautilusDirectory *directory,
-				   NautilusFile *file)
-{
-	if (is_needy (file, lacks_extension_info, wants_extension_info)) {
-		return TRUE;
-	}
-
-	return FALSE;
-}
-
-static gboolean
-file_needs_work_done (NautilusDirectory *directory,
-		      NautilusFile *file)
-{
-	return (file_needs_high_priority_work_done (directory, file) ||
-		file_needs_low_priority_work_done (directory, file) || 
-		file_needs_extension_work_done (directory, file));
-}
-
-
 void
 nautilus_directory_add_file_to_work_queue (NautilusDirectory *directory,
 					   NautilusFile *file)
 {
 	g_return_if_fail (file->details->directory == directory);
 
-	if (!file_needs_work_done (directory, file)) {
-		return;
-	}
-
 	nautilus_file_queue_enqueue (directory->details->high_priority_queue,
 				     file);
 }
@@ -3541,24 +3476,12 @@ move_file_to_low_priority_queue (Nautilu
 				     file);
 	nautilus_file_queue_remove (directory->details->high_priority_queue,
 				    file);
-
-	if (!file_needs_low_priority_work_done (directory, file)) {
-		move_file_to_extension_queue (directory, file);
-
-		return;
-	}
 }
 
 static void
 move_file_to_extension_queue (NautilusDirectory *directory,
 			      NautilusFile *file)
 {
-	if (!file_needs_extension_work_done (directory, file)) {
-		nautilus_file_queue_remove (directory->details->low_priority_queue,
-					    file);
-		return;
-	}
-
 	/* Must add before removing to avoid ref underflow */
 	nautilus_file_queue_enqueue (directory->details->extension_queue,
 				     file);
