Re: [PATCH] Improve broken symlink dialog for trash



On Fr, 2005-12-09 at 12:57 +0100, Alexander Larsson wrote:
> On Sat, 2005-12-03 at 12:28 +0100, Christian Neumair wrote:
> > 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

> +       name = nautilus_file_get_name (file);
> You need to use display_name here, the name might not be valid utf8.

Thanks for pointing this out. Attaching new patch.

-- 
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.723
diff -u -p -r1.723 fm-directory-view.c
--- src/file-manager/fm-directory-view.c	28 Nov 2005 20:15:16 -0000	1.723
+++ src/file-manager/fm-directory-view.c	9 Dec 2005 14:30:44 -0000
@@ -7392,6 +7425,7 @@ static void
 report_broken_symbolic_link (FMDirectoryView *view, NautilusFile *file)
 {
 	char *target_path;
+	char *display_name;
 	char *prompt;
 	char *detail;
 	GtkDialog *dialog;
@@ -7400,8 +7434,15 @@ report_broken_symbolic_link (FMDirectory
 	
 	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);
+	} else {
+		prompt = g_strdup_printf (_("The Link \"%s\" is Broken. Move it to Trash?"), display_name);
+	}
+	g_free (display_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 {
@@ -7409,8 +7450,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);
@@ -7434,6 +7481,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]