--- configure.in.orig	Tue Feb  5 23:19:52 2002
+++ configure.in	Tue Feb  5 23:24:56 2002
@@ -643,7 +643,38 @@ dnl fi
 dnl AC_SUBST(PYGIMP_CFLAGS_NOUI)
 dnl AC_SUBST(PYGIMP_LIBS_NOUI)
 dnl AM_CONDITIONAL(BUILD_PYTHON, $build_python)
-  
+
+dnl ----------------------------------------------------------------------=
-----
+dnl libexif-gtk: JPEG files can contain EXIF data. If libexif-gtk is insta=
lled
+dnl              on the system, gimp can use it to read this data from 
+dnl              JPEG files and save it (if the file is saved again in
+dnl              the JPEG format). In addition, gimp can offer the user th=
e
+dnl              possibility to edit (!) EXIF data.
+dnl ----------------------------------------------------------------------=
-----
+exif_msg="no (<a href="http://www.sourceforge.net/projects/libexif">http://www.sourceforge.net/projects/libexif</a>)"
+try_exif=true
+AC_ARG_WITH(exif, [  --without-exif          Don't use libexif],[
+	if test x$withval = xno; then
+		try_exif=false
+	fi])
+if $try_exif; then
+	AC_PATH_PROG(PKG_CONFIG,pkg-config)
+	if test -n "${PKG_CONFIG}"; then
+		AC_MSG_CHECKING([for libexif-gtk])
+		if ${PKG_CONFIG} --exists libexif-gtk > /dev/null 2>&1; then
+			EXIF_CFLAGS=`$PKG_CONFIG --cflags libexif-gtk`
+			EXIF_LIBS=`$PKG_CONFIG --libs libexif-gtk`
+			exif_msg=yes
+			AC_DEFINE(HAVE_EXIF)
+			fi
+		AC_MSG_RESULT($exif_msg)
+	else
+		AC_WARN([Not searching for libexif - pkg-config not found.])
+	fi
+fi
+AC_SUBST(EXIF_CFLAGS)
+AC_SUBST(EXIF_LIBS)
+
 
 GIMPINSTALL=
 if test "$INSTALL" = "$ac_install_sh"; then

--=-Ubt6a0EZ8G+CV7VY68Qb
Content-Disposition: attachment; filename=acconfig.h.diff
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

--- acconfig.h.orig	Tue Feb  5 23:29:29 2002
+++ acconfig.h	Tue Feb  5 23:08:46 2002
@@ -19,6 +19,7 @@
 #undef HAVE_CATGETS
 #undef HAVE_DIRENT_H
 #undef HAVE_DOPRNT
+#undef HAVE_EXIF
 #undef HAVE_FINITE
 #undef HAVE_GETTEXT
 #undef HAVE_IPC_H

--=-Ubt6a0EZ8G+CV7VY68Qb
Content-Disposition: attachment; filename=Makefile.am.diff
Content-Type: text/x-makefile; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

--- Makefile.am.orig	Tue Feb  5 23:30:17 2002
+++ Makefile.am	Tue Feb  5 23:18:09 2002
@@ -15,6 +15,7 @@ INCLUDES = \
 	-I$(top_srcdir)		\
 	-I$(top_srcdir)/intl	\
 	$(GTK_CFLAGS)		\
+	$(EXIF_CFLAGS)		\
 	-I$(includedir)
 
 libexec_PROGRAMS = \
@@ -722,6 +723,7 @@ jpeg_LDADD = \
 	$(top_builddir)/libgimp/libgimpui.la	\
 	$(top_builddir)/libgimp/libgimp.la	\
 	$(LIBJPEG)				\
+	$(EXIF_LIBS)				\
 	$(GTK_LIBS)				\
 	$(INTLLIBS)
 

--=-Ubt6a0EZ8G+CV7VY68Qb
Content-Disposition: attachment; filename=jpeg.c.diff
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

--- jpeg.c.orig	Tue Feb  5 23:06:55 2002
+++ jpeg.c	Tue Feb  5 23:08:13 2002
@@ -138,6 +138,10 @@
 #include <jpeglib.h>
 #include <jerror.h>
 
+#ifdef HAVE_EXIF
+#include <libexif-gtk/gtk-exif-browser.h>
+#endif
+
 #include <libgimp/gimp.h>
 #include <libgimp/gimpui.h>
 
@@ -273,6 +277,9 @@ static JpegSaveInterface jsint =
 static gchar     *image_comment         = NULL;
 static GtkWidget *restart_markers_scale = NULL;
 static GtkWidget *restart_markers_label = NULL;
+#ifdef HAVE_EXIF
+static ExifData  *exif_data = NULL;
+#endif
 
 
 MAIN ()
@@ -424,6 +431,10 @@ run (gchar      *name,
 	default:
 	  break;
 	}
+#ifdef HAVE_EXIF
+      exif_data_unref (exif_data);
+      exif_data = NULL;
+#endif
       
       g_free (image_comment);
       image_comment = NULL;
@@ -435,6 +446,14 @@ run (gchar      *name,
 	  image_comment = g_strdup (parasite->data);
 	  gimp_parasite_free (parasite);
 	}
