Index: data/gthumb.schemas.in
===================================================================
RCS file: /cvs/gnome/gthumb/data/gthumb.schemas.in,v
retrieving revision 1.21
diff -u -r1.21 gthumb.schemas.in
--- data/gthumb.schemas.in	8 Oct 2006 08:45:27 -0000	1.21
+++ data/gthumb.schemas.in	9 Oct 2006 11:21:52 -0000
@@ -95,19 +95,6 @@
 	</locale>
       </schema>
 
-      <schema>
-	<key>/schemas/apps/gthumb/general/use_exif_orientation</key>
-	<applyto>/apps/gthumb/general/use_exif_orientation</applyto>
-	<owner>gthumb</owner>
-	<type>bool</type>
-	<default>false</default>
-	<locale name="C">
-	  <short></short>
-	  <long>
-	  </long>
-	</locale>
-      </schema>
-
       <!-- Browser -->
 
       <schema>
@@ -1828,8 +1815,23 @@
       </schema>
 
       <schema>
-	<key>/schemas/apps/gthumb/dialogs/photo_importer/adjust_orientation</key>
-	<applyto>/apps/gthumb/dialogs/photo_importer/adjust_orientation</applyto>
+	<key>/schemas/apps/gthumb/dialogs/photo_importer/reset_exif_orientation_on_import</key>
+	<applyto>/apps/gthumb/dialogs/photo_importer/reset_exif_orientation_on_import</applyto>
+	<owner>gthumb</owner>
+	<type>bool</type>
+	<default>TRUE</default>
+	<locale name="C">
+	  <short></short>
+	  <long> 
+	  </long>
+	</locale>
+      </schema>
+
+      <!-- Rotate Dialog -->
+
+      <schema>
+	<key>/schemas/apps/gthumb/dialogs/rotate/reset_exif_orientation_on_rotate</key>
+	<applyto>/apps/gthumb/dialogs/rotate/reset_exif_orientation_on_rotate</applyto>
 	<owner>gthumb</owner>
 	<type>bool</type>
 	<default>TRUE</default>
Index: data/glade/gthumb_tools.glade
===================================================================
RCS file: /cvs/gnome/gthumb/data/glade/gthumb_tools.glade,v
retrieving revision 1.19
diff -u -r1.19 gthumb_tools.glade
--- data/glade/gthumb_tools.glade	8 Oct 2006 08:45:23 -0000	1.19
+++ data/glade/gthumb_tools.glade	9 Oct 2006 11:21:54 -0000
@@ -864,7 +864,7 @@
 	  <child>
 	    <widget class="GtkLabel" id="label92">
 	      <property name="visible">True</property>
-	      <property name="label" translatable="yes">&lt;small&gt;&lt;i&gt;&lt;b&gt;Note&lt;/b&gt;: jpeg transformations are lossless.&lt;/i&gt;&lt;/small&gt;</property>
+	      <property name="label" translatable="yes">&lt;small&gt;&lt;i&gt;&lt;b&gt;Note&lt;/b&gt;: JPEG transformations are normally lossless.&lt;/i&gt;&lt;/small&gt;</property>
 	      <property name="use_underline">False</property>
 	      <property name="use_markup">True</property>
 	      <property name="justify">GTK_JUSTIFY_LEFT</property>
