read_dot_hidden_file (NautilusDirectory *directory)
{
	gsize file_size;
	char *file_contents;
	GFile *child;
	GFileInfo *info;
	GFileType type;
	int i;


	/* FIXME: We only support .hidden on file: uri's for the moment.
	 * Need to figure out if we should do this async or sync to extend
	 * it to all types of uris.
	 */
	if (directory->details->location == NULL ||
	    !g_file_is_native (directory->details->location)) {
		return;
	}
	
	child = g_file_get_child (directory->details->location, ".hidden");

	type = G_FILE_TYPE_UNKNOWN;
	
	info = g_file_query_info (child, G_FILE_ATTRIBUTE_STANDARD_TYPE, 0, NULL, NULL);
	if (info != NULL) {
		type = g_file_info_get_file_type (info);
		g_object_unref (info);
	}
	
	if (type != G_FILE_TYPE_REGULAR) {
		g_object_unref (child);
		return;
	}

	if (!g_file_load_contents (child, NULL, &file_contents, &file_size, NULL, NULL)) {
		g_object_unref (child);
		return;
	}

	g_object_unref (child);

	if (directory->details->hidden_file_hash == NULL) {
		directory->details->hidden_file_hash =
			g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
	}
	
	/* Now parse the data */
	i = 0;
	while (i < file_size) {
		int start;

		start = i;
		while (i < file_size && file_contents[i] != '\n') {
			i++;
		}

		if (i > start) {
			char *hidden_filename;
		
			hidden_filename = g_strndup (file_contents + start, i - start);
			g_hash_table_insert (directory->details->hidden_file_hash,
					     hidden_filename, hidden_filename);
		}

		i++;
		
	}

	g_free (file_contents);
}
read_dot_hidden_file (NautilusDirectory *directory)
{
	gsize file_size;
	char *file_contents;
	GFile *child;
	GFileInfo *info;
	GFileType type;
	int i;


	 
	if (directory->details->location == NULL ||
	    !g_file_is_native (directory->details->location)) {
		return;
	}
	
	child = g_file_get_child (directory->details->location, ".hidden");

	type = G_FILE_TYPE_UNKNOWN;
	
	info = g_file_query_info (child, G_FILE_ATTRIBUTE_STANDARD_TYPE, 0, NULL, NULL);
	if (info != NULL) {
		type = g_file_info_get_file_type (info);
		g_object_unref (info);
	}
	
	if (type != G_FILE_TYPE_REGULAR) {
		g_object_unref (child);
		return;
	}

	if (!g_file_load_contents (child, NULL, &file_contents, &file_size, NULL, NULL)) {
		g_object_unref (child);
		return;
	}

	g_object_unref (child);

	if (directory->details->hidden_file_hash == NULL) {
		directory->details->hidden_file_hash =
			g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
	}
	
	 
	i = 0;
	while (i < file_size) {
		int start;

		start = i;
		while (i < file_size && file_contents[i] != '\n') {
			i++;
		}

		if (i > start) {
			char *hidden_filename;
		
			hidden_filename = g_strndup (file_contents + start, i - start);
			g_hash_table_insert (directory->details->hidden_file_hash,
					     hidden_filename, hidden_filename);
		}

		i++;
		
	}

	g_free (file_contents);
}