+#ifdef HAVE_EXIF
+      parasite = gimp_image_parasite_find (orig_image_ID, "exif-data");
+      if (parasite)
+	{
+          exif_data = exif_data_new_from_data (parasite->data, parasite-=
><i>size);
</i>+          gimp_parasite_free (parasite);
+	}
+#endif /* HAVE_EXIF */
 #endif /* GIMP_HAVE_PARASITES */
       if (!image_comment) 
 	image_comment = g_strdup (DEFAULT_COMMENT);
@@ -722,6 +741,12 @@ load_image (gchar           *filename, 
   JpegSaveVals local_save_vals;
   GimpParasite * volatile comment_parasite = NULL;
   GimpParasite * volatile vals_parasite    = NULL;
+#ifdef HAVE_EXIF
+  GimpParasite * exif_parasite = NULL;
+  ExifData *exif_data = NULL;
+  unsigned char *exif_buf = NULL;
+  unsigned int exif_buf_len = 0;
+#endif
 #endif /* GIMP_HAVE_PARASITES */
 
   /* We set up the normal JPEG error routines. */
@@ -1057,6 +1082,19 @@ load_image (gchar           *filename, 
 	  gimp_parasite_free (vals_parasite);
 	}   
     }
+#ifdef HAVE_EXIF
+  exif_data = exif_data_new_from_file (filename);
+  if (exif_data)
+    {
+      exif_data_save_data (exif_data, &exif_buf, &exif_buf_len);
+      exif_data_unref (exif_data);
+      exif_parasite = gimp_parasite_new ("exif-data", GIMP_PARASITE_PERS=
ISTENT,
+				         exif_buf_len, exif_buf);
+      g_free (exif_buf);
+      gimp_image_parasite_attach (image_ID, exif_parasite);
+      gimp_parasite_free (exif_parasite);
+    }
+#endif
 #endif /* GIMP_HAVE_PARASITES */
 
   return image_ID;
@@ -1186,6 +1224,10 @@ save_image (gchar    *filename,
   gboolean  has_alpha;
   gint      rowstride, yend;
   gint      i, j;
+#ifdef HAVE_EXIF
+  unsigned char *exif_buf;
+  unsigned int   exif_buf_len;
+#endif
 
   drawable = gimp_drawable_get (drawable_ID);
   drawable_type = gimp_drawable_type (drawable_ID);
@@ -1391,6 +1433,15 @@ save_image (gchar    *filename,
    */
   jpeg_start_compress (&cinfo, TRUE);
 
+#ifdef HAVE_EXIF
+  if (exif_data)
+    {
+      exif_data_save_data (exif_data, &exif_buf, &exif_buf_len);
+      jpeg_write_marker (&cinfo, 0xe1, exif_buf, exif_buf_len);
+      g_free (exif_buf);
+    }
+#endif
+
   /* Step 4.1: Write the comment out - pw */
   if (image_comment && *image_comment)
     {
@@ -1562,12 +1613,14 @@ save_dialog (void)
   GtkWidget *dlg;
   GtkWidget *vbox;
   GtkWidget *main_vbox;
+  GtkWidget *exif_vbox;
   GtkWidget *label;
   GtkWidget *scale;
   GtkWidget *frame;
   GtkWidget *table;
   GtkWidget *toggle;
   GtkWidget *abox;
+  GtkWidget *notebook;
   GtkObject *scale_data;
 
   GtkWidget *progressive;
@@ -1583,6 +1636,7 @@ save_dialog (void)
   GtkWidget *com_frame;
   GtkWidget *com_table;
   GtkWidget *vscrollbar;
+  GtkWidget *browser;
   
   GtkWidget *prv_frame;
   GimpImageType dtype;
@@ -1603,11 +1657,36 @@ save_dialog (void)
 		      GTK_SIGNAL_FUNC (save_close_callback),
 		      NULL);
 
-  main_vbox = gtk_vbox_new (FALSE, 4);
-  gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 6);
-  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), main_vbox,
+  notebook = gtk_notebook_new ();
+  gtk_container_set_border_width (GTK_CONTAINER (notebook), 6);
+  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), notebook,
 		      TRUE, TRUE, 0);
+  gtk_widget_show (notebook);
+
+  main_vbox = gtk_vbox_new (FALSE, 4);
+  gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 3);
+  label = gtk_label_new (_("JPEG Settings"));
+  gtk_notebook_append_page (GTK_NOTEBOOK (notebook), main_vbox, label);
   gtk_widget_show (main_vbox);
+  gtk_widget_show (label);
+
+  exif_vbox = gtk_vbox_new (FALSE, 4);
+  gtk_container_set_border_width (GTK_CONTAINER (exif_vbox), 3);
+  label = gtk_label_new (_("EXIF Data"));
+  gtk_notebook_append_page (GTK_NOTEBOOK (notebook), exif_vbox, label);
+  gtk_widget_show (exif_vbox);
+  gtk_widget_show (label);
+
+#ifdef HAVE_EXIF
+  browser = gtk_exif_browser_new ();
+  if (!exif_data)
+    exif_data = exif_data_new ();
+  gtk_exif_browser_set_data (GTK_EXIF_BROWSER (browser), exif_data);
+#else
+  browser = gtk_label_new (_("No EXIF support available."));
+#endif
+  gtk_box_pack_start (GTK_BOX (exif_vbox), browser, TRUE, TRUE, 0);
+  gtk_widget_show (browser);
 
   /* sg - preview */
   prv_frame = gtk_frame_new (_("Image Preview"));
