[f-spot/FSPOT_0_6_0_STABLE] Ensure proper sorting in Facebook Export



commit 68c4f6e3a71007ce205d7c04797d44d57823c2a2
Author: Andy Brown <adb1413 rit edu>
Date:   Tue Aug 25 08:36:31 2009 +0200

    Ensure proper sorting in Facebook Export
    
    Closes bgo#592835.
    
    Previously the FacebookExport extension would sort photos before
    uploading them, but after the user had applied captions.  When the
    user checked the photos on Facebook, the captions would be
    applied to the wrong photos.

 .../Exporters/FacebookExport/FacebookExport.cs     |    9 ---------
 .../FacebookExport/FacebookExportDialog.cs         |   13 +++++++++++++
 2 files changed, 13 insertions(+), 9 deletions(-)
---
diff --git a/extensions/Exporters/FacebookExport/FacebookExport.cs b/extensions/Exporters/FacebookExport/FacebookExport.cs
index 214a0ba..ef973e5 100644
--- a/extensions/Exporters/FacebookExport/FacebookExport.cs
+++ b/extensions/Exporters/FacebookExport/FacebookExport.cs
@@ -303,20 +303,11 @@ namespace FSpot.Exporter.Facebook
 			dialog.Destroy ();
 		}
 
-		private class DateComparer : IComparer
-		{
-			public int Compare (object left, object right)
-			{
-				return DateTime.Compare ((left as IBrowsableItem).Time, (right as IBrowsableItem).Time);
-			}
-		}
-
 		void Upload ()
 		{
 			Album album = null;
 
 			IBrowsableItem [] items = dialog.Items;
-			Array.Sort (items, new DateComparer ());
 			string [] captions = dialog.Captions;
 
 			if (dialog.CreateAlbum) {
diff --git a/extensions/Exporters/FacebookExport/FacebookExportDialog.cs b/extensions/Exporters/FacebookExport/FacebookExportDialog.cs
index 1f43781..a1bd9ca 100644
--- a/extensions/Exporters/FacebookExport/FacebookExportDialog.cs
+++ b/extensions/Exporters/FacebookExport/FacebookExportDialog.cs
@@ -15,6 +15,7 @@
 
 using System;
 using System.Reflection;
+using System.Collections;
 using System.Collections.Generic;
 using System.Threading;
 
@@ -61,9 +62,21 @@ namespace FSpot.Exporter.Facebook
 		FSpot.Widgets.IconView thumbnail_iconview;
 		Dictionary<long, User> friends;
 
+		private class DateComparer : IComparer
+		{
+			public int Compare (object left,
+			                    object right)
+			{
+				return DateTime.Compare ((left as IBrowsableItem).Time,
+					(right as IBrowsableItem).Time);
+			}
+		}
+
 		public FacebookExportDialog (IBrowsableCollection selection) : base (Assembly.GetExecutingAssembly (), "FacebookExport.ui", "facebook_export_dialog")
 		{
+			// Sort selection by date ascending
 			items = selection.Items;
+			Array.Sort (items, new DateComparer ());
 
 			captions = new string [selection.Items.Length];
 			tags = new List<Mono.Facebook.Tag> [selection.Items.Length];



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