Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/f-spot/ChangeLog,v
retrieving revision 1.1500
diff -u -p -r1.1500 ChangeLog
--- ChangeLog	6 Jun 2006 23:07:03 -0000	1.1500
+++ ChangeLog	7 Jun 2006 15:32:43 -0000
@@ -1,3 +1,7 @@
+2006-06-07  Stephane Delcroix <stephane@delcroix.org>
+
+	* src/RotateCommand.cs: extended to handle more rotating methods
+
 2006-06-06  Larry Ewing  <lewing@novell.com>
 
 	* src/MainWindow.cs: typo fix from Bengt for #34974.
Index: src/RotateCommand.cs
===================================================================
RCS file: /cvs/gnome/f-spot/src/RotateCommand.cs,v
retrieving revision 1.22
diff -u -p -r1.22 RotateCommand.cs
--- src/RotateCommand.cs	13 Jan 2006 21:54:17 -0000	1.22
+++ src/RotateCommand.cs	7 Jun 2006 15:32:43 -0000
@@ -21,23 +21,34 @@ namespace FSpot {
 		Counterclockwise,
 	}
 
+	public enum RotateMethod {
+		//FIXME: implement RotatePixbuf, RotateIfNotJpeg, RotateAnyway
+		RotateOrientation,	// Only change the metadata of the image
+		RotateCoefficients,	// Lossless jpeg rotation.
+		RotatePixbuf,		// Load the image as pixbuf, then rotate the pixbuf
+		RotateIfNotJpeg,	// If it's a jpeg: RotateOrientation, else RotatePixbuf
+		RotateAnyway		// If it's a jpeg: RotateCoefficient, else: RotatePixbuf
+	}
+
 	public class RotateOperation : Operation {
 		IBrowsableItem item;
 		RotateDirection direction;
+		RotateMethod method;
 		int version_index;
 		bool done;
 
-		public RotateOperation (IBrowsableItem item, RotateDirection direction)
+		public RotateOperation (IBrowsableItem item, RotateDirection direction, RotateMethod method)
 		{
 			this.item = item;
 			this.direction = direction;
+			this.method = method;
 			version_index = 0;
 			done = false;
 		}
 
 		private static void RotateCoefficients (string original_path, RotateDirection direction)
 		{
-			string temporary_path = original_path + ".tmp";	// FIXME make it unique
+			string temporary_path = System.IO.Path.GetTempFileName();
 			JpegUtils.Transform (original_path, temporary_path, 
 					     direction == RotateDirection.Clockwise ? JpegUtils.TransformType.Rotate90 
 					     : JpegUtils.TransformType.Rotate270);
@@ -64,7 +75,14 @@ namespace FSpot {
 		       
 		private void Rotate (string original_path, RotateDirection dir)
 		{
-			RotateOrientation (original_path, direction);
+			switch (method) {
+			case RotateMethod.RotateOrientation:
+				RotateOrientation (original_path, direction);
+				break;
+			case RotateMethod.RotateCoefficients:
+				RotateCoefficients (original_path, direction);
+				break;
+			}
 		}
 		
 		public override bool Step () {
@@ -98,6 +116,7 @@ namespace FSpot {
 
 	public class RotateMultiple : Operation {
 		RotateDirection direction;
+		RotateMethod method;
 		IBrowsableItem [] items;
 		bool rotate_data = false;
 		int index;
@@ -111,9 +130,10 @@ namespace FSpot {
 			get { return items; }
 		}
 
-		public RotateMultiple (IBrowsableItem [] items, RotateDirection direction)
+		public RotateMultiple (IBrowsableItem [] items, RotateDirection direction, RotateMethod method)
 		{
 			this.direction = direction;
+			this.method = method;
 			this.items = items;
 			index = 0;
 		}
@@ -124,7 +144,7 @@ namespace FSpot {
 				return false;
 
 			if (op == null) 
-				op = new RotateOperation (items [index], direction);
+				op = new RotateOperation (items [index], direction, method);
 			
 			if (op.Step ())
 				return true;
@@ -146,7 +166,7 @@ public class RotateCommand {
 		this.parent_window = parent_window;
 	}
 
-	public bool Execute (RotateDirection direction, IBrowsableItem [] items)
+	public bool Execute (RotateDirection direction, IBrowsableItem [] items, RotateMethod method)
 	{
 		ProgressDialog progress_dialog = null;
 		
@@ -155,7 +175,7 @@ public class RotateCommand {
 							      ProgressDialog.CancelButtonType.Stop,
 							      items.Length, parent_window);
 		
-	        RotateMultiple op = new RotateMultiple (items, direction);
+	        RotateMultiple op = new RotateMultiple (items, direction, method);
 		int readonly_count = 0;
 		bool done = false;
 		int index = -1;
@@ -183,6 +203,11 @@ public class RotateCommand {
 			RunReadonlyError (readonly_count);
 		
 		return true;
+	}
+
+	public bool Execute (RotateDirection direction, IBrowsableItem [] items)
+	{
+		return Execute (direction, items, RotateMethod.RotateOrientation);
 	}
 
 	private void RunReadonlyError (int readonly_count)
