static int
nautilus_canvas_view_container_compare_icons_by_name (NautilusCanvasContainer *container,
						    NautilusCanvasIconData      *icon_a,
						    NautilusCanvasIconData      *icon_b)
{
	return nautilus_file_compare_for_sort
		(NAUTILUS_FILE (icon_a),
		 NAUTILUS_FILE (icon_b),
		 NAUTILUS_FILE_SORT_BY_DISPLAY_NAME,
		 FALSE, FALSE);
}
Esempio n. 2
0
void
nautilus_restore_files_from_trash (GList *files,
                                   GtkWindow *parent_window)
{
    NautilusFile *file, *original_dir;
    GHashTable *original_dirs_hash;
    GList *original_dirs, *unhandled_files;
    GFile *original_dir_location;
    GList *locations, *l;
    char *message, *file_name;

    original_dirs_hash = nautilus_trashed_files_get_original_directories (files, &unhandled_files);

    for (l = unhandled_files; l != NULL; l = l->next) {
        file = NAUTILUS_FILE (l->data);
        file_name = nautilus_file_get_display_name (file);
        message = g_strdup_printf (_("Could not determine original location of \"%s\" "), file_name);
        g_free (file_name);

        eel_show_warning_dialog (message,
                                 _("The item cannot be restored from trash"),
                                 parent_window);
        g_free (message);
    }

    if (original_dirs_hash != NULL) {
        original_dirs = g_hash_table_get_keys (original_dirs_hash);
        for (l = original_dirs; l != NULL; l = l->next) {
            original_dir = NAUTILUS_FILE (l->data);
            original_dir_location = nautilus_file_get_location (original_dir);

            files = g_hash_table_lookup (original_dirs_hash, original_dir);
            locations = locations_from_file_list (files);

            nautilus_file_operations_move
            (locations, NULL,
             original_dir_location,
             parent_window,
             NULL, NULL);

            g_list_free_full (locations, g_object_unref);
            g_object_unref (original_dir_location);
        }

        g_list_free (original_dirs);
        g_hash_table_destroy (original_dirs_hash);
    }

    nautilus_file_list_unref (unhandled_files);
}
void
nautilus_restore_files_from_trash (GList *files,
				   GtkWindow *parent_window)
{
	NautilusFile *file;
	GHashTable *original_dirs_hash;
	GList *unhandled_files, *l;
	char *message, *file_name;

	original_dirs_hash = nautilus_trashed_files_get_original_directories (files, &unhandled_files);

	for (l = unhandled_files; l != NULL; l = l->next) {
		file = NAUTILUS_FILE (l->data);
		file_name = nautilus_file_get_display_name (file);
		message = g_strdup_printf (_("Could not determine original location of “%s” "), file_name);
		g_free (file_name);

		eel_show_warning_dialog (message,
					 _("The item cannot be restored from trash"),
					 parent_window);
		g_free (message);
	}

	if (original_dirs_hash != NULL) {
		restore_files_ensure_parent_directories (original_dirs_hash, parent_window);
		g_hash_table_unref (original_dirs_hash);
	}

	nautilus_file_list_unref (unhandled_files);
}
static void
nautilus_desktop_directory_file_init (NautilusDesktopDirectoryFile *desktop_file)
{
	NautilusDesktopDirectory *desktop_directory;
	NautilusDirectory *real_dir;
	NautilusFile *real_dir_file;

	desktop_file->details = G_TYPE_INSTANCE_GET_PRIVATE (desktop_file,
							     NAUTILUS_TYPE_DESKTOP_DIRECTORY_FILE,
							     NautilusDesktopDirectoryFileDetails);

	desktop_directory = NAUTILUS_DESKTOP_DIRECTORY (nautilus_directory_get_by_uri (EEL_DESKTOP_URI));
	desktop_file->details->desktop_directory = desktop_directory;

	desktop_file->details->callbacks = g_hash_table_new
		(desktop_callback_hash, desktop_callback_equal);
	desktop_file->details->monitors = g_hash_table_new_full (NULL, NULL,
								 NULL, monitor_destroy);

	real_dir = nautilus_desktop_directory_get_real_directory (desktop_directory);
	real_dir_file = nautilus_directory_get_corresponding_file (real_dir);
	nautilus_directory_unref (real_dir);
	
	desktop_file->details->real_dir_file = real_dir_file;

	nautilus_desktop_update_metadata_from_keyfile (NAUTILUS_FILE (desktop_file), "directory");

	g_signal_connect_object (real_dir_file, "changed",
				 G_CALLBACK (real_file_changed_callback), desktop_file, 0);
}
static void
nautilus_saved_search_file_init (NautilusSavedSearchFile *search_file)
{
	NautilusFile *file;

	file = NAUTILUS_FILE (search_file);
}
Esempio n. 6
0
void
nautilus_directory_moved (const char *old_uri,
			  const char *new_uri)
{
	GList *list, *node;
	GHashTable *hash;
	NautilusFile *file;
	GFile *old_location;
	GFile *new_location;

	hash = g_hash_table_new (NULL, NULL);

	old_location = g_file_new_for_uri (old_uri);
	new_location = g_file_new_for_uri (new_uri);
	
	list = nautilus_directory_moved_internal (old_location, new_location);
	for (node = list; node != NULL; node = node->next) {
		file = NAUTILUS_FILE (node->data);
		hash_table_list_prepend (hash,
					 file->details->directory,
					 nautilus_file_ref (file));
	}
	nautilus_file_list_free (list);
	
	g_object_unref (old_location);
	g_object_unref (new_location);

	g_hash_table_foreach (hash, call_files_changed_unref_free_list, NULL);
	g_hash_table_destroy (hash);
}
void
nautilus_search_directory_file_update_display_name (NautilusSearchDirectoryFile *search_file)
{
	NautilusFile *file;
	NautilusSearchDirectory *search_dir;
	NautilusQuery *query;
	char *display_name;
	gboolean changed;

	
	display_name = NULL;
	file = NAUTILUS_FILE (search_file);
	if (file->details->directory) {
		search_dir = NAUTILUS_SEARCH_DIRECTORY (file->details->directory);
		query = nautilus_search_directory_get_query (search_dir);
	
		if (query != NULL) {
			display_name = nautilus_query_to_readable_string (query);
			g_object_unref (query);
		} 
	}

	if (display_name == NULL) {
		display_name = g_strdup (_("Search"));
	}

	changed = nautilus_file_set_display_name (file, display_name, NULL, TRUE);
	if (changed) {
		nautilus_file_emit_changed (file);
	}

	g_free (display_name);
}
static void
nautilus_search_directory_file_init (NautilusSearchDirectoryFile *search_file)
{
	NautilusFile *file;

	file = NAUTILUS_FILE (search_file);

	file->details->got_file_info = TRUE;
	file->details->mime_type = eel_ref_str_get_unique ("x-directory/normal");
	file->details->type = G_FILE_TYPE_DIRECTORY;
	file->details->size = 0;

	file->details->file_info_is_up_to_date = TRUE;

	file->details->custom_icon = NULL;
	file->details->activation_location = NULL;
	file->details->got_link_info = TRUE;
	file->details->link_info_is_up_to_date = TRUE;

	file->details->directory_count = 0;
	file->details->got_directory_count = TRUE;
	file->details->directory_count_is_up_to_date = TRUE;

	nautilus_file_set_display_name (file, _("Search"), NULL, FALSE);
}
Esempio n. 9
0
GList *
nautilus_directory_match_pattern (NautilusDirectory *directory, const char *pattern)
{
	GList *files, *l, *ret;
	GPatternSpec *spec;


	ret = NULL;
	spec = g_pattern_spec_new (pattern);
	
	files = nautilus_directory_get_file_list (directory);
	for (l = files; l; l = l->next) {
		NautilusFile *file;
		char *name;
	       
	        file = NAUTILUS_FILE (l->data);
		name = nautilus_file_get_display_name (file);

		if (g_pattern_match_string (spec, name)) {
			ret = g_list_prepend(ret, nautilus_file_ref (file));	
		}

		g_free (name);
	}

	g_pattern_spec_free (spec);
	nautilus_file_list_free (files);

	return ret;
}
static void
ensure_dirs_task_ready_cb (GObject *_source,
			   GAsyncResult *res,
			   gpointer user_data)
{
	NautilusFile *original_dir;
	GFile *original_dir_location;
	GList *original_dirs, *files, *locations, *l;
	RestoreFilesData *data = user_data;

	original_dirs = g_hash_table_get_keys (data->original_dirs_hash);
	for (l = original_dirs; l != NULL; l = l->next) {
		original_dir = NAUTILUS_FILE (l->data);
		original_dir_location = nautilus_file_get_location (original_dir);

		files = g_hash_table_lookup (data->original_dirs_hash, original_dir);
		locations = locations_from_file_list (files);

		nautilus_file_operations_move
			(locations, NULL,
			 original_dir_location,
			 data->parent_window,
			 NULL, NULL);

		g_list_free_full (locations, g_object_unref);
		g_object_unref (original_dir_location);
	}

	g_list_free (original_dirs);

	g_hash_table_unref (data->original_dirs_hash);
	g_slice_free (RestoreFilesData, data);
}
static void
desktop_callback_remove_file_cover (gpointer key,
				    gpointer value,
				    gpointer callback_data)
{
	desktop_callback_remove_file
		(value, NAUTILUS_FILE (callback_data));
}
Esempio n. 12
0
NautilusFile *
nautilus_file_queue_head (NautilusFileQueue *queue)
{
	if (queue->head == NULL) {
		return NULL;
	}

	return NAUTILUS_FILE (queue->head->data);
}
static void
real_file_changed_callback (NautilusFile *real_file,
			    gpointer callback_data)
{
	NautilusDesktopDirectoryFile *desktop_file;
	
	desktop_file = NAUTILUS_DESKTOP_DIRECTORY_FILE (callback_data);
	nautilus_file_changed (NAUTILUS_FILE (desktop_file));
}
Esempio n. 14
0
static void
cancel_rename_callback (gpointer callback_data)
{
	GError *error;
	
	error = g_error_new (G_IO_ERROR, G_IO_ERROR_CANCELLED, "Cancelled");
	finish_rename (NAUTILUS_FILE (callback_data), FALSE, error);
	g_error_free (error);
}
static void
monitor_destroy (gpointer data)
{
	DesktopMonitor *monitor = data;
	
	nautilus_file_monitor_remove
		(NAUTILUS_FILE (monitor->desktop_file->details->real_dir_file), monitor);
	g_free (monitor);
}
static void
desktop_callback_destroy (DesktopCallback *desktop_callback)
{
	g_assert (desktop_callback != NULL);
	g_assert (NAUTILUS_IS_DESKTOP_DIRECTORY_FILE (desktop_callback->desktop_file));

	nautilus_file_unref (NAUTILUS_FILE (desktop_callback->desktop_file));
	g_list_free (desktop_callback->non_ready_files);
	g_free (desktop_callback);
}
gboolean
nautilus_file_selection_equal (GList *selection_a,
			       GList *selection_b)
{
	GList *al, *bl;
	gboolean selection_matches;

	if (selection_a == NULL || selection_b == NULL) {
		return (selection_a == selection_b);
	}

	if (g_list_length (selection_a) != g_list_length (selection_b)) {
		return FALSE;
	}

	selection_matches = TRUE;

	for (al = selection_a; al; al = al->next) {
		GFile *a_location = nautilus_file_get_location (NAUTILUS_FILE (al->data));
		gboolean found = FALSE;

		for (bl = selection_b; bl; bl = bl->next) {
			GFile *b_location = nautilus_file_get_location (NAUTILUS_FILE (bl->data));
			found = g_file_equal (b_location, a_location);
			g_object_unref (b_location);

			if (found) {
				break;
			}
		}

		selection_matches = found;
		g_object_unref (a_location);

		if (!selection_matches) {
			break;
		}
	}

	return selection_matches;
}
Esempio n. 18
0
GHashTable *
nautilus_trashed_files_get_original_directories (GList *files,
        GList **unhandled_files)
{
    GHashTable *directories;
    NautilusFile *file, *original_file, *original_dir;
    GList *l, *m;

    directories = NULL;

    if (unhandled_files != NULL) {
        *unhandled_files = NULL;
    }

    for (l = files; l != NULL; l = l->next) {
        file = NAUTILUS_FILE (l->data);
        original_file = nautilus_file_get_trash_original_file (file);

        original_dir = NULL;
        if (original_file != NULL) {
            original_dir = nautilus_file_get_parent (original_file);
        }

        if (original_dir != NULL) {
            if (directories == NULL) {
                directories = g_hash_table_new_full (g_direct_hash, g_direct_equal,
                                                     (GDestroyNotify) nautilus_file_unref,
                                                     (GDestroyNotify) nautilus_file_list_unref);
            }
            nautilus_file_ref (original_dir);
            m = g_hash_table_lookup (directories, original_dir);
            if (m != NULL) {
                g_hash_table_steal (directories, original_dir);
                nautilus_file_unref (original_dir);
            }
            m = g_list_append (m, nautilus_file_ref (file));
            g_hash_table_insert (directories, original_dir, m);
        } else if (unhandled_files != NULL) {
            *unhandled_files = g_list_append (*unhandled_files, nautilus_file_ref (file));
        }

        if (original_file != NULL) {
            nautilus_file_unref (original_file);
        }

        if (original_dir != NULL) {
            nautilus_file_unref (original_dir);
        }
    }

    return directories;
}
Esempio n. 19
0
NautilusFile *
nautilus_directory_find_file_by_name (NautilusDirectory *directory,
				      const char *name)
{
	GList *node;

	g_return_val_if_fail (NAUTILUS_IS_DIRECTORY (directory), NULL);
	g_return_val_if_fail (name != NULL, NULL);

	node = g_hash_table_lookup (directory->details->file_hash,
				    name);
	return node == NULL ? NULL : NAUTILUS_FILE (node->data);
}
static void
desktop_callback_check_done (DesktopCallback *desktop_callback)
{
	/* Check if we are ready. */
	if (desktop_callback->initializing ||
	    desktop_callback->non_ready_files != NULL) {
		return;
	}

	/* Ensure our metadata is updated before calling back */
	nautilus_desktop_update_metadata_from_keyfile (NAUTILUS_FILE (desktop_callback->desktop_file), "directory");

	/* Remove from the hash table before sending it. */
	g_hash_table_remove (desktop_callback->desktop_file->details->callbacks,
			     desktop_callback);

	/* We are ready, so do the real callback. */
	(* desktop_callback->callback) (NAUTILUS_FILE (desktop_callback->desktop_file),
					desktop_callback->callback_data);

	/* And we are done. */
	desktop_callback_destroy (desktop_callback);
}
Esempio n. 21
0
static gboolean
is_tentative (gpointer data, gpointer callback_data)
{
	NautilusFile *file;

	g_assert (callback_data == NULL);

	file = NAUTILUS_FILE (data);
	/* Avoid returning files with !is_added, because these
	 * will later be sent with the files_added signal, and a
	 * user doing get_file_list + files_added monitoring will
	 * then see the file twice */
	return !file->details->got_file_info || !file->details->is_added;
}
Esempio n. 22
0
static GList *
locations_from_file_list (GList *file_list)
{
    NautilusFile *file;
    GList *l, *ret;

    ret = NULL;

    for (l = file_list; l != NULL; l = l->next) {
        file = NAUTILUS_FILE (l->data);
        ret = g_list_prepend (ret, nautilus_file_get_location (file));
    }

    return g_list_reverse (ret);
}
static char *
nautilus_canvas_view_container_get_icon_description (NautilusCanvasContainer *container,
						   NautilusCanvasIconData      *data)
{
	NautilusFile *file;
	char *mime_type;
	const char *description;

	file = NAUTILUS_FILE (data);
	g_assert (NAUTILUS_IS_FILE (file));

	mime_type = nautilus_file_get_mime_type (file);
	description = g_content_type_get_description (mime_type);
	g_free (mime_type);
	return g_strdup (description);
}
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 void
desktop_callback_check_done (DesktopCallback *desktop_callback)
{
	/* Check if we are ready. */
	if (desktop_callback->initializing ||
	    desktop_callback->non_ready_files != NULL) {
		return;
	}

	/* Remove from the hash table before sending it. */
	g_hash_table_remove (desktop_callback->desktop_file->details->callbacks,
			     desktop_callback);

	/* We are ready, so do the real callback. */
	(* desktop_callback->callback) (NAUTILUS_FILE (desktop_callback->desktop_file),
					desktop_callback->callback_data);

	/* And we are done. */
	desktop_callback_destroy (desktop_callback);
}
static void
ensure_dirs_task_thread_func (GTask *task,
			      gpointer source,
			      gpointer task_data,
			      GCancellable *cancellable)
{
	RestoreFilesData *data = task_data;
	NautilusFile *original_dir;
	GFile *original_dir_location;
	GList *original_dirs, *l;

	original_dirs = g_hash_table_get_keys (data->original_dirs_hash);
	for (l = original_dirs; l != NULL; l = l->next) {
		original_dir = NAUTILUS_FILE (l->data);
		original_dir_location = nautilus_file_get_location (original_dir);

		g_file_make_directory_with_parents (original_dir_location, cancellable, NULL);
		g_object_unref (original_dir_location);
	}

	g_task_return_pointer (task, NULL, NULL);
}
static void
nautilus_search_directory_file_init (NautilusSearchDirectoryFile *search_file)
{
	NautilusFile *file;
	gchar *xdg_dir;

	file = NAUTILUS_FILE (search_file);

	search_file->details = G_TYPE_INSTANCE_GET_PRIVATE (search_file,
	                                                    NAUTILUS_TYPE_SEARCH_DIRECTORY_FILE,
	                                                    NautilusSearchDirectoryFileDetails);

	xdg_dir = nautilus_get_user_directory ();
	search_file->details->metadata_filename = g_build_filename (xdg_dir,
	                                                            "search-metadata",
	                                                            NULL);
	g_free (xdg_dir);

	file->details->got_file_info = TRUE;
	file->details->mime_type = eel_ref_str_get_unique ("x-directory/normal");
	file->details->type = G_FILE_TYPE_DIRECTORY;
	file->details->size = 0;

	file->details->file_info_is_up_to_date = TRUE;

	file->details->custom_icon = NULL;
	file->details->activation_uri = NULL;
	file->details->got_link_info = TRUE;
	file->details->link_info_is_up_to_date = TRUE;

	file->details->directory_count = 0;
	file->details->got_directory_count = TRUE;
	file->details->directory_count_is_up_to_date = TRUE;

	nautilus_file_set_display_name (file, _("Search"), NULL, TRUE);
}
Esempio n. 28
0
void
nautilus_directory_notify_files_moved (GList *file_pairs)
{
	GList *p, *affected_files, *node;
	GFilePair *pair;
	NautilusFile *file;
	NautilusDirectory *old_directory, *new_directory;
	GHashTable *parent_directories;
	GList *new_files_list, *unref_list;
	GHashTable *added_lists, *changed_lists;
	char *name;
	NautilusFileAttributes cancel_attributes;
	GFile *to_location, *from_location;
	
	/* Make a list of added and changed files in each directory. */
	new_files_list = NULL;
	added_lists = g_hash_table_new (NULL, NULL);
	changed_lists = g_hash_table_new (NULL, NULL);
	unref_list = NULL;

	/* Make a list of parent directories that will need their counts updated. */
	parent_directories = g_hash_table_new (NULL, NULL);

	cancel_attributes = nautilus_file_get_all_attributes ();

	for (p = file_pairs; p != NULL; p = p->next) {
		pair = p->data;
		from_location = pair->from;
		to_location = pair->to;

		/* Handle overwriting a file. */
		file = nautilus_file_get_existing (to_location);
		if (file != NULL) {
			/* Mark it gone and prepare to send the changed signal. */
			nautilus_file_mark_gone (file);
			new_directory = file->details->directory;
			hash_table_list_prepend (changed_lists,
						 new_directory,
						 file);
			collect_parent_directories (parent_directories,
						    new_directory);
		}

		/* Update any directory objects that are affected. */
		affected_files = nautilus_directory_moved_internal (from_location,
								    to_location);
		for (node = affected_files; node != NULL; node = node->next) {
			file = NAUTILUS_FILE (node->data);
			hash_table_list_prepend (changed_lists,
						 file->details->directory,
						 file);
		}
		unref_list = g_list_concat (unref_list, affected_files);

		/* Move an existing file. */
		file = nautilus_file_get_existing (from_location);
		if (file == NULL) {
			/* Handle this as if it was a new file. */
			new_files_list = g_list_prepend (new_files_list,
							 to_location);
		} else {
			/* Handle notification in the old directory. */
			old_directory = file->details->directory;
			collect_parent_directories (parent_directories, old_directory);

			/* Cancel loading of attributes in the old directory */
			nautilus_directory_cancel_loading_file_attributes
				(old_directory, file, cancel_attributes);

			/* Locate the new directory. */
			new_directory = get_parent_directory (to_location);
			collect_parent_directories (parent_directories, new_directory);
			/* We can unref now -- new_directory is in the
			 * parent directories list so it will be
			 * around until the end of this function
			 * anyway.
			 */
			nautilus_directory_unref (new_directory);

			/* Update the file's name and directory. */
			name = g_file_get_basename (to_location);
			nautilus_file_update_name_and_directory 
				(file, name, new_directory);
			g_free (name);

			/* Update file attributes */
			nautilus_file_invalidate_attributes (file, NAUTILUS_FILE_ATTRIBUTE_INFO);

			hash_table_list_prepend (changed_lists,
						 old_directory,
						 file);
			if (old_directory != new_directory) {
				hash_table_list_prepend	(added_lists,
							 new_directory,
							 file);
			}

			/* Unref each file once to balance out nautilus_file_get_by_uri. */
			unref_list = g_list_prepend (unref_list, file);
		}
	}

	/* Now send out the changed and added signals for existing file objects. */
	g_hash_table_foreach (changed_lists, call_files_changed_free_list, NULL);
	g_hash_table_destroy (changed_lists);
	g_hash_table_foreach (added_lists, call_files_added_free_list, NULL);
	g_hash_table_destroy (added_lists);

	/* Let the file objects go. */
	nautilus_file_list_free (unref_list);

	/* Invalidate count for each parent directory. */
	g_hash_table_foreach (parent_directories, invalidate_count_and_unref, NULL);
	g_hash_table_destroy (parent_directories);

	/* Separate handling for brand new file objects. */
	nautilus_directory_notify_files_added (new_files_list);
	g_list_free (new_files_list);
}
static void
cancel_rename_callback (gpointer callback_data)
{
	nautilus_file_cancel (NAUTILUS_FILE (callback_data), rename_callback, NULL);
}
/* This callback returns the text, both the editable part, and the
 * part below that is not editable.
 */