Index: doc/C/gthumb.xml
===================================================================
RCS file: /cvs/gnome/gthumb/doc/C/gthumb.xml,v
retrieving revision 1.24
diff -u -r1.24 gthumb.xml
--- doc/C/gthumb.xml	8 Oct 2006 08:45:33 -0000	1.24
+++ doc/C/gthumb.xml	9 Oct 2006 11:21:55 -0000
@@ -2,9 +2,9 @@
 <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" 
 "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"[
   <!ENTITY legal SYSTEM "legal.xml">
-  <!ENTITY appversion "2.6">
-  <!ENTITY manualversion "2.6">
-  <!ENTITY date "September 2004">
+  <!ENTITY appversion "2.9.0">
+  <!ENTITY manualversion "2.9.0">
+  <!ENTITY date "October 2006">
   <!ENTITY appname "gThumb">
   <!ENTITY app "<application>gThumb</application>">
 <!-- replace version above with actual application version number -->
@@ -1974,7 +1974,7 @@
       <title>To Rotate Images Without Loss of Quality</title>
       <para>
         Usually if you want to rotate an image you have to open the image with
-        an editor, rotate the image and save it.  This works good for
+        an editor, rotate the image, and then save it.  This works well for
         image formats such as PNG or GIF, but results in a loss of
         quality for JPEG images.
       </para>
@@ -1999,18 +1999,40 @@
       <note>
         <title>NOTE</title>
         <para>
-          If you check both the <guilabel>Adjust photo orientation</guilabel>
-	  and the <guilabel>Apply to all images</guilabel> options, all the
-	  images will be rotated by the value in each photo orientation data.
+          If the selection contains some non-JPEG images, they are
+          rotated as well.
         </para>
       </note>
+      </para>
+      <para>
+        In general, there are two ways to rotate a JPEG image. The first way
+        is to re-arrange the pixels inside the image file. The second way is
+        to change the value of the Exif orientation tag inside the JPEG file.
+        Not all JPEG files have Exif tags however, and not all applications
+        support them. If your image does not have Exif tags, the pixels will
+        be re-arranged inside the image file automatically. If your image
+        does have Exif tags, then the pixels will only be re-arranged inside the
+        file if you check the <guilabel>Reset photo orientation</guilabel>
+        checkbox. In this mode, the Exif orientation tag will be reset to its default value 
+        of "top left". If your image has Exif tags and you do not select this option,
+        then only the tag will be changed, and the raw image data itself will not
+        be re-arranged.
       <note>
         <title>NOTE</title>
         <para>
-          If the selection contains some non-JPEG images, they are
-          rotated as well.
+        For maximum compatibility with other applications, it is recommended that
+        the <guilabel>Reset photo orientation</guilabel> checkbox normally be enabled.
         </para>
       </note>
+      </para>
+      <para>The re-arrangement of pixel data inside the JPEG file will not
+        degrade image quality (that is, it is lossless) under most conditions.
+        However, if the image dimensions (height and width) are not both multiples
+        of 8, some data corruption will occur along one of the edges of the 
+        image. If there is no Exif orientation tag in the JPEG file, this
+        data corruption will occur. If there is an Exif orientation tag, &app; 
+        will avoid data corruption by changing the Exif orientation tag, even if 
+        the <guilabel>Reset photo orientation</guilabel> checkbox is enabled.
       </para>
     </sect2>
     <sect2 id="gthumb-convert-format">
Index: libgthumb/preferences.h
===================================================================
RCS file: /cvs/gnome/gthumb/libgthumb/preferences.h,v
retrieving revision 1.37
diff -u -r1.37 preferences.h
--- libgthumb/preferences.h	8 Oct 2006 08:45:27 -0000	1.37
+++ libgthumb/preferences.h	9 Oct 2006 11:21:55 -0000
@@ -43,8 +43,6 @@
 #define  PREF_EDITORS                "/apps/gthumb/general/editors"
 #define  PREF_MIGRATE_DIRECTORIES    "/apps/gthumb/general/migrate_directories"
 #define  PREF_MIGRATE_COMMENT_SYSTEM "/apps/gthumb/general/migrate_comment_system"
-#define  PREF_RESET_EXIF_ORIENTATION_IMPORT	"/apps/gthumb/general/reset_exif_orientation_on_import"
-#define  PREF_RESET_EXIF_ORIENTATION_ROTATE     "/apps/gthumb/general/reset_exif_orientation_on_rotate"
 
 #define  PREF_SHOW_HIDDEN_FILES      "/apps/gthumb/browser/show_hidden_files"
 #define  PREF_SHOW_FILENAMES         "/apps/gthumb/browser/show_filenames"
@@ -197,7 +195,7 @@
 #define  PREF_PHOTO_IMPORT_FILM           "/apps/gthumb/dialogs/photo_importer/film"
 #define  PREF_PHOTO_IMPORT_DELETE         "/apps/gthumb/dialogs/photo_importer/delete_from_camera"
 #define  PREF_PHOTO_IMPORT_KEEP_FILENAMES "/apps/gthumb/dialogs/photo_importer/keep_original_filenames"
-#define  PREF_PHOTO_IMPORT_ADJUST_ORIENTATION "/apps/gthumb/dialogs/photo_importer/adjust_orientation"
+#define  PREF_PHOTO_IMPORT_RESET_EXIF_ORIENTATION	"/apps/gthumb/dialogs/photo_importer/reset_exif_orientation_on_import"
 #define  PREF_PHOTO_IMPORT_MODEL          "/apps/gthumb/dialogs/photo_importer/model"
 #define  PREF_PHOTO_IMPORT_PORT           "/apps/gthumb/dialogs/photo_importer/port"
 
@@ -206,6 +204,8 @@
 #define  PREF_CROP_ASPECT_RATIO_HEIGHT    "/apps/gthumb/dialogs/crop/aspect_ratio_height"
 #define  PREF_ADD_TO_CATALOG_LAST_CATALOG "/apps/gthumb/dialogs/add_to_catalog/last_catalog"
 #define  PREF_ADD_TO_CATALOG_VIEW         "/apps/gthumb/dialogs/add_to_catalog/view"
+
+#define  PREF_ROTATE_RESET_EXIF_ORIENTATION     "/apps/gthumb/dialogs/rotate/reset_exif_orientation_on_rotate"
 
 typedef struct {
 	Bookmarks   *bookmarks;
Index: src/dlg-jpegtran.c
===================================================================
RCS file: /cvs/gnome/gthumb/src/dlg-jpegtran.c,v
retrieving revision 1.37
diff -u -r1.37 dlg-jpegtran.c
--- src/dlg-jpegtran.c	8 Oct 2006 08:45:17 -0000	1.37
+++ src/dlg-jpegtran.c	9 Oct 2006 11:21:55 -0000
@@ -239,7 +239,9 @@
 	char             *dir;
 	GnomeVFSFileInfo  info;
 	GtkWindow  	 *window = GTK_WINDOW (data->dialog);
-        
+	gint		  width = 0;
+	gint		  height = 0;
+	
 	/* Check directory permissions. */
 
 	dir = remove_level_from_path (path);
@@ -255,14 +257,41 @@
 	g_free (dir);
 
 	gnome_vfs_get_file_info (path, &info, GNOME_VFS_FILE_INFO_GET_ACCESS_RIGHTS|GNOME_VFS_FILE_INFO_FOLLOW_LINKS);
-	if (image_is_jpeg (path)) {
-		apply_transformation_exif (window, path, data->rot_data);
-		if (eel_gconf_get_boolean (PREF_RESET_EXIF_ORIENTATION_ROTATE, TRUE)) {
-			update_rotation_from_exif_data (path, data->rot_data);
+
+        if (image_is_jpeg (path)) {
+
+                if (!get_exif_tag_short(path,EXIF_TAG_ORIENTATION)) {
+                        /* If no exif orientation tag is present, simply
+                           transform the data using the "lossless" jpeg
+                           mathematical transform (only really lossless if
+                           dimensions are multiples of 8 */
                         apply_transformation_jpeg (window, path, data->rot_data);
-		}
+                }
+                else {
+                        /* Calculate a new orientation tag, based on the
+                           input tag and the requested rotation. This saves
+			   the jpeg, so no further action is required if
+			   "adjust photo orientation" is not selected. */
+                        update_orientation_field (path, data->rot_data);
+
+                        /* if "adjust photo orientation" is selected mathematically transform
+			   the data so that the viewed image remains the same, but the 
+			   orientation tag can be set to "top left" */
+
+                        if (eel_gconf_get_boolean (PREF_ROTATE_RESET_EXIF_ORIENTATION, TRUE)) {
+
+				gdk_pixbuf_get_file_info(get_file_path_from_uri (path),&width,&height);
+				
+				if (!(height%8) && !(width%8)) {
+					/* Don't do this if the dimensions are not multiples
+					   of the jpeg minimum coding unit (iMCU = 8) */
+	                		update_rotation_from_exif_data (path, data->rot_data);
+					apply_transformation_jpeg (window, path, data->rot_data);
+				}
+                        }
+                }
 
-	}
+        }
 	else 
 		apply_transformation_generic (window, path, data->rot_data);
 	gnome_vfs_set_file_info (path, &info, GNOME_VFS_SET_FILE_INFO_PERMISSIONS|GNOME_VFS_SET_FILE_INFO_OWNER);
@@ -496,7 +525,7 @@
 reset_exif_tag_on_rotate_clicked (GtkWidget  *button,
 		              DialogData *data)
 {
-	eel_gconf_set_boolean (PREF_RESET_EXIF_ORIENTATION_ROTATE,
+	eel_gconf_set_boolean (PREF_ROTATE_RESET_EXIF_ORIENTATION,
 		gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->j_reset_exif_tag_on_rotate_checkbutton)));
 }
 
@@ -611,7 +640,7 @@
 	gtk_widget_set_sensitive (data->j_apply_to_all_checkbutton,
 				  data->file_list->next != NULL);
 
-	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->j_reset_exif_tag_on_rotate_checkbutton), eel_gconf_get_boolean (PREF_RESET_EXIF_ORIENTATION_ROTATE, TRUE));
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->j_reset_exif_tag_on_rotate_checkbutton), eel_gconf_get_boolean (PREF_ROTATE_RESET_EXIF_ORIENTATION, TRUE));
 
 	/* Set the signals handlers. */
 	
