[nautilus/merge_replace_dialog: 20/23] Simplify the mtime compare code.



commit c3c21618e0db9b37b410c8cd67b798a45186b944
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Fri Apr 9 01:52:51 2010 +0200

    Simplify the mtime compare code.

 .../nautilus-file-conflict-dialog.c                |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/libnautilus-private/nautilus-file-conflict-dialog.c b/libnautilus-private/nautilus-file-conflict-dialog.c
index 12d98d7..ccaed3a 100644
--- a/libnautilus-private/nautilus-file-conflict-dialog.c
+++ b/libnautilus-private/nautilus-file-conflict-dialog.c
@@ -61,9 +61,14 @@ G_DEFINE_TYPE (NautilusFileConflictDialog,
 				      NautilusFileConflictDialogDetails))
 
 static const gchar *
-get_str_for_mtimes (time_t src_mtime,
-			 time_t dest_mtime)
+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");
 
@@ -90,7 +95,6 @@ file_list_ready_cb (GList *files,
 	GdkPixbuf *pixbuf;
 	GtkWidget *image, *label, *button;
 	GString *str;
-	time_t src_mtime, dest_mtime;
 	PangoFontDescription *desc;
 
 	dialog = GTK_DIALOG (fcd);
@@ -107,16 +111,13 @@ file_list_ready_cb (GList *files,
 	source_is_dir = nautilus_file_is_directory (src);
 	dest_is_dir = nautilus_file_is_directory (dest);
 
-	src_mtime = nautilus_file_get_mtime (src);
-	dest_mtime = nautilus_file_get_mtime (dest);
-
 	type = nautilus_file_get_mime_type (dest);
 	should_show_type = nautilus_file_is_mime_type (src, type);
 
 	g_free (type);
 	type = NULL;
 
-	time_str = get_str_for_mtimes (src_mtime, dest_mtime);
+	time_str = get_str_for_mtimes (src, dest);
 	/* Set up the right labels */
 	if (dest_is_dir) {
 		if (source_is_dir) {



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