[nautilus/gnome-2-32: 26/283] Specify which file is older.



commit d6a4cad47a32fd747ede5b8c13ebb5300b64ddf4
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Thu Apr 8 19:14:06 2010 +0200

    Specify which file is older.
    
    That's valuable information, so display it clearly in the secondary
    label of the conflict dialog.

 .../nautilus-file-conflict-dialog.c                |   64 ++++++++++++++------
 1 files changed, 45 insertions(+), 19 deletions(-)
---
diff --git a/libnautilus-private/nautilus-file-conflict-dialog.c b/libnautilus-private/nautilus-file-conflict-dialog.c
index 6c56811..62a6701 100644
--- a/libnautilus-private/nautilus-file-conflict-dialog.c
+++ b/libnautilus-private/nautilus-file-conflict-dialog.c
@@ -59,6 +59,24 @@ G_DEFINE_TYPE (NautilusFileConflictDialog,
 	(G_TYPE_INSTANCE_GET_PRIVATE ((object), NAUTILUS_TYPE_FILE_CONFLICT_DIALOG, \
 				      NautilusFileConflictDialogDetails))
 
+static const gchar *
+get_str_for_mtimes (NautilusFile *src,
+		    NautilusFile *dest)
+{
+	time_t src_mtime, dest_mtime;
+
+	src_mtime = nautilus_file_get_mtime (src);
+	dest_mtime = nautilus_file_get_mtime (dest);
+
+	if (src_mtime > dest_mtime)
+		return _("An older");
+
+	if (src_mtime < dest_mtime)
+		return _("A newer");
+
+	return _("Another");
+}
+
 static void
 file_list_ready_cb (GList *files,
 		    gpointer user_data)
@@ -72,9 +90,11 @@ file_list_ready_cb (GList *files,
 	char *src_name, *dest_name, *dest_dir_name;
 	char *label_text;
 	char *size, *date, *type = NULL;
+	const gchar *time_str;
 	GdkPixbuf *pixbuf;
 	GtkWidget *image, *label, *button;
 	GString *str;
+	PangoFontDescription *desc;
 
 	dialog = GTK_DIALOG (fcd);
 	details = fcd->details;
@@ -96,38 +116,44 @@ file_list_ready_cb (GList *files,
 	g_free (type);
 	type = NULL;
 
+	time_str = get_str_for_mtimes (src, dest);
 	/* Set up the right labels */
 	if (dest_is_dir) {
 		if (source_is_dir) {
 			primary_text = g_strdup_printf
-				(_("A folder named \"%s\" already exists.  "
-				   "Do you want to merge the source folder?"),
+				(_("Merge folder \"%s\"?"),
 				 dest_name);
-			secondary_text = g_strdup_printf
-				(_("The source folder already exists in \"%s\".  "
-				   "Merging will ask for confirmation before "
-				   "replacing any files in the folder that "
-				   "conflict with the files being copied."),
-				 dest_dir_name);
+
+			/* Translators: the first string in this printf
+			 * is the "An older/A newer/Another" string defined some lines before.
+			 */
+			secondary_text = g_strdup_printf (
+				_("%s folder with the same name already exists in \"%s\".\n"
+				  "Merging will ask for confirmation before "
+				  "replacing any files in the folder that "
+				  "conflict with the files being copied."),
+				time_str,
+				dest_dir_name);
 		} else {
 			primary_text = g_strdup_printf
-				(_("A folder named \"%s\" already exists.  "
-				   "Do you want to replace it?"), 
-				 dest_name);
+				(_("Replace folder \"%s\"?"), dest_name);
 			secondary_text = g_strdup_printf
-				(_("The folder already exists in \"%s\".  "
+				(_("A folder with the same name already exists in \"%s\".\n"
 				   "Replacing it will remove all files in the folder."),
 				 dest_dir_name);
 		}
 	} else {
 		primary_text = g_strdup_printf
-			(_("A file named \"%s\" already exists.  "
-			   "Do you want to replace it?"),
-			 dest_name);
-		secondary_text = g_strdup_printf
-			(_("The file already exists in \"%s\".  "
-			   "Replacing it will overwrite its content."),
-			 dest_dir_name);
+			(_("Replace file \"%s\"?"), dest_name);
+
+		/* Translators: the first string in this printf
+		 * is the "An older/A newer/Another" string defined some lines before.
+		 */
+		secondary_text = g_strdup_printf (
+			_("%s file with the same name already exists in \"%s\".\n"
+			  "Replacing it will overwrite its content."),
+			time_str,
+			dest_dir_name);
 	}
 
 	label = gtk_label_new (NULL);



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