? autom4te.cache
? autorotation-2006-10-03.diff
? depcomp
? eog.desktop.in
? install-sh
? missing
? mkinstalldirs
? omf.make
? stamp-h1
? xmldocs.make
? libeog/test-eog-job
? libeog/test-image-load
? po/.intltool-merge-cache
? po/stamp-it
Index: eog.glade
===================================================================
RCS file: /cvs/gnome/eog/eog.glade,v
retrieving revision 1.20
diff -u -r1.20 eog.glade
--- eog.glade	7 Sep 2006 01:02:21 -0000	1.20
+++ eog.glade	3 Oct 2006 18:31:59 -0000
@@ -91,7 +91,7 @@
 		  <child>
 		    <widget class="GtkLabel" id="label6">
 		      <property name="visible">True</property>
-		      <property name="label" translatable="yes">&lt;b&gt;Image Interpolation&lt;/b&gt;</property>
+		      <property name="label" translatable="yes">&lt;b&gt;Image Enhancements&lt;/b&gt;</property>
 		      <property name="use_underline">False</property>
 		      <property name="use_markup">True</property>
 		      <property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -161,6 +161,62 @@
 		      <property name="fill">True</property>
 		    </packing>
 		  </child>
+		<child>
+ 		    <widget class="GtkHBox" id="hboxautorotate">
+ 		      <property name="visible">True</property>
+ 		      <property name="homogeneous">False</property>
+ 		      <property name="spacing">0</property>
+ 
+ 		      <child>
+ 			<widget class="GtkLabel" id="labelautopad">
+ 			  <property name="visible">True</property>
+ 			  <property name="label" translatable="yes">    </property>
+ 			  <property name="use_underline">False</property>
+ 			  <property name="use_markup">False</property>
+ 			  <property name="justify">GTK_JUSTIFY_LEFT</property>
+ 			  <property name="wrap">False</property>
+ 			  <property name="selectable">False</property>
+ 			  <property name="xalign">0.5</property>
+ 			  <property name="yalign">0.5</property>
+ 			  <property name="xpad">0</property>
+ 			  <property name="ypad">0</property>
+ 			  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ 			  <property name="width_chars">-1</property>
+ 			  <property name="single_line_mode">False</property>
+ 			  <property name="angle">0</property>
+ 			</widget>
+ 			<packing>
+ 			  <property name="padding">0</property>
+ 			  <property name="expand">False</property>
+ 			  <property name="fill">False</property>
+ 			</packing>
+ 		      </child>
+ 
+ 		      <child>
+ 			<widget class="GtkCheckButton" id="autorotate_check">
+ 			  <property name="visible">True</property>
+ 			  <property name="can_focus">True</property>
+ 			  <property name="label" translatable="yes">_Automatic orientation</property>
+ 			  <property name="use_underline">True</property>
+ 			  <property name="relief">GTK_RELIEF_NORMAL</property>
+ 			  <property name="focus_on_click">True</property>
+ 			  <property name="active">False</property>
+ 			  <property name="inconsistent">False</property>
+ 			  <property name="draw_indicator">True</property>
+ 			</widget>
+ 			<packing>
+ 			  <property name="padding">0</property>
+ 			  <property name="expand">False</property>
+ 			  <property name="fill">False</property>
+ 			</packing>
+		      </child>
+ 		</widget>
+ 		<packing>
+ 		  <property name="padding">0</property>
+ 		  <property name="expand">False</property>
+ 		  <property name="fill">False</property>
+ 		</packing>
+ 	      </child>
 		</widget>
 		<packing>
 		  <property name="padding">0</property>
Index: libeog/eog-config-keys.h
===================================================================
RCS file: /cvs/gnome/eog/libeog/eog-config-keys.h,v
retrieving revision 1.7
diff -u -r1.7 eog-config-keys.h
--- libeog/eog-config-keys.h	18 May 2006 03:51:28 -0000	1.7
+++ libeog/eog-config-keys.h	3 Oct 2006 18:31:59 -0000
@@ -7,6 +7,7 @@
 
 #define EOG_CONF_VIEW_DIR                    "/apps/eog/view"
 #define EOG_CONF_VIEW_INTERPOLATE            "/apps/eog/view/interpolate"