static void
nautilus_canvas_view_container_get_icon_text (NautilusCanvasContainer *container,
					    NautilusCanvasIconData      *data,
					    char                 **editable_text,
					    char                 **additional_text,
					    gboolean               include_invisible)
{
	GQuark *attributes;
	char *text_array[4];
	int i, j, num_attributes;
	NautilusCanvasView *canvas_view;
	NautilusFile *file;
	gboolean use_additional;

	file = NAUTILUS_FILE (data);

	g_assert (NAUTILUS_IS_FILE (file));
	g_assert (editable_text != NULL);
	canvas_view = get_canvas_view (container);
	g_return_if_fail (canvas_view != NULL);

	use_additional = (additional_text != NULL);

	/* In the smallest zoom mode, no text is drawn. */
	if (nautilus_canvas_container_get_zoom_level (container) == NAUTILUS_ZOOM_LEVEL_SMALLEST &&
            !include_invisible) {
		*editable_text = NULL;
	} else {
		/* Strip the suffix for nautilus object xml files. */
		*editable_text = nautilus_file_get_display_name (file);
	}

	if (!use_additional) {
		return;
	}

	if (NAUTILUS_IS_DESKTOP_ICON_FILE (file) ||
	    nautilus_file_is_nautilus_link (file)) {
		/* Don't show the normal extra information for desktop icons,
		 * or desktop files, it doesn't make sense. */
 		*additional_text = NULL;
		return;
	}

	/* Find out what attributes go below each icon. */
	attributes = nautilus_canvas_view_container_get_icon_text_attribute_names (container,
									   &num_attributes);

	/* Get the attributes. */
	j = 0;
	for (i = 0; i < num_attributes; ++i) {
		char *text;
		if (attributes[i] == attribute_none_q) {
			continue;
		}
		text = nautilus_file_get_string_attribute_q (file, attributes[i]);
		if (text == NULL) {
			continue;
		}
		text_array[j++] = text;
	}
	text_array[j] = NULL;

	/* Return them. */
	if (j == 0) {
		*additional_text = NULL;
	} else if (j == 1) {
		/* Only one item, avoid the strdup + free */
		*additional_text = text_array[0];
	} else {
		*additional_text = g_strjoinv ("\n", text_array);
		
		for (i = 0; i < j; i++) {
			g_free (text_array[i]);
		}
	}
}