[PATCH] Improve broken symlink dialog for trash



Reported as bug 132751 [1]. The attached patch makes the dialog for
trashed files more appropriate and also ensures that no dialog title is
shown.

[1] http://bugzilla.gnome.org/show_bug.cgi?id=132751

-- 
Christian Neumair <chris gnome-de org>
Index: src/file-manager/fm-directory-view.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-directory-view.c,v
retrieving revision 1.722
diff -u -p -r1.722 fm-directory-view.c
--- src/file-manager/fm-directory-view.c	24 Nov 2005 20:47:59 -0000	1.722
+++ src/file-manager/fm-directory-view.c	3 Dec 2005 11:23:45 -0000
@@ -7291,6 +7271,7 @@ static void
 report_broken_symbolic_link (FMDirectoryView *view, NautilusFile *file)
 {
 	char *target_path;
+	char *name;
 	char *prompt;
 	char *detail;
 	GtkDialog *dialog;
@@ -7299,8 +7280,15 @@ report_broken_symbolic_link (FMDirectory
 	
 	g_assert (nautilus_file_is_broken_symbolic_link (file));
 
+	name = nautilus_file_get_name (file);
+	if (nautilus_file_is_in_trash (file)) {
+		prompt = g_strdup_printf (_("The Link \"%s\" is Broken."), name);
+	} else {
+		prompt = g_strdup_printf (_("The Link \"%s\" is Broken. Move it to Trash?"), name);
+	}
+	g_free (name);
+
 	target_path = nautilus_file_get_symbolic_link_target_path (file);
-	prompt = _("The link is broken, do you want to move it to the Trash?");
 	if (target_path == NULL) {
 		detail = g_strdup (_("This link can't be used, because it has no target."));
 	} else {
@@ -7308,8 +7296,14 @@ report_broken_symbolic_link (FMDirectory
 					    "\"%s\" doesn't exist."), target_path);
 	}
 
+	if (nautilus_file_is_in_trash (file)) {
+		eel_run_simple_dialog (GTK_WIDGET (view), FALSE, GTK_MESSAGE_WARNING,
+				       prompt, detail, "", GTK_STOCK_CANCEL, NULL);
+		goto out;
+	}
+
 	dialog = eel_show_yes_no_dialog (prompt,
-					 detail, _("Broken Link"), _("Mo_ve to Trash"), GTK_STOCK_CANCEL,
+					 detail, "", _("Mo_ve to Trash"), GTK_STOCK_CANCEL,
 					 fm_directory_view_get_containing_window (view));
 
 	gtk_dialog_set_default_response (dialog, GTK_RESPONSE_YES);
@@ -7333,6 +7327,8 @@ report_broken_symbolic_link (FMDirectory
 	        trash_or_delete_files (view, &file_as_list);					 
 	}
 
+out:
+	g_free (prompt);
 	g_free (target_path);
 	g_free (detail);
 }

Attachment: signature.asc
Description: This is a digitally signed message part



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