[f-spot/FSPOT_0_6_0_STABLE] Properly store captions in Facebook Export



commit ada16730978384ff9add4fa8c30cf407e8d78108
Author: Andy Brown <adb1413 rit edu>
Date:   Tue Aug 25 08:57:46 2009 +0200

    Properly store captions in Facebook Export
    
    Closes bgo#592960.
    
    Previously the "Export to Facebook" dialog would only store a
    caption when a thumbnail is clicked.  Therefore the last caption
    entered would not be stored when a user clicks the "Add" button
    immediately without clicking on another thumbnail.

 .../FacebookExport/FacebookExport.addin.xml        |    2 +-
 .../Exporters/FacebookExport/FacebookExport.cs     |    1 +
 .../FacebookExport/FacebookExportDialog.cs         |   16 ++++++++++++++--
 3 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/extensions/Exporters/FacebookExport/FacebookExport.addin.xml b/extensions/Exporters/FacebookExport/FacebookExport.addin.xml
index 557c78a..1146e7d 100644
--- a/extensions/Exporters/FacebookExport/FacebookExport.addin.xml
+++ b/extensions/Exporters/FacebookExport/FacebookExport.addin.xml
@@ -1,6 +1,6 @@
 <Addin 	namespace="FSpot"
 	id="FacebookExport"
-	version="0.6.0.4"
+	version="0.6.0.5"
 	name="FacebookExport"
 	description="Export pictures to facebook"
 	author="George Talusan, Jim Ramsay, Stephane Delcroix"
diff --git a/extensions/Exporters/FacebookExport/FacebookExport.cs b/extensions/Exporters/FacebookExport/FacebookExport.cs
index ef973e5..05f441a 100644
--- a/extensions/Exporters/FacebookExport/FacebookExport.cs
+++ b/extensions/Exporters/FacebookExport/FacebookExport.cs
@@ -309,6 +309,7 @@ namespace FSpot.Exporter.Facebook
 
 			IBrowsableItem [] items = dialog.Items;
 			string [] captions = dialog.Captions;
+			dialog.StoreCaption ();
 
 			if (dialog.CreateAlbum) {
 				string name = dialog.AlbumName;
diff --git a/extensions/Exporters/FacebookExport/FacebookExportDialog.cs b/extensions/Exporters/FacebookExport/FacebookExportDialog.cs
index a1bd9ca..62d5dee 100644
--- a/extensions/Exporters/FacebookExport/FacebookExportDialog.cs
+++ b/extensions/Exporters/FacebookExport/FacebookExportDialog.cs
@@ -77,6 +77,7 @@ namespace FSpot.Exporter.Facebook
 			// Sort selection by date ascending
 			items = selection.Items;
 			Array.Sort (items, new DateComparer ());
+			current_item = -1;
 
 			captions = new string [selection.Items.Length];
 			tags = new List<Mono.Facebook.Tag> [selection.Items.Length];
@@ -153,8 +154,21 @@ namespace FSpot.Exporter.Facebook
 			get { return ((AlbumStore) existing_album_combobox.Model).Albums [existing_album_combobox.Active]; }
 		}
 
+		public void StoreCaption ()
+		{
+			// Check for empty text box
+			if (current_item == -1)
+				return;
+			
+			// Store the caption
+			captions [current_item] = caption_textview.Buffer.Text;
+		}
+
 		void HandleThumbnailIconViewButtonPressEvent (object sender, Gtk.ButtonPressEventArgs args)
 		{
+			// Store caption before switching
+			StoreCaption ();
+			
 			int old_item = current_item;
 			current_item = thumbnail_iconview.CellAtPosition ((int) args.Event.X, (int) args.Event.Y, false);
 
@@ -163,8 +177,6 @@ namespace FSpot.Exporter.Facebook
 				return;
 			}
 
-			captions [old_item] = caption_textview.Buffer.Text;
-
 			string caption = captions [current_item];
 			if (caption == null)
 				captions [current_item] = caption = "";



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