Index: src/dlg-photo-importer.c
===================================================================
RCS file: /cvs/gnome/gthumb/src/dlg-photo-importer.c,v
retrieving revision 1.39
diff -u -r1.39 dlg-photo-importer.c
--- src/dlg-photo-importer.c	8 Oct 2006 08:45:17 -0000	1.39
+++ src/dlg-photo-importer.c	9 Oct 2006 11:21:56 -0000
@@ -1488,7 +1488,7 @@
 
 	data->keep_original_filename = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->keep_names_checkbutton));
 	data->delete_from_camera = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->delete_checkbutton));
-	data->adjust_orientation = eel_gconf_get_boolean (PREF_RESET_EXIF_ORIENTATION_IMPORT, TRUE);
+	data->adjust_orientation = eel_gconf_get_boolean (PREF_PHOTO_IMPORT_RESET_EXIF_ORIENTATION, TRUE);
 
 	eel_gconf_set_boolean (PREF_PHOTO_IMPORT_KEEP_FILENAMES, data->keep_original_filename);
 	eel_gconf_set_boolean (PREF_PHOTO_IMPORT_DELETE, data->delete_from_camera);
@@ -1639,7 +1639,7 @@
 reset_exif_tag_on_import_cb (GtkButton  *button,
 		                            DialogData *data)
 {
-	eel_gconf_set_boolean (PREF_RESET_EXIF_ORIENTATION_IMPORT, 
+	eel_gconf_set_boolean (PREF_PHOTO_IMPORT_RESET_EXIF_ORIENTATION, 
 		gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->reset_exif_tag_on_import_checkbutton)));
 }
 
