Index: src/dlg-jpegtran.c
===================================================================
RCS file: /cvs/gnome/gthumb/src/dlg-jpegtran.c,v
retrieving revision 1.40
diff -u -r1.40 dlg-jpegtran.c
--- src/dlg-jpegtran.c	13 Oct 2006 17:45:16 -0000	1.40
+++ src/dlg-jpegtran.c	18 Oct 2006 14:04:11 -0000
@@ -261,22 +261,22 @@
 			
 		gdk_pixbuf_get_file_info (get_file_path_from_uri (path), &width, &height);
 		
-		orientation = get_exif_tag_short (path, EXIF_TAG_ORIENTATION);;
+		orientation = get_exif_tag_short (path, EXIF_TAG_ORIENTATION);
                 if (orientation != 0) {
+         data->transform = get_next_transformation (orientation, data->transform);
 			if (! eel_gconf_get_boolean (PREF_ROTATE_RESET_EXIF_ORIENTATION, TRUE)) {
-				/* Just change the exif orientation tag, and save the file */				
-	                        update_orientation_field (path, data->transform);
+				/* Just change the exif orientation tag, and save the file */
+				write_orientation_field (path, data->transform);
 			}
 			else if ((height % 8 == 0) && (width % 8 == 0)) {
 				/* Do a physical transform if requested and if the dimensions are
 				 * multiples of the jpeg mcu (8) */
-				data->transform = get_next_transformation (orientation, data->transform);
 				apply_transformation_jpeg (window, path, data->transform);
 			}
 			else {
 				/* Just change the exif orientation tag, and save the file */
 				_gtk_info_dialog_run (window, _("This image can not be physically transformed without image distortion, because its dimensions are not multiples of 8. Instead, gThumb will change the Exif orientation tag to accomplish the rotation without image distortion. To avoid this warning in the future, disable the \"Apply physical transform\" option in the rotation dialog."));
-                                update_orientation_field (path, data->transform);
+				write_orientation_field (path, data->transform);
 			}
                 }
                 else {
Index: src/dlg-reset-exif.c
===================================================================
RCS file: /cvs/gnome/gthumb/src/dlg-reset-exif.c,v
retrieving revision 1.1
diff -u -r1.1 dlg-reset-exif.c
--- src/dlg-reset-exif.c	12 Oct 2006 15:51:35 -0000	1.1
+++ src/dlg-reset-exif.c	18 Oct 2006 14:04:11 -0000
@@ -121,7 +121,7 @@
 	g_free (dir);
 
 	gnome_vfs_get_file_info (path, &info, GNOME_VFS_FILE_INFO_GET_ACCESS_RIGHTS|GNOME_VFS_FILE_INFO_FOLLOW_LINKS);
-	reset_orientation_field (path);
+	write_orientation_field (path, GTH_TRANSFORM_NONE);
 
 	gnome_vfs_set_file_info (path, &info, GNOME_VFS_SET_FILE_INFO_PERMISSIONS|GNOME_VFS_SET_FILE_INFO_OWNER);
 
Index: src/rotation-utils.c
===================================================================
RCS file: /cvs/gnome/gthumb/src/rotation-utils.c,v
retrieving revision 1.9
diff -u -r1.9 rotation-utils.c
--- src/rotation-utils.c	12 Oct 2006 19:15:12 -0000	1.9
+++ src/rotation-utils.c	18 Oct 2006 14:04:11 -0000
@@ -50,8 +50,10 @@
 		return GTH_TRANSFORM_NONE;
 }
 
+
 void
-reset_orientation_field (const char *path)
+write_orientation_field (const char   *path,
+			  GthTransform transform)
 {
 	JPEGData     *jdata;
 	ExifData     *edata;
@@ -82,7 +84,7 @@
 		if (entry != NULL) {
 			ExifByteOrder byte_order;
 			byte_order = exif_data_get_byte_order (edata);
-			exif_set_short (entry->data, byte_order, GTH_TRANSFORM_NONE);
+			exif_set_short (entry->data, byte_order, transform);
 		}
 	}
 
@@ -165,7 +167,7 @@
 		if ((rot_type == GTH_TRANSFORM_ROTATE_90) || 
 				(rot_type == GTH_TRANSFORM_ROTATE_270))
 			swap_xy_exif_fields (path);
-		reset_orientation_field (path);
+		write_orientation_field (path, GTH_TRANSFORM_NONE);
 	}
 
 	g_free (e1);
@@ -311,56 +313,6 @@
 		return lookup[transform - 1];
 	else
 		return GTH_TRANSFORM_NONE;
-}
-
-
-void
-update_orientation_field (const char   *path,
-			  GthTransform transform)
-{
-	JPEGData     *jdata;
-	ExifData     *edata;
-	unsigned int  i;
-
-	path = get_file_path_from_uri (path);
-	if (path == NULL)
-		return;
-
-	jdata = jpeg_data_new_from_file (path);
-	if (jdata == NULL)
-		return;
-
-	edata = jpeg_data_get_exif_data (jdata);
-	if (edata == NULL) {
-		jpeg_data_unref (jdata);
-		return;
-	}
-	
-	for (i = 0; i < EXIF_IFD_COUNT; i++) {
-		ExifContent *content = edata->ifd[i];
-		ExifEntry   *entry;
-
-		if ((content == NULL) || (content->count == 0)) 
-			continue;
-
-		entry = exif_content_get_entry (content, EXIF_TAG_ORIENTATION);
-		if (entry != NULL) {
-			ExifByteOrder byte_order;
-			ExifShort     value;
-
-			byte_order = exif_data_get_byte_order (edata);
-			value = exif_get_short (entry->data, byte_order);
-			
-			value = get_next_transformation(value, transform);
-
-			exif_set_short (entry->data, byte_order, value);
-		}
-	}
-
-	jpeg_data_save_file (jdata, path);
-
-	exif_data_unref (edata);
-	jpeg_data_unref (jdata);
 }
 
 
Index: src/rotation-utils.h
===================================================================
RCS file: /cvs/gnome/gthumb/src/rotation-utils.h,v
retrieving revision 1.5
diff -u -r1.5 rotation-utils.h
--- src/rotation-utils.h	12 Oct 2006 19:15:12 -0000	1.5
+++ src/rotation-utils.h	18 Oct 2006 14:04:11 -0000
@@ -29,9 +29,6 @@
 
 #include "gth-exif-utils.h"
 
-void		apply_transformation_exif      (GtkWindow    *win,
-						const char   *filename,
-						GthTransform  transform);
 void		apply_transformation_jpeg      (GtkWindow    *win,
 						const char   *filename,
 						GthTransform  transform);
@@ -45,8 +42,7 @@
 GthTransform	get_mirror_part	               (GthTransform  transform);
 
 GthTransform	read_orientation_field	       (const char   *path);
-void		reset_orientation_field	       (const char   *path);
-void		update_orientation_field       (const char   *filename, 
+void				write_orientation_field        (const char   *filename, 
 						GthTransform  transform);
 							
 gboolean	swap_fields                    (ExifContent  *content,