+#define EOG_CONF_VIEW_AUTOROTATE             "/apps/eog/view/autorotate"
 #define EOG_CONF_VIEW_TRANSPARENCY           "/apps/eog/view/transparency"
 #define EOG_CONF_VIEW_TRANS_COLOR            "/apps/eog/view/trans_color"
 
Index: libeog/eog-image.c
===================================================================
RCS file: /cvs/gnome/eog/libeog/eog-image.c,v
retrieving revision 1.71
diff -u -r1.71 eog-image.c
--- libeog/eog-image.c	21 Aug 2006 17:36:48 -0000	1.71
+++ libeog/eog-image.c	3 Oct 2006 18:32:00 -0000
@@ -1939,3 +1939,48 @@
 	g_object_unref (G_OBJECT (printed_image));	
 }
 
+gint
+eog_image_get_angle_to_exif_orientation (EogImage *image)
+{
+  gint angle = 0;
+  EogImagePrivate *priv = NULL;
+  
+	g_return_val_if_fail (EOG_IS_IMAGE (image), 0);
+	
+	priv = image->priv;
+	  
+#if HAVE_EXIF
+  if (priv->exif != NULL)
+    {
+	    char b[32];
+	    ExifEntry *exentry = 
+	              exif_data_get_entry (priv->exif, EXIF_TAG_ORIENTATION);
+	    const gchar *orientation = exif_entry_get_value (exentry, b, sizeof(b));
+	    if (orientation != NULL)
+		    {
+		      /* "top - left" is normal orientation or upside down
+		       * (at least on my camera) but seems we can't differentiate
+		       */
+		      if (g_utf8_collate (orientation, "right - top") == 0)
+		        angle = 90;
+		      else if (g_utf8_collate (orientation, "left - bottom") == 0)
+		        angle = 270;
+		    }
+		}
+#endif /* HAVE_EXIF */
+
+  return angle;
+}
+
+void
+eog_image_autorotate (EogImage *img)
+{
+  gint angle = 0;
+  
+	g_return_if_fail (EOG_IS_IMAGE (img));
+	
+	angle = eog_image_get_angle_to_exif_orientation (img);
+	
+	if (angle != 0)
+    eog_image_transform (img, eog_transform_rotate_new (angle), NULL);
+}
Index: libeog/eog-image.h
===================================================================
RCS file: /cvs/gnome/eog/libeog/eog-image.h,v
retrieving revision 1.28
diff -u -r1.28 eog-image.h
--- libeog/eog-image.h	24 Jul 2006 19:05:13 -0000	1.28
+++ libeog/eog-image.h	3 Oct 2006 18:32:00 -0000
@@ -121,6 +121,7 @@
 GnomeVFSURI*        eog_image_get_uri                         (EogImage *img);
 gchar*              eog_image_get_uri_for_display             (EogImage *img);
 gboolean            eog_image_has_metadata                    (EogImage *img);
+gint                eog_image_get_angle_to_exif_orientation   (EogImage *image);
 
 #ifdef HAVE_LCMS
 cmsHPROFILE eog_image_get_profile (EogImage *img);
@@ -128,6 +129,7 @@
 #endif
 
 /* modification API */
+void                eog_image_autorotate                      (EogImage *img);
 void                eog_image_transform                       (EogImage *img, EogTransform *trans, EogJob *job);
 void                eog_image_undo                            (EogImage *img);
 
Index: shell/eog-gtk-ui.xml
===================================================================
RCS file: /cvs/gnome/eog/shell/eog-gtk-ui.xml,v
retrieving revision 1.16
diff -u -r1.16 eog-gtk-ui.xml
--- shell/eog-gtk-ui.xml	26 Mar 2006 23:58:18 -0000	1.16
+++ shell/eog-gtk-ui.xml	3 Oct 2006 18:32:00 -0000
@@ -40,6 +40,7 @@
       <menuitem action="EditRotate90"/>
       <menuitem action="EditRotate270"/>
       <menuitem action="EditRotate180"/>