@@ -1892,7 +1892,7 @@
 
 	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->keep_names_checkbutton), eel_gconf_get_boolean (PREF_PHOTO_IMPORT_KEEP_FILENAMES, FALSE));
 	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->delete_checkbutton), eel_gconf_get_boolean (PREF_PHOTO_IMPORT_DELETE, FALSE));
-	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->reset_exif_tag_on_import_checkbutton), eel_gconf_get_boolean (PREF_RESET_EXIF_ORIENTATION_IMPORT, TRUE));
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->reset_exif_tag_on_import_checkbutton), eel_gconf_get_boolean (PREF_PHOTO_IMPORT_RESET_EXIF_ORIENTATION, TRUE));
 
 	default_path = eel_gconf_get_path (PREF_PHOTO_IMPORT_DESTINATION, NULL);
 	if ((default_path == NULL) || (*default_path == 0))
Index: src/gth-browser-ui.h
===================================================================
RCS file: /cvs/gnome/gthumb/src/gth-browser-ui.h,v
retrieving revision 1.14
diff -u -r1.14 gth-browser-ui.h
--- src/gth-browser-ui.h	8 Oct 2006 08:45:16 -0000	1.14
+++ src/gth-browser-ui.h	9 Oct 2006 11:21:56 -0000
@@ -195,6 +195,7 @@
 "  <popup name='FilePopup'>"
 "    <menuitem action='File_ViewImage'/>"
 "    <menuitem action='File_OpenWith'/>"
+"    <menuitem action='File_Print'/>"
 "    <menuitem action='Go_ToContainer'/>"
 "    <separator/>"
 "    <menu action='ToolsWallpaperMenu'>"
@@ -218,10 +219,13 @@
 "    <separator/>"
 "    <menuitem action='Edit_AddToCatalog'/>"
 "    <menuitem action='Edit_RemoveFromCatalog'/>"
+"    <separator/>"
+"    <menuitem action='File_ImageProp'/>"
 "  </popup>"
 "  <popup name='ImagePopup'>"
 "    <menuitem action='File_ViewImage'/>"
 "    <menuitem action='Image_OpenWith'/>"
+"    <menuitem action='File_Print'/>"
 "    <menuitem action='Go_ToContainer'/>"
 "    <separator/>"
 "    <menuitem action='View_Fullscreen'/>"
Index: src/rotation-utils.c
===================================================================
RCS file: /cvs/gnome/gthumb/src/rotation-utils.c,v
retrieving revision 1.7
diff -u -r1.7 rotation-utils.c
--- src/rotation-utils.c	8 Oct 2006 08:45:17 -0000	1.7
+++ src/rotation-utils.c	9 Oct 2006 11:21:56 -0000
@@ -24,6 +24,7 @@
 #include <unistd.h>
 #include <sys/types.h>
 
+#include <glib/gi18n.h>
 #include <libgnomevfs/gnome-vfs-mime.h>
 #include "file-utils.h"
 #include "gtk-utils.h"
@@ -101,18 +102,6 @@
 	}
 }
 
-void
-apply_transformation_exif (GtkWindow    *win,
-			   const char   *path,
-			   RotationData *rot_data)
-
-{
-	if (get_exif_tag_short(path,EXIF_TAG_ORIENTATION)) 
-		update_orientation_field (path, rot_data);
-	else 
-		apply_transformation_jpeg(win, path, rot_data);
-}
-
 
 void
 reset_orientation_field (const char *path)
@@ -323,7 +312,11 @@
 					&error, 
 					NULL))
 			_gtk_error_dialog_from_gerror_run (win, &error);
-	}
+	} else
+		_gtk_error_dialog_run (win,
+				       _("Image type not supported: %s"),
+				       mime_type);
+
 	g_object_unref (pixbuf1);
 }
 
