Index: README
===================================================================
RCS file: /cvs/gnome/gthumb/README,v
retrieving revision 1.8
diff -u -r1.8 README
--- README	12 Oct 2006 15:49:02 -0000	1.8
+++ README	19 Oct 2006 15:17:49 -0000
@@ -96,6 +96,7 @@
 	* libgnomeprintui 	version >= 2.6.0
 	* libbonobo 		version >= 2.6.0 
 	* libbonoboui 		version >= 2.6.0
+	* intltool		version >= 0.35.0
 	* libexif               version >= 0.6.9
 	* libjpeg
 
Index: libgthumb/typedefs.h
===================================================================
RCS file: /cvs/gnome/gthumb/libgthumb/typedefs.h,v
retrieving revision 1.17
diff -u -r1.17 typedefs.h
--- libgthumb/typedefs.h	12 Oct 2006 19:15:11 -0000	1.17
+++ libgthumb/typedefs.h	19 Oct 2006 15:17:50 -0000
@@ -213,6 +213,14 @@
 	GTH_TRANSFORM_TRANSVERSE,	/* transpose across UR-to-LL axis (= rotate_90 + flip_v) */
 	GTH_TRANSFORM_ROTATE_270	/* 270-degree clockwise */
 } GthTransform;
+/* The GthTransform numeric values range from 1 to 8, corresponding to
+the valid range of Exif orientation tags. The name associated with each
+numeric valid describes the data transformation required that will allow 
+the orientation value to be reset to "1" without changing the displayed image.
+GthTransform and ExifShort values are interchangeably in a number of places. 
+The main difference is that ExifShort can have a value of zero, corresponding
+to an error or an absence of an Exif orientation tag. See bug 361913 for 
+additional details. */
 
 
 typedef enum { /*< skip >*/
Index: libgthumb/jpegutils/jpegtran.c
===================================================================
RCS file: /cvs/gnome/gthumb/libgthumb/jpegutils/jpegtran.c,v
retrieving revision 1.2
diff -u -r1.2 jpegtran.c
--- libgthumb/jpegutils/jpegtran.c	8 Oct 2006 08:45:18 -0000	1.2
+++ libgthumb/jpegutils/jpegtran.c	19 Oct 2006 15:17:50 -0000
@@ -99,6 +99,7 @@
 jpegtran (char         *input_filename,
 	  char         *output_filename,
 	  JXFORM_CODE   transformation,
+	  gboolean		trim,
 	  GError      **error)
 {
 	struct jpeg_decompress_struct  srcinfo;
@@ -111,7 +112,7 @@
 	FILE                          *output_file;
 
 	transformoption.transform = transformation;
-	transformoption.trim = FALSE;
+	transformoption.trim = trim;
 	transformoption.force_grayscale = FALSE;
 	
 	/* Initialize the JPEG decompression object with default error 
Index: libgthumb/jpegutils/jpegtran.h
===================================================================
RCS file: /cvs/gnome/gthumb/libgthumb/jpegutils/jpegtran.h,v
retrieving revision 1.2
diff -u -r1.2 jpegtran.h
--- libgthumb/jpegutils/jpegtran.h	8 Oct 2006 08:45:19 -0000	1.2
+++ libgthumb/jpegutils/jpegtran.h	19 Oct 2006 15:17:50 -0000
@@ -32,6 +32,7 @@
 int  jpegtran (char         *input_filename,
 	       char         *output_filename,
 	       JXFORM_CODE   transformation,
+	       gboolean		trim,
 	       GError      **error);
 
 #endif /* JPEGTRAN_H */
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	19 Oct 2006 15:17:50 -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	19 Oct 2006 15:17:51 -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/gth-browser.c
===================================================================
RCS file: /cvs/gnome/gthumb/src/gth-browser.c,v
retrieving revision 1.64
diff -u -r1.64 gth-browser.c
--- src/gth-browser.c	12 Oct 2006 15:49:23 -0000	1.64
+++ src/gth-browser.c	19 Oct 2006 15:18:00 -0000
@@ -3065,8 +3065,13 @@
 		}
 	}
 
-	if ((event->state & GDK_CONTROL_MASK) || (event->state & GDK_MOD1_MASK))
-		return FALSE;
+	if (((event->state & GDK_CONTROL_MASK)
+
+		/* Let pass the ctrl+keypad_add and ctrl+keypad_subtract. */
+		&& (event->keyval != GDK_KP_Add) && (event->keyval != GDK_KP_Subtract)
+
+		) || (event->state & GDK_MOD1_MASK))
+			return FALSE;
 
 	sel_not_null = gth_file_view_selection_not_null (priv->file_list->view);
 	image_is_void = image_viewer_is_void (IMAGE_VIEWER (priv->viewer));
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	19 Oct 2006 15:18:01 -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);
 		}
 	}
 
@@ -144,7 +146,7 @@
 		break;
 	}
 
-	if (jpegtran ((char*)path, tmp, transf, &err) != 0) {
+	if (jpegtran ((char*)path, tmp, transf, FALSE, &err) != 0) {
 		g_free (tmp);
 		if (err != NULL) 
 			_gtk_error_dialog_from_gerror_run (win, &err);
@@ -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	19 Oct 2006 15:18:01 -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,