+      <menuitem action="EditRotateExif"/>
       <separator/>
       <menuitem action="SetAsWallpaper"/>
     </menu>
@@ -65,6 +66,7 @@
     <toolitem action="ViewZoomFit"/>
     <separator/>
     <toolitem action="EditRotate270"/>
+    <toolitem action="EditRotateExif"/>
     <toolitem action="EditRotate90"/>
   </toolbar>
   <accelerator name="ControlEqualAccel" action="ControlEqual"/>
Index: shell/eog-preferences.c
===================================================================
RCS file: /cvs/gnome/eog/shell/eog-preferences.c,v
retrieving revision 1.36
diff -u -r1.36 eog-preferences.c
--- shell/eog-preferences.c	11 Sep 2006 18:21:05 -0000	1.36
+++ shell/eog-preferences.c	3 Oct 2006 18:32:00 -0000
@@ -151,6 +151,16 @@
 			  G_CALLBACK (check_toggle_cb), 
 			  client);
 
+	/* autorotate flag */
+	widget = glade_xml_get_widget (xml, "autorotate_check");
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), 
+				      gconf_client_get_bool (client, EOG_CONF_VIEW_AUTOROTATE, NULL));
+	g_object_set_data (G_OBJECT (widget), GCONF_OBJECT_KEY, EOG_CONF_VIEW_AUTOROTATE);
+	g_signal_connect (G_OBJECT (widget), 
+			  "toggled", 
+			  G_CALLBACK (check_toggle_cb), 
+			  client);
+
 	/* Transparency radio group */
 	widget = glade_xml_get_widget (xml, "color_radio");
 	g_object_set_data (G_OBJECT (widget), GCONF_OBJECT_KEY, EOG_CONF_VIEW_TRANSPARENCY);
Index: shell/eog-window.c
===================================================================
RCS file: /cvs/gnome/eog/shell/eog-window.c,v
retrieving revision 1.202
diff -u -r1.202 eog-window.c
--- shell/eog-window.c	11 Sep 2006 18:21:05 -0000	1.202
+++ shell/eog-window.c	3 Oct 2006 18:32:02 -0000
@@ -1974,10 +1974,28 @@
 }
 
 static void
+_unset_exif_rotation (EogWindow *window)
+{
+#ifdef HAVE_EXIF
+  GtkAction *action;
+
+	g_return_if_fail (EOG_IS_WINDOW (window));
+
+  /* No longer automatically rotated */
+	action = gtk_ui_manager_get_action (window->priv->ui_mgr,
+	                                    "/ToolBar/EditRotateExif");
+	g_assert (action != NULL);
+	gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), FALSE);
+#endif
+}
+
+static void
 verb_Undo_cb (GtkAction *action, gpointer data)
 {
 	g_return_if_fail (EOG_IS_WINDOW (data));
 
+	_unset_exif_rotation (EOG_WINDOW (data));
+
 	apply_transformation (EOG_WINDOW (data), NULL);
 }
 
@@ -1986,6 +2004,8 @@
 {
 	g_return_if_fail (EOG_IS_WINDOW (data));
 
+	_unset_exif_rotation (EOG_WINDOW (data));
+
 	apply_transformation (EOG_WINDOW (data), eog_transform_flip_new (EOG_TRANSFORM_FLIP_HORIZONTAL));
 }
 
@@ -1994,6 +2014,8 @@
 {
 	g_return_if_fail (EOG_IS_WINDOW (data));
 
+	_unset_exif_rotation (EOG_WINDOW (data));
+
 	apply_transformation (EOG_WINDOW (data), eog_transform_flip_new (EOG_TRANSFORM_FLIP_VERTICAL));
 }
 
@@ -2002,6 +2024,8 @@
 {
 	g_return_if_fail (EOG_IS_WINDOW (data));
 
+	_unset_exif_rotation (EOG_WINDOW (data));
+
 	apply_transformation (EOG_WINDOW (data), eog_transform_rotate_new (90));
 }
 
@@ -2010,6 +2034,8 @@
 {
 	g_return_if_fail (EOG_IS_WINDOW (data));
 
+	_unset_exif_rotation (EOG_WINDOW (data));
+
 	apply_transformation (EOG_WINDOW (data), eog_transform_rotate_new (270));
 }
 
