[almanah] core: Only set the last edited date on import if it's valid



commit 56bec5f5eeb9f0a8497baa186ad7294e9e7f34ff
Author: Philip Withnall <philip tecnocode co uk>
Date:   Mon Apr 18 17:22:35 2011 +0100

    core: Only set the last edited date on import if it's valid

 src/import-operation.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/src/import-operation.c b/src/import-operation.c
index 3a76568..2e888ff 100644
--- a/src/import-operation.c
+++ b/src/import-operation.c
@@ -319,8 +319,10 @@ set_entry (AlmanahImportOperation *self, AlmanahEntry *imported_entry, const gch
 	almanah_entry_get_last_edited (existing_entry, &existing_last_edited);
 	almanah_entry_get_last_edited (imported_entry, &imported_last_edited);
 
-	if (g_date_valid (&existing_last_edited) == FALSE || g_date_compare (&existing_last_edited, &imported_last_edited) < 0)
+	if (g_date_valid (&imported_last_edited) == TRUE &&
+	    (g_date_valid (&existing_last_edited) == FALSE || g_date_compare (&existing_last_edited, &imported_last_edited) < 0)) {
 		almanah_entry_set_last_edited (existing_entry, &imported_last_edited);
+	}
 
 	almanah_storage_manager_set_entry (self->priv->storage_manager, existing_entry);
 	g_object_unref (existing_entry);



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