static NautilusRequestStatus search_directory_file_get_deep_counts (NautilusFile *file, guint *directory_count, guint *file_count, guint *unreadable_directory_count, goffset *total_size) { NautilusSearchDirectory *search_dir; NautilusFile *dir_file; GList *file_list, *l; guint dirs, files; GFileType type; search_dir = NAUTILUS_SEARCH_DIRECTORY (file->details->directory); file_list = nautilus_directory_get_file_list (file->details->directory); dirs = files = 0; for (l = file_list; l != NULL; l = l->next) { dir_file = NAUTILUS_FILE (l->data); type = nautilus_file_get_file_type (dir_file); if (type == G_FILE_TYPE_DIRECTORY) { dirs++; } else { files++; } } if (directory_count != NULL) { *directory_count = dirs; } if (file_count != NULL) { *file_count = files; } if (unreadable_directory_count != NULL) { *unreadable_directory_count = 0; } if (total_size != NULL) { /* FIXME: Maybe we want to calculate this? */ *total_size = 0; } nautilus_file_list_free (file_list); return NAUTILUS_REQUEST_DONE; }
static NautilusRequestStatus vfs_file_get_deep_counts (NautilusFile *file, guint *directory_count, guint *file_count, guint *unreadable_directory_count, goffset *total_size) { GFileType type; if (directory_count != NULL) { *directory_count = 0; } if (file_count != NULL) { *file_count = 0; } if (unreadable_directory_count != NULL) { *unreadable_directory_count = 0; } if (total_size != NULL) { *total_size = 0; } if (!nautilus_file_is_directory (file)) { return NAUTILUS_REQUEST_DONE; } if (file->details->deep_counts_status != NAUTILUS_REQUEST_NOT_STARTED) { if (directory_count != NULL) { *directory_count = file->details->deep_directory_count; } if (file_count != NULL) { *file_count = file->details->deep_file_count; } if (unreadable_directory_count != NULL) { *unreadable_directory_count = file->details->deep_unreadable_count; } if (total_size != NULL) { *total_size = file->details->deep_size; } return file->details->deep_counts_status; } /* For directories, or before we know the type, we haven't started. */ type = nautilus_file_get_file_type (file); if (type == G_FILE_TYPE_UNKNOWN || type == G_FILE_TYPE_DIRECTORY) { return NAUTILUS_REQUEST_NOT_STARTED; } /* For other types, we are done, and the zeros are permanent. */ return NAUTILUS_REQUEST_DONE; }