@@ -2018,9 +2044,37 @@
 {
 	g_return_if_fail (EOG_IS_WINDOW (data));
 
+	_unset_exif_rotation (EOG_WINDOW (data));
+
 	apply_transformation (EOG_WINDOW (data), eog_transform_rotate_new (180));
 }
 
+static void
+verb_RotateExif_cb (GtkAction *action, gpointer data)
+{
+#ifdef HAVE_EXIF
+  gint angle = 0;
+
+	EogWindowPrivate *priv;
+
+	g_return_if_fail (EOG_IS_WINDOW (data));
+
+	if (!gtk_toggle_action_get_active (GTK_TOGGLE_ACTION(action)))
+		return;
+		
+	priv = EOG_WINDOW (data)->priv;
+
+	if (priv->displayed_image == NULL)
+		return;
+
+	angle = eog_image_get_angle_to_exif_orientation (priv->displayed_image);
+
+	if (angle != 0)
+		apply_transformation (EOG_WINDOW (data), eog_transform_rotate_new (angle));
+
+#endif
+}
+
 /* ========================================================================= */
 
 static int
@@ -3466,7 +3520,8 @@
 };
 
 static const GtkToggleActionEntry toggle_entries_image[] = {
-  { "ViewInfo",      NULL, N_("Image _Information"), "<control>I", N_("Changes the visibility of the information pane in the current window"), G_CALLBACK (verb_ShowHideAnyBar_cb), TRUE }
+  { "ViewInfo",      NULL, N_("Image _Information"), "<control>I", N_("Changes the visibility of the information pane in the current window"), G_CALLBACK (verb_ShowHideAnyBar_cb), TRUE }, 
+  { "EditRotateExif",  GTK_STOCK_ORIENTATION_PORTRAIT,  N_("Rotate with _Exif information"), "<control>e", NULL, G_CALLBACK (verb_RotateExif_cb), TRUE }
 };
 
 static const GtkActionEntry action_entries_collection[] = {
@@ -3492,6 +3547,7 @@
 	{ "EditFlipHorizontal", NULL, FALSE },
 	{ "EditFlipVertical", NULL, FALSE },
 	{ "EditRotate90", N_("Right"), FALSE },
+	{ "EditRotateExif", N_("Autorotate"), FALSE },
 	{ "EditRotate270", N_("Left"), FALSE },
 	{ "ViewFullscreen", NULL, FALSE },
 	{ "ViewSlideshow", NULL, FALSE },
@@ -3798,6 +3854,15 @@
 	else
 		gtk_widget_hide_all (gtk_widget_get_parent (priv->wraplist));
 
+	/* autorotate with exif info is on? */
+	visible = gconf_client_get_bool (priv->client, EOG_CONF_VIEW_AUTOROTATE, NULL);
+	action = gtk_ui_manager_get_action (priv->ui_mgr, "/ToolBar/EditRotateExif");
+	g_assert (action != NULL);
+	gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), visible);
+#ifndef HAVE_EXIF
+	gtk_action_set_sensitive (GTK_TOGGLE_ACTION (action), FALSE);
+#endif
+
 	return TRUE;
 }
 
@@ -3992,6 +4057,8 @@
 	EogWindowPrivate *priv;
 #ifdef HAVE_LCMS
         int i;
+#elif HAVE_EXIF
+        int i;
 #endif
 
 	g_return_val_if_fail (EOG_IS_WINDOW (window), FALSE);
@@ -4019,6 +4086,17 @@
 			eog_image_apply_display_profile (eog_image_list_get_img_by_pos (model, i),
 							 get_screen_profile (window));
 		}
+#endif
+
+#if HAVE_EXIF
+		/* Correct orientation */
+		
+		if (gconf_client_get_bool (priv->client, EOG_CONF_VIEW_AUTOROTATE, NULL))
+      {
+    		for (i = 0; i < eog_image_list_length (model); i++) {
+    			eog_image_autorotate (eog_image_list_get_img_by_pos (model, i));
+        }
+      }
 #endif
 
 	}
