[nautilus] Make sure the file is trashable before offering to move to Trash



commit ef25261edddf8553ce41bfb59bc9d563a811fc23
Author: William Jon McCann <jmccann redhat com>
Date:   Wed Aug 29 20:34:11 2012 -0400

    Make sure the file is trashable before offering to move to Trash
    
    https://bugzilla.gnome.org/show_bug.cgi?id=154478

 src/nautilus-mime-actions.c |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)
---
diff --git a/src/nautilus-mime-actions.c b/src/nautilus-mime-actions.c
index cf925c7..455048a 100644
--- a/src/nautilus-mime-actions.c
+++ b/src/nautilus-mime-actions.c
@@ -621,26 +621,29 @@ report_broken_symbolic_link (GtkWindow *parent_window, NautilusFile *file)
 	GtkDialog *dialog;
 	GList file_as_list;
 	int response;
-	
+	gboolean can_trash;
+
 	g_assert (nautilus_file_is_broken_symbolic_link (file));
 
 	display_name = nautilus_file_get_display_name (file);
-	if (nautilus_file_is_in_trash (file)) {
-		prompt = g_strdup_printf (_("The Link â%sâ is Broken."), display_name);
+	can_trash = nautilus_file_can_trash (file) && !nautilus_file_is_in_trash (file);
+
+	if (can_trash) {
+		prompt = g_strdup_printf (_("The link â%sâ is broken. Move it to Trash?"), display_name);
 	} else {
-		prompt = g_strdup_printf (_("The Link â%sâ is Broken. Move it to Trash?"), display_name);
+		prompt = g_strdup_printf (_("The link â%sâ is broken."), display_name);
 	}
 	g_free (display_name);
 
 	target_path = nautilus_file_get_symbolic_link_target_path (file);
 	if (target_path == NULL) {
-		detail = g_strdup (_("This link cannot be used, because it has no target."));
+		detail = g_strdup (_("This link cannot be used because it has no target."));
 	} else {
-		detail = g_strdup_printf (_("This link cannot be used, because its target "
+		detail = g_strdup_printf (_("This link cannot be used because its target "
 					    "â%sâ doesn't exist."), target_path);
 	}
 	
-	if (nautilus_file_is_in_trash (file)) {
+	if (!can_trash) {
 		eel_run_simple_dialog (GTK_WIDGET (parent_window), FALSE, GTK_MESSAGE_WARNING,
 				       prompt, detail, GTK_STOCK_CANCEL, NULL);
 		goto out;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]