 app/Makefile.am                                |   8 +-
 app/actions/file-actions.c                     |   7 +
 app/actions/file-commands.c                    |  17 +
 app/actions/file-commands.h                    |   2 +
 app/core/Makefile.am                           |  12 +
 app/core/gimpimage-metadata.c                  | 541 +++++++++++++++
 app/core/gimpimage-metadata.h                  |  50 ++
 app/core/gimpimage-private.h                   |   1 +
 app/core/gimpimage.c                           |  92 ++-
 app/core/gimpimage.h                           |   7 +
 app/dialogs/Makefile.am                        |   6 +
 app/dialogs/metadata-dialog.c                  | 261 +++++++
 app/dialogs/metadata-dialog.h                  |  80 +++
 app/file/Makefile.am                           |   6 +
 app/file/file-open.c                           | 153 ++++-
 app/file/file-save.c                           | 274 ++++++++
 app/pdb/Makefile.am                            |   1 +
 app/pdb/metadata-cmds.c                        | 163 +++++
 app/ui/Makefile.am                             |   6 +
 app/ui/metadata.ui                             | 895 +++++++++++++++++++++++++
 app/widgets/gimphelp-ids.h                     |   2 +
 configure.ac                                   |  25 +
 libgimp/Makefile.am                            |  23 +
 libgimp/gimp.def                               |   2 +
 libgimp/gimp.h                                 |   1 +
 libgimp/gimp_pdb_headers.h                     |   1 +
 libgimp/gimpmetadata.c                         | 223 ++++++
 libgimp/gimpmetadata.h                         |  51 ++
 libgimp/gimpmetadata_pdb.c                     |  97 +++
 libgimp/gimpmetadata_pdb.h                     |  42 ++
 libgimpbase/Makefile.am                        |   5 +-
 libgimpbase/gimpbase.def                       |   1 +
 libgimpbase/gimpbase.h                         |   1 +
 libgimpbase/gimpwilber.c                       |  67 ++
 libgimpbase/gimpwilber.h                       |  31 +
 menus/image-menu.xml.in                        |   1 +
 plug-ins/color-rotate/color-rotate-callbacks.c | 184 ++---
 plug-ins/color-rotate/color-rotate-dialog.c    |  68 +-
 plug-ins/color-rotate/color-rotate-utils.c     |  28 +-
 plug-ins/color-rotate/color-rotate.c           |  36 +-
 plug-ins/color-rotate/color-rotate.h           |   2 +-
 plug-ins/file-jpeg/jpeg-load.c                 |   2 +-
 tools/pdbgen/Makefile.am                       |   1 +
 tools/pdbgen/pdb/metadata.pdb                  |  85 +++
 44 files changed, 3396 insertions(+), 165 deletions(-)

diff --git a/app/Makefile.am b/app/Makefile.am
index e559433..e506ac6 100644
--- a/app/Makefile.am
+++ b/app/Makefile.am
@@ -30,6 +30,7 @@ SUBDIRS = \
 	actions		\
 	menus		\
 	gui		\
+	ui		\
 	.		\
 	tests
 
@@ -157,8 +158,8 @@ gimpconsoleldadd = \
 	pdb/libapppdb.a			\
 	plug-in/libappplug-in.a		\
 	vectors/libappvectors.a		\
-	core/libappcore.a		\
 	file/libappfile.a		\
+	core/libappcore.a		\
 	text/libapptext.a		\
 	paint/libapppaint.a		\
 	operations/libappoperations.a	\
@@ -180,6 +181,11 @@ gimpconsoleldadd = \
 	$(INTLLIBS)			\
 	$(RT_LIBS)
 
+if HAVE_LIBGEXIV2
+gimpconsoleldadd += \
+  $(GEXIV2_LIBS)
+endif
+
 gimp_@GIMP_APP_VERSION@_LDFLAGS = \
 	$(AM_LDFLAGS)		\
 	$(win32_ldflags)	\
diff --git a/app/actions/file-actions.c b/app/actions/file-actions.c
index 45185a2..0c1c5d3 100644
--- a/app/actions/file-actions.c
+++ b/app/actions/file-actions.c
@@ -108,6 +108,12 @@ static const GimpActionEntry file_actions[] =
     G_CALLBACK (file_close_all_cmd_callback),
     GIMP_HELP_FILE_CLOSE_ALL },
 
+  { "file-show-metadata", NULL,
+    NC_("file-action", "Show Metadata"), NULL,
+    NC_("file-action", "Show metadata of image"),
+    G_CALLBACK (file_show_metadata_cmd_callback),
+    GIMP_HELP_FILE_SHOW_METADATA },
+
   { "file-quit", GTK_STOCK_QUIT,
     NC_("file-action", "_Quit"), "<primary>Q",
     NC_("file-action", "Quit the GNU Image Manipulation Program"),
@@ -280,6 +286,7 @@ file_actions_update (GimpActionGroup *group,
   SET_SENSITIVE ("file-save-as",         drawable);
   SET_SENSITIVE ("file-save-a-copy",     drawable);
   SET_SENSITIVE ("file-revert",          image && (gimp_image_get_uri (image) || source));
+  SET_SENSITIVE ("file-show-metadata",   image);
   SET_SENSITIVE ("file-export-to",       drawable);
   SET_VISIBLE   ("file-export-to",       ! show_overwrite);
   SET_SENSITIVE ("file-overwrite",       show_overwrite);
diff --git a/app/actions/file-commands.c b/app/actions/file-commands.c
index bdd4fdc..1d7c9df 100644
--- a/app/actions/file-commands.c
+++ b/app/actions/file-commands.c
@@ -53,6 +53,7 @@
 #include "display/gimpdisplay-foreach.h"
 
 #include "dialogs/file-save-dialog.h"
+#include "dialogs/metadata-dialog.h"
 
 #include "actions.h"
 #include "file-commands.h"
@@ -478,6 +479,22 @@ file_close_all_cmd_callback (GtkAction *action,
 }
 
 void
+file_show_metadata_cmd_callback (GtkAction *action,
+                                 gpointer   data)
+{
+  Gimp        *gimp;
+  GtkWidget   *widget;
+  GimpImage   *image;
+  return_if_no_gimp (gimp, data);
+  return_if_no_widget (widget, data);
+
+  image = action_data_get_image (data);
+
+  metadata_dialog_show (gimp, image);
+
+}
+
+void
 file_quit_cmd_callback (GtkAction *action,
                         gpointer   data)
 {
diff --git a/app/actions/file-commands.h b/app/actions/file-commands.h
index 95ef997..b6b93de 100644
--- a/app/actions/file-commands.h
+++ b/app/actions/file-commands.h
@@ -37,6 +37,8 @@ void   file_create_template_cmd_callback (GtkAction   *action,
 
 void   file_revert_cmd_callback          (GtkAction   *action,
                                           gpointer     data);
+void   file_show_metadata_cmd_callback   (GtkAction   *action,
+                                          gpointer     data);
 void   file_close_all_cmd_callback       (GtkAction   *action,
                                           gpointer     data);
 void   file_quit_cmd_callback            (GtkAction   *action,
diff --git a/app/core/Makefile.am b/app/core/Makefile.am
index df5435b..49631a3 100644
--- a/app/core/Makefile.am
+++ b/app/core/Makefile.am
@@ -12,6 +12,11 @@ AM_CPPFLAGS = \
 	$(GDK_PIXBUF_CFLAGS)				\
 	-I$(includedir)
 
+if HAVE_LIBGEXIV2
+AM_CPPFLAGS += \
+  $(GEXIV2_CFLAGS)
+endif
+
 noinst_LIBRARIES = libappcore.a
 
 libappcore_a_sources = \
@@ -380,6 +385,13 @@ libappcore_a_extra_sources = \
 
 libappcore_a_SOURCES = $(libappcore_a_built_sources) $(libappcore_a_sources)
 
+if HAVE_LIBGEXIV2
+libappcore_a_SOURCES += \
+  gimpimage-metadata.c \
+  gimpimage-metadata.h
+endif
+
+
 EXTRA_DIST = \
 	$(libappcore_a_extra_sources)
 
diff --git a/app/core/gimpimage-metadata.c b/app/core/gimpimage-metadata.c
new file mode 100644
index 0000000..8aafdd1
--- /dev/null
+++ b/app/core/gimpimage-metadata.c
@@ -0,0 +1,541 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+#include <glib-object.h>
+#include <glib/gprintf.h>
+
+#include "libgimpbase/gimpbase.h"
+
+#include "gimpimage-metadata.h"
+
+static const gchar *tiff_tags[] =
+  {
+    "Xmp.tiff",
+    "Exif.Image.ImageWidth",
+    "Exif.Image.ImageLength",
+    "Exif.Image.BitsPerSample",
+    "Exif.Image.Compression",
+    "Exif.Image.PhotometricInterpretation",
+    "Exif.Image.FillOrder",
+    "Exif.Image.SamplesPerPixel",
+    "Exif.Image.StripOffsets",
+    "Exif.Image.RowsPerStrip",
+    "Exif.Image.StripByteCounts",
+    "Exif.Image.PlanarConfiguration"
+  };
+
+static const gchar *jpeg_tags[] =
+  {
+    "Exif.Image.JPEGProc",
+    "Exif.Image.JPEGInterchangeFormat",
+    "Exif.Image.JPEGInterchangeFormatLength",
+    "Exif.Image.JPEGRestartInterval",
+    "Exif.Image.JPEGLosslessPredictors",
+    "Exif.Image.JPEGPointTransforms",
+    "Exif.Image.JPEGQTables",
+    "Exif.Image.JPEGDCTables",
+    "Exif.Image.JPEGACTables"
+  };
+
+static const gchar *unsupported_tags[] =
+  {
+      "Exif.Image.SubIFDs",
+      "Exif.Image.ClipPath",
+      "Exif.Image.XClipPathUnits",
+      "Exif.Image.YClipPathUnits",
+      "Xmp.xmpMM.History",
+      "Exif.Image.XPTitle",
+      "Exif.Image.XPComment",
+      "Exif.Image.XPAuthor",
+      "Exif.Image.XPKeywords",
+      "Exif.Image.XPSubject",
+      "Exif.Image.DNGVersion",
+      "Exif.Image.DNGBackwardVersion",
+      "Exif.Iop"
+  };
+
+gint                   gimp_image_metadata_length           (gchar        *testline,
+                                                             gchar        *delim);
+
+gboolean               gimp_image_metadata_get_rational     (gchar        *value,
+                                                             gint          sections,
+                                                             gchar      ***numerator,
+                                                             gchar      ***denominator);
+
+/* public functions */
+
+/*
+ * reads metadata from a physical file
+ */
+GExiv2Metadata  *
+gimp_image_metadata_get_from_file (gchar *filename, GError **error)
+{
+  GExiv2Metadata  *meta;
+
+
+  if ( gexiv2_initialize ())
+    {
+      g_clear_error (error);
+      meta = gexiv2_metadata_new ();
+
+      if (! gexiv2_metadata_open_path (meta, filename, error))
+        {
+#ifdef GIMP_CONFIG_DEBUG
+          g_printerr ( "Error occured while loading metadata!\n" );
+          g_printerr ( "Message: %s\n", error->message);
+#endif
+          return NULL;
+        }
+    }
+  return meta;
+}
+
+/*
+ * saves metadata to a physical file
+ */
+void
+gimp_image_metadata_save_to_file (gchar          *filename,
+                                  GExiv2Metadata *metadata,
+                                  GError        **error)
+{
+  if(metadata && filename)
+    {
+      g_clear_error (error);
+      if (! gexiv2_metadata_save_file (metadata, filename, error))
+        {
+#ifdef GIMP_CONFIG_DEBUG
+    g_printerr ( "Error occured while saving metadata!\n" );
+    g_printerr ( "Message: %s\n", error->message );
+#endif
+        }
+    }
+
+}
+
+/**
+ * Deserializes metadata from a string using a
+ * jpg-binary
+ **/
+GExiv2Metadata *
+gimp_image_metadata_deserialize (gchar *metadata_string)
+{
+  GError         **error = NULL;
+  GExiv2Metadata  *metadata;
+  GString         *buffer;
+  gint             i;
+  gint             j;
+  gchar          **meta_info = NULL;
+  gchar          **tag_info = NULL;
+  guint            size;
+  const guint8    *wilber;
+  gint             num;
+  gchar           *value;
+
+  if ( gexiv2_initialize ())
+    {
+      metadata = gexiv2_metadata_new ();
+
+      wilber = gimp_wilber_get_data (&size);
+
+      if (! gexiv2_metadata_open_buf (metadata, wilber, size, error))
+        {
+#ifdef GIMP_CONFIG_DEBUG
+          g_printerr ( "Error occured while loading metadata!\n" );
+          g_printerr ( "Message: %s\n", error->message );
+#endif
+          return NULL;
+        }
+    }
+
+  if (metadata && metadata_string)
+    {
+
+      meta_info = g_strsplit (metadata_string, TAG_LINE_DELIMITER, -1);
+
+      i=0;
+
+      while (meta_info[i] != NULL)
+        {
+          num = gimp_image_metadata_length (meta_info[i], TAG_TAG_DELIMITER);
+          tag_info = g_strsplit (meta_info[i], TAG_TAG_DELIMITER, -1);
+          if (num > 0)
+            {
+              if (num > 1)
+                {
+                  buffer = g_string_new (NULL);
+                  for (j = 1; j < (num + 1); j++)
+                    {
+                      g_string_append_printf (buffer, "%s%s", tag_info[j], TAG_TAG_DELIMITER); /* recreates value */
+                    }
+                  value = g_strndup (buffer->str, buffer->len - 1);  /* to avoid the trailing '#' */
+                  g_string_free (buffer, TRUE);
+                }
+              else
+                {
+                  value = tag_info[1];
+                }
+
+              gexiv2_metadata_set_tag_string (metadata, tag_info[0], value);  /* setting value to metadata */
+            }
+          i++;
+        }
+    }
+
+  if (meta_info)
+    g_strfreev (meta_info);
+
+  if (tag_info)
+    g_strfreev (tag_info);
+
+  return metadata;
+
+}
+
+/**
+ * Serializing metadata as a string
+ */
+gchar *
+gimp_image_metadata_serialize (GExiv2Metadata *metadata)
+{
+  gchar              **exif_data = NULL;
+  gchar              **iptc_data = NULL;
+  gchar              **xmp_data = NULL;
+  gchar               *value;
+  gint                 i;
+  gint                 n;
+  GString             *metadata_buffer;
+  const gchar         *metadata_string = NULL;
+
+  n = 0;
+
+  if (metadata)
+    {
+      metadata_buffer = g_string_new (NULL);
+
+      exif_data = gexiv2_metadata_get_exif_tags (metadata);
+
+      i = 0;
+      while (exif_data[i] != NULL)
+        {
+          value = gexiv2_metadata_get_tag_string (metadata, exif_data[i]);
+          g_string_append_printf (metadata_buffer, "%s%s%s%s", exif_data[i],
+                                  TAG_TAG_DELIMITER,
+                                  value,
+                                  TAG_LINE_DELIMITER);
+          n++;
+          i++;
+        }
+
+      if(exif_data)
+        g_strfreev (exif_data);
+
+      xmp_data = gexiv2_metadata_get_xmp_tags (metadata);
+
+      i = 0;
+      while (xmp_data[i] != NULL)
+        {
+          value = gexiv2_metadata_get_tag_string (metadata, xmp_data[i]);
+          g_string_append_printf (metadata_buffer, "%s%s%s%s", xmp_data[i],
+                                  TAG_TAG_DELIMITER,
+                                  value,
+                                  TAG_LINE_DELIMITER);
+
+          n++;
+          i++;
+        }
+
+      if(xmp_data)
+        g_strfreev (xmp_data);
+
+      iptc_data = gexiv2_metadata_get_iptc_tags (metadata);
+
+      i = 0;
+      while (iptc_data[i] != NULL)
+        {
+          value = gexiv2_metadata_get_tag_string (metadata, iptc_data[i]);
+          g_string_append_printf (metadata_buffer, "%s%s%s%s", iptc_data[i],
+                                  TAG_TAG_DELIMITER,
+                                  value,
+                                  TAG_LINE_DELIMITER);
+
+          n++;
+          i++;
+        }
+
+      if(iptc_data)
+        g_strfreev (iptc_data);
+
+      if (metadata_buffer->len > 1)
+        metadata_string = g_strndup (metadata_buffer->str, metadata_buffer->len - 1);
+      else
+        metadata_string = g_strdup (metadata_buffer->str);
+
+      g_string_free (metadata_buffer, TRUE);
+
+      return metadata_string;
+    }
+
+  return NULL;
+}
+
+/**
+ * gets exif resolution
+ */
+gboolean
+gimp_image_metadata_get_resolution (GExiv2Metadata *metadata, gdouble *xres, gdouble *yres, gint *unit)
+{
+  gchar *xr;
+  gchar *yr;
+  gchar *un;
+  gchar *r;
+  gdouble x1, x2;
+  gdouble y1, y2;
+
+  gdouble xrd;
+  gdouble yrd;
+
+
+  gint    u;
+  gchar **xnom = NULL;
+  gchar **xdenom = NULL;
+  gchar **ynom = NULL;
+  gchar **ydenom = NULL;
+
+  xr = gexiv2_metadata_get_tag_string (metadata, "Exif.Image.XResolution");
+  yr = gexiv2_metadata_get_tag_string (metadata, "Exif.Image.YResolution");
+  un = gexiv2_metadata_get_tag_string (metadata, "Exif.Image.ResolutionUnit");
+
+  if (gimp_image_metadata_get_rational (xr, 1, &xnom, &xdenom))
+    {
+      x1 = g_ascii_strtod (xnom[0], &r);
+      x2 = g_ascii_strtod (xdenom[0], &r);
+
+      if (x2 == 0.0)
+        return FALSE;
+
+      xrd = x1 / x2;
+      u = atoi (un);
+      switch (u)
+      {
+        case 2:
+          break;
+        case 3:
+          xrd *= 2.54;
+          break;
+        default:
+          break;
+      }
+
+      *xres = xrd;
+
+      *unit = u;
+    }
+
+  if (gimp_image_metadata_get_rational (yr, 1, &ynom, &ydenom))
+    {
+      y1 = g_ascii_strtod (ynom[0], &r);
+      y2 = g_ascii_strtod (ydenom[0], &r);
+
+      if (y2 == 0.0)
+        return FALSE;
+
+      yrd = y1 / y2;
+
+      switch (u)
+      {
+        case 2:
+          break;
+        case 3:
+          yrd *= 2.54;
+          break;
+        default:
+          break;
+      }
+
+      *yres = yrd;
+    }
+
+  g_strfreev (xnom);
+  g_strfreev (xdenom);
+  g_strfreev (ynom);
+  g_strfreev (ydenom);
+
+  return TRUE;
+
+}
+
+/**
+ * sets exif resolution
+ */
+void
+gimp_image_metadata_set_resolution (GExiv2Metadata *metadata, gdouble xres, gdouble yres, gint unit)
+{
+  gchar *str = NULL;
+
+  str = g_strdup_printf ("%.0f/1", xres);
+  gexiv2_metadata_set_tag_string (metadata, "Exif.Image.XResolution", str);
+  str = g_strdup_printf ("%.0f/1", yres);
+  gexiv2_metadata_set_tag_string (metadata, "Exif.Image.YResolution", str);
+  str = g_strdup_printf ("%d", unit);
+  gexiv2_metadata_set_tag_string (metadata, "Exif.Image.ResolutionUnit", str);
+
+}
+
+/**
+ * checks for supported tags
+ */
+gboolean
+gimp_image_metadata_is_tag_supported (gchar *tag, gchar *mime_type)
+{
+  gint j;
+
+  for (j = 0; j < G_N_ELEMENTS (unsupported_tags); j++)
+    {
+      if (g_str_has_prefix (tag, unsupported_tags[j]))
+        {
+          return FALSE;
+        }
+    }
+
+  if (!g_strcmp0 (mime_type, "image/jpeg"))
+    {
+      for (j = 0; j < G_N_ELEMENTS (tiff_tags); j++)
+        {
+          if (g_str_has_prefix (tag, tiff_tags[j]))
+            {
+              return FALSE;
+            }
+        }
+    }
+  else if (!g_strcmp0 (mime_type, "image/tiff"))
+    {
+      for (j = 0; j < G_N_ELEMENTS (jpeg_tags); j++)
+        {
+          if (g_str_has_prefix (tag, jpeg_tags[j]))
+            {
+              return FALSE;
+            }
+        }
+    }
+
+  return TRUE;
+
+}
+
+
+/* private functions */
+
+/**
+ * determines the amound of delimiters in serialized
+ * metadata string
+ */
+gint
+gimp_image_metadata_length (gchar *testline, gchar *delim)
+{
+  gchar     *delim_test;
+  gint       i;
+  gint       sum;
+
+  delim_test = g_strdup (testline);
+
+  sum =0;
+
+  for (i=0; i < strlen (delim_test); i++)
+    {
+      if (delim_test[i] == delim[0])
+        sum++;
+    }
+
+  g_free (delim_test);
+  return sum;
+}
+
+/**
+ * gets rational values from string
+ */
+gboolean
+gimp_image_metadata_get_rational (gchar *value, gint sections, gchar ***numerator, gchar ***denominator)
+{
+  GSList *nomlist = NULL;
+  GSList *denomlist = NULL;
+
+  GSList *nlist, *dlist;
+
+  gchar   sect[] = " ";
+  gchar   rdel[] = "/";
+  gchar **sects;
+  gchar **nom;
+  gint    i;
+  gint    n;
+
+  gchar **num;
+  gchar **den;
+
+  if (!value)
+    return FALSE;
+
+  if(gimp_image_metadata_length (value, sect) == (sections -1))
+    {
+      i = 0;
+      sects = g_strsplit (value, sect, -1);
+      while (sects[i] != NULL)
+        {
+          if(gimp_image_metadata_length (sects[i], rdel) == 1)
+            {
+              nom = g_strsplit (sects[i], rdel, -1);
+              nomlist = g_slist_prepend (nomlist, g_strdup (nom[0]));
+              denomlist = g_slist_prepend (denomlist, g_strdup (nom[1]));
+            }
+          else
+            {
+              return FALSE;
+            }
+          i++;
+        }
+    }
+  else
+    {
+      return FALSE;
+    }
+
+  n = i;
+
+  num = g_new0 (gchar*, i + 1);
+  den = g_new0 (gchar*, n + 1);
+
+  for (nlist = nomlist; nlist; nlist = nlist->next)
+    num[--i] = nlist->data;
+
+  for (dlist = denomlist; dlist; dlist = dlist->next)
+    den[--n] = dlist->data;
+
+  *numerator = num;
+  *denominator = den;
+
+  g_slist_free (nomlist);
+  g_slist_free (denomlist);
+
+  g_strfreev (sects);
+  g_strfreev (nom);
+
+  return TRUE;
+}
diff --git a/app/core/gimpimage-metadata.h b/app/core/gimpimage-metadata.h
new file mode 100644
index 0000000..0f36c98
--- /dev/null
+++ b/app/core/gimpimage-metadata.h
@@ -0,0 +1,50 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef METADATA_H_
+#define METADATA_H_
+
+#include <gexiv2/gexiv2.h>
+
+#define TAG_LINE_DELIMITER "\v"
+#define TAG_TAG_DELIMITER  "#"
+
+GExiv2Metadata  *gimp_image_metadata_get_from_file       (gchar            *filename,
+                                                          GError          **error);
+
+void             gimp_image_metadata_save_to_file        (gchar            *filename,
+                                                          GExiv2Metadata   *metadata,
+                                                          GError          **error);
+
+GExiv2Metadata  *gimp_image_metadata_deserialize         (gchar            *metadata_string);
+
+gchar           *gimp_image_metadata_serialize           (GExiv2Metadata   *metadata);
+
+gboolean         gimp_image_metadata_get_resolution      (GExiv2Metadata   *metadata,
+                                                          gdouble          *xres,
+                                                          gdouble          *yres,
+                                                          gint             *unit);
+
+void             gimp_image_metadata_set_resolution      (GExiv2Metadata   *metadata,
+                                                          gdouble           xres,
+                                                          gdouble           yres,
+                                                          gint              unit);
+
+gboolean         gimp_image_metadata_is_tag_supported    (gchar            *tag,
+                                                          gchar            *mime_type);
+
+#endif /* METADATA_H_ */
diff --git a/app/core/gimpimage-private.h b/app/core/gimpimage-private.h
index 5dee180..a1be220 100644
--- a/app/core/gimpimage-private.h
+++ b/app/core/gimpimage-private.h
@@ -48,6 +48,7 @@ struct _GimpImagePrivate
   GimpUnit           resolution_unit;       /*  resolution unit              */
   GimpImageBaseType  base_type;             /*  base gimp_image type         */
   GimpPrecision      precision;             /*  image's precision            */
+  GExiv2Metadata    *metadata;              /*  images metadata              */
 
   guchar            *colormap;              /*  colormap (for indexed)       */
   gint               n_colors;              /*  # of colors (for indexed)    */
diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c
index 112f3c9..08a20ff 100644
--- a/app/core/gimpimage.c
+++ b/app/core/gimpimage.c
@@ -129,7 +129,8 @@ enum
   PROP_WIDTH,
   PROP_HEIGHT,
   PROP_BASE_TYPE,
-  PROP_PRECISION
+  PROP_PRECISION,
+  PROP_METADATA
 };
 
 
@@ -564,6 +565,12 @@ gimp_image_class_init (GimpImageClass *klass)
                                                         GIMP_PARAM_READWRITE |
                                                         G_PARAM_CONSTRUCT_ONLY));
 
+  g_object_class_install_property (object_class, PROP_METADATA,
+                                   g_param_spec_object ("metadata", NULL, NULL,
+                                                        GEXIV2_TYPE_METADATA,
+                                                        GIMP_PARAM_READWRITE |
+                                                        G_PARAM_CONSTRUCT));
+
   g_object_class_install_property (object_class, PROP_ID,
                                    g_param_spec_int ("id", NULL, NULL,
                                                      0, G_MAXINT, 0,
@@ -633,6 +640,7 @@ gimp_image_init (GimpImage *image)
   private->resolution_unit     = GIMP_UNIT_INCH;
   private->base_type           = GIMP_RGB;
   private->precision           = GIMP_PRECISION_U8_GAMMA;
+  private->metadata            = NULL;
 
   private->colormap            = NULL;
   private->n_colors            = 0;
@@ -793,6 +801,9 @@ gimp_image_set_property (GObject      *object,
     case PROP_GIMP:
       image->gimp = g_value_get_object (value);
       break;
+    case PROP_METADATA:
+      private->metadata = (GExiv2Metadata *)g_value_get_object (value);
+      break;
     case PROP_ID:
       g_assert_not_reached ();
       break;
@@ -828,6 +839,9 @@ gimp_image_get_property (GObject    *object,
     case PROP_GIMP:
       g_value_set_object (value, image->gimp);
       break;
+    case PROP_METADATA:
+      g_value_set_object (value, private->metadata);
+      break;
     case PROP_ID:
       g_value_set_int (value, private->ID);
       break;
@@ -905,6 +919,12 @@ gimp_image_finalize (GObject *object)
       private->projection = NULL;
     }
 
+  if (private->metadata)
+    {
+      gexiv2_metadata_free (private->metadata);
+      private->metadata = NULL;
+    }
+
   if (private->graph)
     {
       g_object_unref (private->graph);
@@ -1095,9 +1115,12 @@ gimp_image_get_size (GimpViewable *viewable,
 static void
 gimp_image_size_changed (GimpViewable *viewable)
 {
+  GExiv2Metadata *metadata;
   GimpImage *image = GIMP_IMAGE (viewable);
   GList     *all_items;
   GList     *list;
+  gint       width;
+  gint       height;
 
   if (GIMP_VIEWABLE_CLASS (parent_class)->size_changed)
     GIMP_VIEWABLE_CLASS (parent_class)->size_changed (viewable);
@@ -1122,6 +1145,17 @@ gimp_image_size_changed (GimpViewable *viewable)
 
   gimp_viewable_size_changed (GIMP_VIEWABLE (gimp_image_get_mask (image)));
 
+  metadata = gimp_image_get_metadata (image);
+
+#if defined (HAVE_LIBGEXIV2)
+  if (metadata)
+    {
+      gimp_image_get_size (image, &width, &height);
+
+      gexiv2_metadata_set_tag_string (metadata,  "Exif.Image.ImageWidth", g_strdup_printf ("%d", width));
+      gexiv2_metadata_set_tag_string (metadata,  "Exif.Image.ImageLength", g_strdup_printf ("%d", height));
+    }
+#endif
   gimp_projectable_structure_changed (GIMP_PROJECTABLE (image));
 }
 
@@ -2452,7 +2486,38 @@ void
 gimp_image_precision_changed (GimpImage *image)
 {
   g_return_if_fail (GIMP_IS_IMAGE (image));
+  GExiv2Metadata *metadata;
+  gchar *precision_str;
 
+#if defined (HAVE_LIBGEXIV2)
+  metadata = gimp_image_get_metadata (image);
+  if (metadata)
+    {
+      switch (gimp_image_get_precision (image))
+        {
+        case   GIMP_PRECISION_U8_LINEAR: /*< desc="8-bit linear integer"         >*/
+        case   GIMP_PRECISION_U8_GAMMA:  /*< desc="8-bit gamma integer"          >*/
+          precision_str = "8 8 8";
+          break;
+        case   GIMP_PRECISION_U16_LINEAR:  /*< desc="16-bit linear integer"        >*/
+        case   GIMP_PRECISION_U16_GAMMA:   /*< desc="16-bit gamma integer"         >*/
+        case   GIMP_PRECISION_HALF_LINEAR: /*< desc="16-bit linear floating point" >*/
+        case   GIMP_PRECISION_HALF_GAMMA:  /*< desc="16-bit gamma floating point"  >*/
+          precision_str = "16 16 16";
+          break;
+        case   GIMP_PRECISION_U32_LINEAR: /*< desc="32-bit linear integer"        >*/
+        case   GIMP_PRECISION_U32_GAMMA:  /*< desc="32-bit gamma integer"         >*/
+        case   GIMP_PRECISION_FLOAT_LINEAR: /*< desc="32-bit linear floating point" >*/
+        case   GIMP_PRECISION_FLOAT_GAMMA:  /*< desc="32-bit gamma floating point"  >*/
+          precision_str = "32 32 32";
+          break;
+        default:
+          precision_str = "8 8 8";
+          break;
+        }
+      gexiv2_metadata_set_tag_string (metadata, "Exif.Image.BitsPerSample", precision_str);
+    }
+#endif
   g_signal_emit (image, gimp_image_signals[PRECISION_CHANGED], 0);
 }
 
@@ -4117,3 +4182,28 @@ gimp_image_invalidate_previews (GimpImage *image)
   gimp_item_stack_invalidate_previews (layers);
   gimp_item_stack_invalidate_previews (channels);
 }
+
+GExiv2Metadata *
+gimp_image_get_metadata (GimpImage *image)
+{
+  GimpImagePrivate *private;
+
+  g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
+
+  private = GIMP_IMAGE_GET_PRIVATE (image);
+
+  return private->metadata;
+}
+
+void
+gimp_image_set_metadata (GimpImage * image, GExiv2Metadata *metadata)
+{
+  GimpImagePrivate *private;
+
+  g_return_if_fail (GIMP_IS_IMAGE (image));
+
+  private = GIMP_IMAGE_GET_PRIVATE (image);
+
+  private->metadata = metadata;
+
+}
diff --git a/app/core/gimpimage.h b/app/core/gimpimage.h
index 3cd6a1e..bc9b9c8 100644
--- a/app/core/gimpimage.h
+++ b/app/core/gimpimage.h
@@ -20,6 +20,9 @@
 
 
 #include "gimpviewable.h"
+#if defined (HAVE_LIBGEXIV2)
+#include <gexiv2/gexiv2.h>
+#endif /* HAVE_LIBGEXIV2 */
 
 
 #define GIMP_IMAGE_ACTIVE_PARENT ((gpointer) 1)
@@ -420,5 +423,9 @@ void            gimp_image_invalidate_previews   (GimpImage          *image);
 
 const gchar   * gimp_image_get_string_untitled   (void);
 
+GExiv2Metadata *gimp_image_get_metadata          (GimpImage          *image);
+
+void            gimp_image_set_metadata          (GimpImage          *image,
+                                                  GExiv2Metadata     *metadata);
 
 #endif /* __GIMP_IMAGE_H__ */
diff --git a/app/dialogs/Makefile.am b/app/dialogs/Makefile.am
index 63fdb64..b10aa58 100644
--- a/app/dialogs/Makefile.am
+++ b/app/dialogs/Makefile.am
@@ -97,6 +97,12 @@ libappdialogs_a_built_sources = \
 libappdialogs_a_SOURCES = \
 	$(libappdialogs_a_built_sources) $(libappdialogs_a_sources)
 
+if HAVE_LIBGEXIV2
+libappdialogs_a_SOURCES += \
+	metadata-dialog.c			\
+	metadata-dialog.h
+endif
+
 EXTRA_DIST = \
 	authors.xsl
 
diff --git a/app/dialogs/metadata-dialog.c b/app/dialogs/metadata-dialog.c
new file mode 100644
index 0000000..c1df04f
--- /dev/null
+++ b/app/dialogs/metadata-dialog.c
@@ -0,0 +1,261 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#include <string.h>
+#include <gtk/gtk.h>
+#include <gegl.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpbase/gimpbase.h"
+#include "libgimpwidgets/gimpwidgets.h"
+
+#include "dialogs-types.h"
+
+#include "gegl/gimp-babl.h"
+
+#include "core/gimp.h"
+#include "core/gimpimage.h"
+
+#include "core/gimpimage-metadata.h"
+
+#include "file/file-utils.h"
+
+#include "widgets/gimphelp-ids.h"
+
+#include "metadata-dialog.h"
+
+#include "gimp-intl.h"
+
+#if defined (HAVE_LIBGEXIV2)
+#include <gexiv2/gexiv2.h>
+#include "core/gimpimage-metadata.h"
+#endif /* HAVE_LIBGEXIV2 */
+
+
+/*  local function prototypes  */
+static void   metadata_dialog_get_metadata  (GimpImage             *image,
+                                             GtkBuilder            *builder);
+
+static void   metadata_dialog_response      (GtkWidget             *dialog,
+                                             guint                  response_id,
+                                             Gimp                  *gimp);
+
+static void   metadata_dialog_iptc_callback (GtkWidget             *dialog,
+                                             BuildHandler          *handler);
+
+/*  public functions  */
+
+GtkWidget *
+metadata_dialog_show (Gimp *gimp, GimpImage *image)
+{
+  GError       *error = NULL;
+  GtkWidget    *dialog;
+  BuildHandler *handler;
+  GtkWidget    *metadata_vbox;
+  GtkWidget    *content_area;
+  GtkButton    *write_button;
+  gchar        *ui_file = NULL;
+  const gchar  *fname;
+
+  g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
+
+  handler = g_new0 (BuildHandler, 1);
+
+  handler->builder = gtk_builder_new();
+
+  handler->image = image;
+
+  fname = file_utils_uri_display_basename(gimp_image_get_any_uri (image));
+
+  ui_file = g_build_filename (gimp_data_directory (),"ui/metadata.ui", NULL);
+  if( ! gtk_builder_add_from_file( handler->builder, ui_file, &error ) )
+    {
+      g_print( "Error occured while loading UI file!\n" );
+      g_print( "Message: %s\n", error->message );
+      return NULL;
+    }
+
+  metadata_vbox = GTK_WIDGET( gtk_builder_get_object( handler->builder, "metadata_vbox" ) );
+
+  dialog = gimp_dialog_new (g_strdup_printf ("Metadata: %s", fname),
+                            "gimp-metadata-dialog",
+                            NULL, 0,
+                            gimp_standard_help_func,
+                            GIMP_HELP_METADATA_DIALOG,
+
+                            GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
+
+                            NULL);
+
+  gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
+                                           GTK_RESPONSE_CLOSE,
+                                           -1);
+
+  g_signal_connect (dialog, "response",
+                    G_CALLBACK (metadata_dialog_response),
+                    gimp);
+
+  content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+  gtk_box_pack_start( GTK_BOX( content_area ), metadata_vbox, TRUE, TRUE, 0 );
+
+  write_button = GTK_BUTTON (gtk_builder_get_object (handler->builder, "iptc_write_button"));
+
+  g_signal_connect(G_OBJECT(write_button), "clicked",
+                   G_CALLBACK(metadata_dialog_iptc_callback),
+                   handler);
+
+  metadata_dialog_get_metadata (image, handler->builder);
+
+  gtk_window_set_default_size (GTK_WINDOW (dialog), 400, 500);
+
+  gtk_widget_show (dialog);
+  return dialog;
+}
+
+/*  private functions  */
+
+static void
+metadata_dialog_get_metadata (GimpImage *image, GtkBuilder *builder)
+{
+#if defined (HAVE_LIBGEXIV2)
+  GExiv2Metadata *metadata;
+  GtkWidget     *widget;
+  GtkEntry      *entry_widget;
+  GtkTextView   *textview_widget;
+  GtkTextBuffer *text_view_buffer;
+  GtkListStore  *exif_list_store;
+  GtkListStore  *xmp_list_store;
+  gchar        **exif_data;
+  gchar        **iptc_data;
+  gchar        **xmp_data;
+  gchar         *value;
+  gchar         *value_utf;
+  GtkTreeIter    iter;
+  gint           i;
+
+  exif_list_store = GTK_LIST_STORE (gtk_builder_get_object ( builder, "exifliststore" ));
+  xmp_list_store = GTK_LIST_STORE (gtk_builder_get_object ( builder, "xmpliststore" ));
+
+  metadata = gimp_image_get_metadata (image);
+
+  if (metadata)
+    {
+      exif_data = gexiv2_metadata_get_exif_tags (metadata);
+
+      i = 0;
+      while (exif_data[i] != NULL)
+        {
+          gtk_list_store_append(exif_list_store, &iter);
+          value = gexiv2_metadata_get_tag_interpreted_string (metadata, exif_data[i]);
+          value_utf = g_locale_to_utf8 (value, strlen (value), NULL, NULL, NULL);
+          gtk_list_store_set (exif_list_store, &iter,
+                              C_EXIF_TAG, exif_data[i],
+                              C_EXIF_VALUE, value_utf,
+                              -1);
+          i++;
+        }
+
+      xmp_data = gexiv2_metadata_get_xmp_tags (metadata);
+
+      i = 0;
+      while (xmp_data[i] != NULL)
+        {
+          gtk_list_store_append(xmp_list_store, &iter);
+          value = gexiv2_metadata_get_tag_interpreted_string (metadata, xmp_data[i]);
+          value_utf = g_locale_to_utf8 (value, strlen (value), NULL, NULL, NULL);
+          gtk_list_store_set (xmp_list_store, &iter,
+                              C_XMP_TAG, xmp_data[i],
+                              C_XMP_VALUE, value_utf,
+                              -1);
+          i++;
+        }
+
+      iptc_data = gexiv2_metadata_get_iptc_tags (metadata);
+
+      i = 0;
+      while (iptc_data[i] != NULL)
+        {
+          widget = GTK_WIDGET( gtk_builder_get_object(builder, iptc_data[i] ) );
+          value = gexiv2_metadata_get_tag_interpreted_string (metadata, iptc_data[i]);
+          value_utf = g_locale_to_utf8 (value, strlen (value), NULL, NULL, NULL);
+          if (GTK_IS_ENTRY (widget))
+            {
+              entry_widget = GTK_ENTRY (widget);
+              gtk_entry_set_text (entry_widget, value_utf);
+            }
+          else if (GTK_IS_TEXT_VIEW (widget))
+            {
+              textview_widget = GTK_TEXT_VIEW (widget);
+              text_view_buffer = gtk_text_view_get_buffer (textview_widget);
+              gtk_text_buffer_set_text (text_view_buffer, value_utf, strlen (value_utf));
+            }
+          i++;
+        }
+    }
+
+#endif
+}
+
+static void
+metadata_dialog_iptc_callback (GtkWidget *dialog, BuildHandler *handler)
+{
+  GExiv2Metadata *metadata;
+  GtkEntry      *entry;
+  GtkTextView   *text_view;
+  GtkTextBuffer *text_view_buffer;
+  GtkTextIter   start;
+  GtkTextIter   end;
+  gchar         *multi_text = NULL;
+
+  gint i;
+
+  metadata = gimp_image_get_metadata (handler->image);
+
+  for (i = 0; i < G_N_ELEMENTS (iptc_tags); i++)
+    {
+      if (!strcmp ("single", iptc_tags[i].mode))
+        {
+          entry = GTK_ENTRY (gtk_builder_get_object (handler->builder, iptc_tags[i].tag));
+          gexiv2_metadata_set_tag_string (metadata, iptc_tags[i].tag, gtk_entry_get_text (entry));
+        }
+      else if (!strcmp ("multi", iptc_tags[i].mode))
+        {
+          text_view = GTK_TEXT_VIEW (gtk_builder_get_object (handler->builder, iptc_tags[i].tag));
+          text_view_buffer = gtk_text_view_get_buffer (text_view);
+          gtk_text_buffer_get_start_iter (text_view_buffer, &start);
+          gtk_text_buffer_get_end_iter (text_view_buffer, &end);
+          multi_text = gtk_text_buffer_get_text (text_view_buffer, &start, &end, TRUE);
+          gexiv2_metadata_set_tag_string (metadata, iptc_tags[i].tag, multi_text);
+        }
+    }
+  g_free (multi_text);
+}
+
+static void
+metadata_dialog_response (GtkWidget *dialog,
+                          guint      response_id,
+                          Gimp      *gimp)
+{
+  switch (response_id)
+    {
+    default:
+      gtk_widget_destroy (dialog);
+      break;
+    }
+}
diff --git a/app/dialogs/metadata-dialog.h b/app/dialogs/metadata-dialog.h
new file mode 100644
index 0000000..dd472a4
--- /dev/null
+++ b/app/dialogs/metadata-dialog.h
@@ -0,0 +1,80 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __INPUT_DEVICES_DIALOG_H__
+#define __INPUT_DEVICES_DIALOG_H__
+
+#define EXIF_PREFIX "Exif."
+#define IPTC_PREFIX "Iptc."
+#define XMP_PREFIX  "Xmp."
+
+enum
+{
+  C_XMP_TAG = 0,
+  C_XMP_VALUE,
+  NUM_XMP_COLS
+};
+
+enum
+{
+  C_EXIF_TAG = 0,
+  C_EXIF_VALUE,
+  NUM_EXIF_COLS
+};
+
+typedef struct _BuildHandler BuildHandler;
+
+struct _BuildHandler
+{
+  GimpImage  *image;
+  GtkBuilder *builder;
+  gchar      *meta;
+};
+
+typedef struct
+{
+  gchar * tag;
+  gchar * mode;
+}iptc_tag;
+
+static const iptc_tag const iptc_tags[] =
+{
+  {"Iptc.Application2.Byline",                  "single"},
+  {"Iptc.Application2.BylineTitle",             "single"},
+  {"Iptc.Application2.Caption",                 "multi"},
+  {"Iptc.Application2.Category",                "single"},
+  {"Iptc.Application2.City",                    "single"},
+  {"Iptc.Application2.Copyright",               "single"},
+  {"Iptc.Application2.CountryName",             "single"},
+  {"Iptc.Application2.Credit",                  "single"},
+  {"Iptc.Application2.Headline",                "multi"},
+  {"Iptc.Application2.Keywords",                "multi"},
+  {"Iptc.Application2.ObjectName",              "single"},
+  {"Iptc.Application2.ProvinceState",           "single"},
+  {"Iptc.Application2.Source",                  "single"},
+  {"Iptc.Application2.SpecialInstructions",     "multi"},
+  {"Iptc.Application2.SubLocation",             "single"},
+  {"Iptc.Application2.SuppCategory",            "multi"},
+  {"Iptc.Application2.TransmissionReference",   "single"},
+  {"Iptc.Application2.Urgency",                 "single"},
+  {"Iptc.Application2.Writer",                  "single"}
+};
+
+GtkWidget * metadata_dialog_show (Gimp *gimp, GimpImage *image);
+
+
+#endif /* __INPUT_DEVICES_DIALOG_H__ */
diff --git a/app/file/Makefile.am b/app/file/Makefile.am
index 19db33b..150e56f 100644
--- a/app/file/Makefile.am
+++ b/app/file/Makefile.am
@@ -10,6 +10,12 @@ AM_CPPFLAGS = \
 	$(GDK_PIXBUF_CFLAGS)		\
 	-I$(includedir)
 
+if HAVE_LIBGEXIV2
+AM_CPPFLAGS += \
+	$(GTK_CFLAGS)	\
+  $(GEXIV2_CFLAGS)
+endif
+
 noinst_LIBRARIES = libappfile.a
 
 libappfile_a_SOURCES = \
diff --git a/app/file/file-open.c b/app/file/file-open.c
index 14c1d24..1ed79c5 100644
--- a/app/file/file-open.c
+++ b/app/file/file-open.c
@@ -32,6 +32,7 @@
 #include <unistd.h>
 #endif
 
+#include <gtk/gtk.h>
 #include <gegl.h>
 #include <glib/gstdio.h>
 
@@ -55,11 +56,12 @@
 #include "core/gimpimage.h"
 #include "core/gimpimage-merge.h"
 #include "core/gimpimage-undo.h"
+#include "core/gimpimage-flip.h"
+#include "core/gimpimage-rotate.h"
 #include "core/gimpimagefile.h"
 #include "core/gimplayer.h"
 #include "core/gimpparamspecs.h"
 #include "core/gimpprogress.h"
-
 #include "pdb/gimppdb.h"
 
 #include "plug-in/gimppluginmanager.h"
@@ -74,6 +76,10 @@
 
 #include "gimp-intl.h"
 
+#if defined (HAVE_LIBGEXIV2)
+#include <gexiv2/gexiv2.h>
+#include "core/gimpimage-metadata.h"
+#endif /* HAVE_LIBGEXIV2 */
 
 static void     file_open_sanitize_image       (GimpImage                 *image,
                                                 gboolean                   as_new);
@@ -88,6 +94,14 @@ static GList *  file_open_get_layers           (const GimpImage           *image
                                                 gboolean                   merge_visible,
                                                 gint                      *n_visible);
 static gboolean file_open_file_proc_is_import  (const GimpPlugInProcedure *file_proc);
+void            file_set_image_metadata        (GimpImage                 *image,
+                                                const gchar               *uri);
+void            file_evaluate_image_metadata   (GimpImage                 *image,
+                                                GimpContext               *context);
+gboolean        file_open_metadata             (Gimp                      *gimp,
+                                                GimpContext               *context,
+                                                GimpImage                 *image,
+                                                const gchar               *uri);
 
 
 /*  public functions  */
@@ -453,6 +467,8 @@ file_open_with_proc_and_display (Gimp                *gimp,
 
   if (image)
     {
+      file_set_image_metadata (image, uri);
+      file_evaluate_image_metadata (image, context);
       /* If the file was imported we want to set the layer name to the
        * file name. For now, assume that multi-layered imported images
        * have named the layers already, so only rename the layer of
@@ -508,7 +524,7 @@ file_open_with_proc_and_display (Gimp                *gimp,
             }
         }
 
-      /*  announce that we opened this image  */
+/*  announce that we opened this image  */
       gimp_image_opened (image->gimp, uri);
     }
 
@@ -838,3 +854,136 @@ file_open_file_proc_is_import (const GimpPlugInProcedure *file_proc)
            file_proc->mime_type &&
            strcmp (file_proc->mime_type, "image/xcf") == 0);
 }
+
+/**
+ * Gets Exif Metadata from file and sets is as an image property
+ */
+void
+file_set_image_metadata (GimpImage *image, const gchar *uri)
+{
+#if defined (HAVE_LIBGEXIV2)
+  GError             **error = NULL;
+  gchar               *filename;
+  GExiv2Metadata      *metadata;
+  gchar               *metadata_string;
+
+
+  filename = file_utils_filename_from_uri (uri);
+
+  metadata = gimp_image_metadata_get_from_file (filename, error);
+
+  if (metadata)
+    {
+      metadata_string = gimp_image_metadata_serialize (metadata);
+      gexiv2_metadata_free (metadata);
+    }
+
+  metadata = gimp_image_metadata_deserialize (metadata_string);
+  gimp_image_set_metadata (image, metadata);
+
+  g_free (filename);
+#endif
+}
+
+/**
+ * Evaluates metadata and sets image information accordingly
+ * User Comment -> gimp-comment parasite
+ * Resolution   -> image resolution
+ * Orientation  -> image orientation
+ * Erases exif thumbnail, it will be rewritten, when exported
+ **/
+void
+file_evaluate_image_metadata (GimpImage *image, GimpContext *context)
+{
+#if defined (HAVE_LIBGEXIV2)
+  GExiv2Metadata *metadata;
+
+  metadata = gimp_image_get_metadata (image);
+
+  if (metadata)
+    {
+      gchar    *comment;
+      gdouble   xres;
+      gdouble   yres;
+      gint      unit;
+      gint      orientation;
+
+      comment = gexiv2_metadata_get_tag_string (metadata, "Exif.Photo.UserComment");
+      if (comment)
+        {
+          GimpParasite   *parasite;
+
+          parasite = gimp_parasite_new ("gimp-comment",
+                                        GIMP_PARASITE_PERSISTENT,
+                                        strlen (comment)+1,
+                                        comment);
+
+          gimp_image_parasite_attach (image, parasite);
+          gimp_parasite_free (parasite);
+        }
+
+      if (gimp_image_metadata_get_resolution (metadata, &xres, &yres, &unit))
+        {
+          gimp_image_set_resolution (image, xres, yres);
+          switch (unit)
+          {
+            case 2:
+              gimp_image_set_unit (image, GIMP_UNIT_INCH);
+              break;
+            case 3:
+              gimp_image_set_unit (image, GIMP_UNIT_MM);
+              break;
+          }
+        }
+
+      orientation = gexiv2_metadata_get_orientation (metadata);
+
+      if (orientation > 0)
+        {
+          switch (orientation)
+          {
+            case 1:  /* standard orientation, do nothing */
+              break;
+
+            case 2:  /* flipped right-left               */
+              gimp_image_flip (image, context, GIMP_ORIENTATION_HORIZONTAL, NULL);
+              break;
+
+            case 3:  /* rotated 180                      */
+              gimp_image_rotate (image, context, GIMP_ROTATE_180, NULL);
+              break;
+
+            case 4:  /* flipped top-bottom               */
+              gimp_image_flip (image, context, GIMP_ORIENTATION_VERTICAL, NULL);
+              break;
+
+            case 5:  /* flipped diagonally around '\'    */
+              gimp_image_rotate (image, context, GIMP_ROTATE_90, NULL);
+              gimp_image_flip (image, context, GIMP_ORIENTATION_HORIZONTAL, NULL);
+              break;
+
+            case 6:  /* 90 CW                            */
+              gimp_image_rotate (image, context, GIMP_ROTATE_90, NULL);
+              break;
+
+            case 7:  /* flipped diagonally around '/'    */
+              gimp_image_rotate (image, context, GIMP_ROTATE_90, NULL);
+              gimp_image_flip (image, context, GIMP_ORIENTATION_VERTICAL, NULL);
+              break;
+
+            case 8:  /* 90 CCW                           */
+              gimp_image_rotate (image, context, GIMP_ROTATE_270, NULL);
+              break;
+
+            default: /* shouldn't happen                 */
+              break;
+          }
+
+          gexiv2_metadata_set_tag_string (metadata,  "Exif.Image.Orientation", "1");
+          gexiv2_metadata_set_tag_string (metadata,  "Xmp.tiff.Orientation", "1");
+
+        }
+      gexiv2_metadata_erase_exif_thumbnail (metadata);
+    }
+#endif
+}
diff --git a/app/file/file-save.c b/app/file/file-save.c
index 360f97a..a801b03 100644
--- a/app/file/file-save.c
+++ b/app/file/file-save.c
@@ -50,6 +50,7 @@
 #include "core/gimpcontext.h"
 #include "core/gimpdocumentlist.h"
 #include "core/gimpdrawable.h"
+#include "core/gimpviewable.h"
 #include "core/gimpimage.h"
 #include "core/gimpimagefile.h"
 #include "core/gimpparamspecs.h"
@@ -65,6 +66,30 @@
 
 #include "gimp-intl.h"
 
+#if defined (HAVE_LIBGEXIV2)
+#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <gexiv2/gexiv2.h>
+#include "core/gimpimage-metadata.h"
+#endif /* HAVE_LIBGEXIV2 */
+
+#define EXIF_THUMBNAIL_SIZE 256
+
+typedef struct
+{
+  gboolean save_exif;
+  gboolean save_xmp;
+  gboolean save_thumbnail;
+} MetaHandling;
+
+/* private functions */
+
+void       file_save_evaluate_metadata           (GimpImage          *image,
+                                                  gchar              *filename,
+                                                  gchar              *mime_type);
+
+void       file_save_load_meta_handling          (GimpImage          *image);
+
+static MetaHandling meta_handling;
 
 /*  public functions  */
 
@@ -221,6 +246,9 @@ file_save (Gimp                *gimp,
       if (GIMP_PROCEDURE (file_proc)->proc_type == GIMP_INTERNAL)
         gimp_imagefile_save_thumbnail (imagefile, file_proc->mime_type, image,
                                        NULL);
+
+      /* metadata handling */
+      file_save_evaluate_metadata (image, filename, file_proc->mime_type);
     }
   else if (status != GIMP_PDB_CANCEL)
     {
@@ -241,3 +269,249 @@ file_save (Gimp                *gimp,
 
   return status;
 }
+
+/**
+ * reads metadata from the new file
+ * saves metadata from the current image and writes them back to the new file
+ */
+void
+file_save_evaluate_metadata (GimpImage *image, gchar *filename, gchar *mime_type)
+{
+#if defined (HAVE_LIBGEXIV2)
+  GError             **error = NULL;
+  GError             **gerror = NULL;
+  GError             **serror = NULL;
+  GExiv2Metadata      *metadata = NULL;
+  GExiv2Metadata      *new_metadata = NULL;
+  gchar              **exif_data;
+  gchar              **iptc_data;
+  gchar              **xmp_data;
+  gint                 i;
+  gchar               *value;
+  const GimpParasite  *parasite;
+  const gchar         *comment;
+  gdouble              xres;
+  gdouble              yres;
+  gint                 unit;
+  gint                 image_width;
+  gint                 image_height;
+  GdkPixbuf           *thumb_pixbuf;
+  gchar               *thumb_buffer;
+  gsize                count;
+  gint                 thumbw;
+  gint                 thumbh;
+  GDateTime           *datetime;
+
+  file_save_load_meta_handling (image);
+
+  if (meta_handling.save_exif)  /* only if wanted */
+    {
+      /* getting metadata from image */
+      metadata = gimp_image_get_metadata (image);
+
+      /* reads metadata from saved file */
+      new_metadata = gimp_image_metadata_get_from_file (filename, gerror);
+
+      image_width = gimp_image_get_width (image);
+      image_height = gimp_image_get_height (image);
+
+      datetime = g_date_time_new_now_local ();
+
+      if (metadata && new_metadata) /* only done, if metadata are present. */
+        {
+          /* step #1: writing metadata to new files metadata */
+          exif_data = gexiv2_metadata_get_exif_tags (metadata);
+
+          i = 0;
+          while (exif_data[i] != NULL)
+            {
+              if (!gexiv2_metadata_has_tag (new_metadata, exif_data[i]) &&
+                  gimp_image_metadata_is_tag_supported (exif_data[i], mime_type))
+                {
+                  value = gexiv2_metadata_get_tag_string (metadata, exif_data[i]);
+                  gexiv2_metadata_set_tag_string (new_metadata, exif_data[i], value);
+                }
+              i++;
+            }
+
+          if (meta_handling.save_xmp)  /* only if wanted */
+            {
+              xmp_data = gexiv2_metadata_get_xmp_tags (metadata);
+
+              i = 0;
+              while (xmp_data[i] != NULL)
+                {
+                  if (!gexiv2_metadata_has_tag (new_metadata, xmp_data[i]) &&
+                      gimp_image_metadata_is_tag_supported (xmp_data[i], mime_type))
+                    {
+                      value = gexiv2_metadata_get_tag_string (metadata, xmp_data[i]);
+                      gexiv2_metadata_set_tag_string (new_metadata, xmp_data[i], value);
+                    }
+                  i++;
+                }
+            }
+          iptc_data = gexiv2_metadata_get_iptc_tags (metadata);
+
+          i = 0;
+          while (iptc_data[i] != NULL)
+            {
+              if (!gexiv2_metadata_has_tag (new_metadata, iptc_data[i]) &&
+                  gimp_image_metadata_is_tag_supported (iptc_data[i], mime_type))
+                {
+                  value = gexiv2_metadata_get_tag_string (metadata, iptc_data[i]);
+                  gexiv2_metadata_set_tag_string (new_metadata, iptc_data[i], value);
+                }
+              i++;
+            }
+
+          /* step #2: setting correct mime type, software and comment*/
+          gexiv2_metadata_set_tag_string (new_metadata,  "Xmp.dc.Format", mime_type);
+
+          gexiv2_metadata_set_tag_string (new_metadata,  "Exif.Image.Software", PACKAGE_STRING);
+
+          parasite = gimp_image_parasite_find (image, "gimp-comment");
+          if (parasite)
+            {
+              comment = (gchar *) gimp_parasite_data (parasite);
+              if (comment && parasite)
+                {
+                  gexiv2_metadata_set_tag_string (new_metadata,  "Exif.Photo.UserComment", comment);
+                }
+            }
+
+          /* step #3: setting correct resolution */
+          gimp_image_get_resolution (image, &xres, &yres);
+          switch (gimp_image_get_unit (image))
+          {
+            case GIMP_UNIT_INCH:
+              unit = 2;
+              break;
+            case GIMP_UNIT_MM:
+              unit = 3;
+              break;
+            default:
+              unit = 2;
+              break;
+          }
+
+          gimp_image_metadata_set_resolution (new_metadata, xres, yres, unit);
+
+          /* step #4: setting current dates, where necessary */
+          gexiv2_metadata_set_tag_string (new_metadata,  "Exif.Image.DateTime", g_strdup_printf ("%d:%02d:%02d %02d:%02d:%02d",
+                                                                                                 g_date_time_get_year (datetime),
+                                                                                                 g_date_time_get_month (datetime),
+                                                                                                 g_date_time_get_day_of_month (datetime),
+                                                                                                 g_date_time_get_hour (datetime),
+                                                                                                 g_date_time_get_minute (datetime),
+                                                                                                 g_date_time_get_second (datetime)));
+          gexiv2_metadata_set_tag_string (new_metadata,  "Iptc.Application2.DateCreated", g_strdup_printf ("%d-%d-%d",
+                                                                                                           g_date_time_get_year (datetime),
+                                                                                                           g_date_time_get_month (datetime),
+                                                                                                           g_date_time_get_day_of_month (datetime)));
+          gexiv2_metadata_set_tag_string (new_metadata,  "Iptc.Application2.TimeCreated", g_strdup_printf ("%02d:%02d:%02d-%02d:%02d",
+                                                                                                           g_date_time_get_hour (datetime),
+                                                                                                           g_date_time_get_minute (datetime),
+                                                                                                           g_date_time_get_second (datetime),
+                                                                                                           g_date_time_get_hour (datetime),
+                                                                                                           g_date_time_get_minute (datetime)));
+          g_date_time_unref ( datetime );
+
+          /* step #5: setting image size */
+          gexiv2_metadata_set_tag_string (new_metadata,  "Exif.Image.ImageWidth", g_strdup_printf ("%d", image_width));
+          gexiv2_metadata_set_tag_string (new_metadata,  "Exif.Image.ImageLength", g_strdup_printf ("%d", image_height));
+
+          /* step #6: settings for specific mime types */
+          if (!g_strcmp0 (mime_type, "image/jpeg"))     /* JPEG specific data */
+            {
+              if (meta_handling.save_thumbnail)  /* only if wanted */
+                {
+                  if(image_width > image_height)
+                    {
+                      thumbw = EXIF_THUMBNAIL_SIZE;
+                      thumbh = EXIF_THUMBNAIL_SIZE * image_height / image_width;
+                    }
+                  else
+                    {
+                      thumbh = EXIF_THUMBNAIL_SIZE;
+                      thumbw = EXIF_THUMBNAIL_SIZE * image_height / image_width;
+                    }
+
+                  thumb_pixbuf = gimp_viewable_get_new_pixbuf (GIMP_VIEWABLE (image), image->gimp->user_context, thumbw, thumbh);
+                  if (gdk_pixbuf_save_to_buffer (thumb_pixbuf, &thumb_buffer, &count, "jpeg",
+                                                 error,
+                                                 "quality", "90",
+                                                 NULL))
+                    {
+                      gexiv2_metadata_set_exif_thumbnail_from_buffer (new_metadata, (const guint8 *)thumb_buffer, (gint)count);
+                    }
+                }
+            }
+          else if (!g_strcmp0 (mime_type, "image/tiff"))       /* TIFF specific data */
+            {
+              gexiv2_metadata_set_tag_string (new_metadata,  "Xmp.tiff.ImageWidth", g_strdup_printf ("%d", image_width));
+              gexiv2_metadata_set_tag_string (new_metadata,  "Xmp.tiff.ImageLength", g_strdup_printf ("%d", image_height));
+              gexiv2_metadata_set_tag_string (new_metadata,  "Xmp.tiff.DateTime", g_strdup_printf ("%d:%02d:%02d %02d:%02d:%02d",
+                                                                                                   g_date_time_get_year (datetime),
+                                                                                                   g_date_time_get_month (datetime),
+                                                                                                   g_date_time_get_day_of_month (datetime),
+                                                                                                   g_date_time_get_hour (datetime),
+                                                                                                   g_date_time_get_minute (datetime),
+                                                                                                   g_date_time_get_second (datetime)));
+            }
+
+          /* step #7: saving metadata to file */
+          gimp_image_metadata_save_to_file (filename, new_metadata, serror);
+
+          g_strfreev (exif_data);
+          g_strfreev (xmp_data);
+          g_strfreev (iptc_data);
+        }
+    }
+
+#endif
+}
+
+void
+file_save_load_meta_handling (GimpImage *image)
+{
+  const GimpParasite *parasite;
+  gchar        *def_str;
+  gint          save_exif;
+  gint          save_xmp;
+  gint          save_thumbnail;
+  gint          num_fields;
+
+  meta_handling.save_exif      = TRUE;
+  meta_handling.save_thumbnail = FALSE;
+  meta_handling.save_xmp       = TRUE;
+
+  parasite = gimp_image_parasite_find (image, "exif-handling-data");
+
+  if (! parasite)
+    return;
+
+  def_str = g_strndup (gimp_parasite_data (parasite),
+                       gimp_parasite_data_size (parasite));
+
+  num_fields = sscanf (def_str, "%d %d %d",
+                       &save_exif,
+                       &save_thumbnail,
+                       &save_xmp);
+
+  g_free (def_str);
+
+  if (save_exif)
+    meta_handling.save_exif = TRUE;
+  else
+    meta_handling.save_exif = FALSE;
+
+  if (save_thumbnail)
+    meta_handling.save_thumbnail = TRUE;
+  else
+    meta_handling.save_thumbnail = FALSE;
+
+  if (save_xmp)
+    meta_handling.save_xmp = TRUE;
+  else
+    meta_handling.save_xmp = FALSE;
+}
diff --git a/app/pdb/Makefile.am b/app/pdb/Makefile.am
index fffe894..5f0d68a 100644
--- a/app/pdb/Makefile.am
+++ b/app/pdb/Makefile.am
@@ -65,6 +65,7 @@ libappinternal_procs_a_SOURCES = \
 	item-transform-cmds.c		\
 	layer-cmds.c			\
 	message-cmds.c			\
+	metadata-cmds.c			\
 	paint-tools-cmds.c		\
 	palette-cmds.c			\
 	palette-select-cmds.c		\
diff --git a/app/pdb/metadata-cmds.c b/app/pdb/metadata-cmds.c
new file mode 100644
index 0000000..e6bab0f
--- /dev/null
+++ b/app/pdb/metadata-cmds.c
@@ -0,0 +1,163 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <gexiv2/gexiv2.h>
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimp.h"
+#include "core/gimpimage-metadata.h"
+#include "core/gimpimage.h"
+#include "core/gimpparamspecs.h"
+
+#include "gimppdb.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+
+static GimpValueArray *
+image_metadata_get_invoker (GimpProcedure         *procedure,
+                            Gimp                  *gimp,
+                            GimpContext           *context,
+                            GimpProgress          *progress,
+                            const GimpValueArray  *args,
+                            GError               **error)
+{
+  gboolean success = TRUE;
+  GimpValueArray *return_vals;
+  GimpImage *image;
+  gchar *metadata_string = NULL;
+
+  image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+  if (success)
+    {
+      GExiv2Metadata *metadata;
+      metadata = gimp_image_get_metadata (image);
+      metadata_string = gimp_image_metadata_serialize (metadata);
+    }
+
+  return_vals = gimp_procedure_get_return_values (procedure, success,
+                                                  error ? *error : NULL);
+
+  if (success)
+    g_value_take_string (gimp_value_array_index (return_vals, 1), metadata_string);
+
+  return return_vals;
+}
+
+static GimpValueArray *
+image_metadata_set_invoker (GimpProcedure         *procedure,
+                            Gimp                  *gimp,
+                            GimpContext           *context,
+                            GimpProgress          *progress,
+                            const GimpValueArray  *args,
+                            GError               **error)
+{
+  gboolean success = TRUE;
+  GimpImage *image;
+  const gchar *metadata_string;
+
+  image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+  metadata_string = g_value_get_string (gimp_value_array_index (args, 1));
+
+  if (success)
+    {
+      GExiv2Metadata *metadata;
+      metadata = gimp_image_metadata_deserialize (metadata_string);
+      gimp_image_set_metadata (image, metadata);
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
+void
+register_metadata_procs (GimpPDB *pdb)
+{
+  GimpProcedure *procedure;
+
+  /*
+   * gimp-image-metadata-get
+   */
+  procedure = gimp_procedure_new (image_metadata_get_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-image-metadata-get");
+  gimp_procedure_set_static_strings (procedure,
+                                     "gimp-image-metadata-get",
+                                     "Returns images metadata.",
+                                     "Returns exif/iptc/xmp metadata from image.",
+                                     "Spencer Kimball & Peter Mattis",
+                                     "Spencer Kimball & Peter Mattis",
+                                     "1995-1996",
+                                     NULL);
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_image_id ("image",
+                                                         "image",
+                                                         "The image",
+                                                         pdb->gimp, FALSE,
+                                                         GIMP_PARAM_READWRITE));
+  gimp_procedure_add_return_value (procedure,
+                                   gimp_param_spec_string ("metadata-string",
+                                                           "metadata string",
+                                                           "The exif/ptc/xmp metadata as a string",
+                                                           FALSE, FALSE, FALSE,
+                                                           NULL,
+                                                           GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
+   * gimp-image-metadata-set
+   */
+  procedure = gimp_procedure_new (image_metadata_set_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-image-metadata-set");
+  gimp_procedure_set_static_strings (procedure,
+                                     "gimp-image-metadata-set",
+                                     "set images metadata.",
+                                     "Sets exif/iptc/xmp metadata to image.",
+                                     "Spencer Kimball & Peter Mattis",
+                                     "Spencer Kimball & Peter Mattis",
+                                     "1995-1996",
+                                     NULL);
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_image_id ("image",
+                                                         "image",
+                                                         "The image",
+                                                         pdb->gimp, FALSE,
+                                                         GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_string ("metadata-string",
+                                                       "metadata string",
+                                                       "The exif/ptc/xmp metadata as a string",
+                                                       FALSE, FALSE, FALSE,
+                                                       NULL,
+                                                       GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+}
diff --git a/app/ui/Makefile.am b/app/ui/Makefile.am
new file mode 100644
index 0000000..e600051
--- /dev/null
+++ b/app/ui/Makefile.am
@@ -0,0 +1,6 @@
+ui_datadir = $(gimpdatadir)/ui
+
+ui_data_DATA = \
+	metadata.ui
+
+EXTRA_DIST = $(ui_data_DATA)
diff --git a/app/ui/metadata.ui b/app/ui/metadata.ui
new file mode 100644
index 0000000..1a07d45
--- /dev/null
+++ b/app/ui/metadata.ui
@@ -0,0 +1,895 @@
+<?xml version="1.0"?>
+<interface>
+  <requires lib="gtk+" version="2.16"/>
+  <!-- interface-naming-policy project-wide -->
+  <object class="GtkListStore" id="xmpliststore">
+    <columns>
+      <!-- column-name c_xmp_tag -->
+      <column type="gchararray"/>
+      <!-- column-name c_xmp_value -->
+      <column type="gchararray"/>
+    </columns>
+  </object>
+  <object class="GtkListStore" id="exifliststore">
+    <columns>
+      <!-- column-name c_exif_tag -->
+      <column type="gchararray"/>
+      <!-- column-name c_exif_value -->
+      <column type="gchararray"/>
+    </columns>
+  </object>
+  <object class="GtkVBox" id="metadata_vbox">
+    <property name="visible">True</property>
+    <property name="orientation">vertical</property>
+    <child>
+      <object class="GtkNotebook" id="metadata_notebook">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="scrollable">True</property>
+        <property name="tab_hborder">4</property>
+        <property name="homogeneous">True</property>
+        <child>
+          <object class="GtkScrolledWindow" id="exif_scroll">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <child>
+              <object class="GtkViewport" id="exif_viewport">
+                <property name="visible">True</property>
+                <property name="resize_mode">queue</property>
+                <property name="shadow_type">none</property>
+                <child>
+                  <object class="GtkTreeView" id="exiftreeview">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="model">exifliststore</property>
+                    <property name="headers_clickable">False</property>
+                    <property name="search_column">0</property>
+                    <child>
+                      <object class="GtkTreeViewColumn" id="exif_tag_column">
+                        <property name="resizable">True</property>
+                        <property name="spacing">3</property>
+                        <property name="title">EXIF Tag</property>
+                        <child>
+                          <object class="GtkCellRendererText" id="exif_tag_cell_renderer"/>
+                          <attributes>
+                            <attribute name="text">0</attribute>
+                          </attributes>
+                        </child>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkTreeViewColumn" id="exif_value_column">
+                        <property name="resizable">True</property>
+                        <property name="spacing">3</property>
+                        <property name="title">Value</property>
+                        <child>
+                          <object class="GtkCellRendererText" id="exif_value_cell_renderer"/>
+                          <attributes>
+                            <attribute name="text">1</attribute>
+                          </attributes>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child type="tab">
+          <object class="GtkLabel" id="exif">
+            <property name="visible">True</property>
+            <property name="label" translatable="yes">EXIF</property>
+          </object>
+          <packing>
+            <property name="tab_expand">True</property>
+            <property name="tab_fill">False</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkScrolledWindow" id="xmp_scroll">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <child>
+              <object class="GtkViewport" id="xmp_viewport">
+                <property name="visible">True</property>
+                <property name="resize_mode">queue</property>
+                <property name="shadow_type">none</property>
+                <child>
+                  <object class="GtkTreeView" id="xmptreeview">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="model">xmpliststore</property>
+                    <property name="headers_clickable">False</property>
+                    <property name="search_column">0</property>
+                    <child>
+                      <object class="GtkTreeViewColumn" id="xmp_tag_column">
+                        <property name="resizable">True</property>
+                        <property name="spacing">3</property>
+                        <property name="title">XMP Tag</property>
+                        <child>
+                          <object class="GtkCellRendererText" id="xmp_tag_cell_renderer"/>
+                          <attributes>
+                            <attribute name="text">0</attribute>
+                          </attributes>
+                        </child>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkTreeViewColumn" id="xmp_value_column">
+                        <property name="resizable">True</property>
+                        <property name="spacing">3</property>
+                        <property name="title">Value</property>
+                        <child>
+                          <object class="GtkCellRendererText" id="xmp_value_cell_renderer"/>
+                          <attributes>
+                            <attribute name="text">1</attribute>
+                          </attributes>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child type="tab">
+          <object class="GtkLabel" id="xmp">
+            <property name="visible">True</property>
+            <property name="label" translatable="yes">XMP</property>
+          </object>
+          <packing>
+            <property name="position">1</property>
+            <property name="tab_fill">False</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkVBox" id="iptc_vbox">
+            <property name="visible">True</property>
+            <property name="orientation">vertical</property>
+            <property name="spacing">2</property>
+            <child>
+              <object class="GtkNotebook" id="iptc_notebook">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <child>
+                  <object class="GtkScrolledWindow" id="iptc_desc_scroll">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="hscrollbar_policy">automatic</property>
+                    <property name="vscrollbar_policy">automatic</property>
+                    <child>
+                      <object class="GtkViewport" id="iptc_desc_viewport">
+                        <property name="visible">True</property>
+                        <property name="resize_mode">queue</property>
+                        <property name="shadow_type">none</property>
+                        <child>
+                          <object class="GtkTable" id="desctable">
+                            <property name="visible">True</property>
+                            <property name="n_rows">8</property>
+                            <property name="n_columns">2</property>
+                            <property name="column_spacing">3</property>
+                            <property name="row_spacing">3</property>
+                            <child>
+                              <object class="GtkLabel" id="l_title">
+                                <property name="visible">True</property>
+                                <property name="xalign">0</property>
+                                <property name="xpad">3</property>
+                                <property name="ypad">3</property>
+                                <property name="label" translatable="yes">Title</property>
+                                <property name="single_line_mode">True</property>
+                              </object>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="l_author">
+                                <property name="visible">True</property>
+                                <property name="xalign">0</property>
+                                <property name="xpad">3</property>
+                                <property name="ypad">3</property>
+                                <property name="label" translatable="yes">Author</property>
+                              </object>
+                              <packing>
+                                <property name="top_attach">1</property>
+                                <property name="bottom_attach">2</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="l_authortitle">
+                                <property name="visible">True</property>
+                                <property name="xalign">0</property>
+                                <property name="xpad">3</property>
+                                <property name="ypad">3</property>
+                                <property name="label" translatable="yes">Authortitle</property>
+                              </object>
+                              <packing>
+                                <property name="top_attach">2</property>
+                                <property name="bottom_attach">3</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="l_copyright">
+                                <property name="visible">True</property>
+                                <property name="xalign">0</property>
+                                <property name="xpad">3</property>
+                                <property name="ypad">3</property>
+                                <property name="label" translatable="yes">Copyright</property>
+                              </object>
+                              <packing>
+                                <property name="top_attach">3</property>
+                                <property name="bottom_attach">4</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="l_caption">
+                                <property name="visible">True</property>
+                                <property name="xalign">0</property>
+                                <property name="xpad">3</property>
+                                <property name="ypad">3</property>
+                                <property name="label" translatable="yes">Caption</property>
+                              </object>
+                              <packing>
+                                <property name="top_attach">4</property>
+                                <property name="bottom_attach">5</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="l_captionwriter">
+                                <property name="visible">True</property>
+                                <property name="xalign">0</property>
+                                <property name="xpad">3</property>
+                                <property name="ypad">3</property>
+                                <property name="label" translatable="yes">Captionwriter</property>
+                              </object>
+                              <packing>
+                                <property name="top_attach">5</property>
+                                <property name="bottom_attach">6</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="l_headline">
+                                <property name="visible">True</property>
+                                <property name="xalign">0</property>
+                                <property name="xpad">3</property>
+                                <property name="ypad">3</property>
+                                <property name="label" translatable="yes">Headline</property>
+                              </object>
+                              <packing>
+                                <property name="top_attach">6</property>
+                                <property name="bottom_attach">7</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="l_specialinstruct">
+                                <property name="visible">True</property>
+                                <property name="xalign">0</property>
+                                <property name="xpad">3</property>
+                                <property name="ypad">3</property>
+                                <property name="label" translatable="yes">Special Instructions</property>
+                              </object>
+                              <packing>
+                                <property name="top_attach">7</property>
+                                <property name="bottom_attach">8</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkEntry" id="Iptc.Application2.ObjectName">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="invisible_char">&#x25CF;</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="right_attach">2</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkEntry" id="Iptc.Application2.Byline">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="invisible_char">&#x25CF;</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="right_attach">2</property>
+                                <property name="top_attach">1</property>
+                                <property name="bottom_attach">2</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkEntry" id="Iptc.Application2.BylineTitle">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="invisible_char">&#x25CF;</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="right_attach">2</property>
+                                <property name="top_attach">2</property>
+                                <property name="bottom_attach">3</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkEntry" id="Iptc.Application2.Copyright">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="invisible_char">&#x25CF;</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="right_attach">2</property>
+                                <property name="top_attach">3</property>
+                                <property name="bottom_attach">4</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkEntry" id="Iptc.Application2.Writer">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="invisible_char">&#x25CF;</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="right_attach">2</property>
+                                <property name="top_attach">5</property>
+                                <property name="bottom_attach">6</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkScrolledWindow" id="caption_scroll">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <child>
+                                  <object class="GtkViewport" id="caption_viewport">
+                                    <property name="visible">True</property>
+                                    <property name="resize_mode">queue</property>
+                                    <child>
+                                      <object class="GtkTextView" id="Iptc.Application2.Caption">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                      </object>
+                                    </child>
+                                  </object>
+                                </child>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="right_attach">2</property>
+                                <property name="top_attach">4</property>
+                                <property name="bottom_attach">5</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkScrolledWindow" id="headline_scroll">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <child>
+                                  <object class="GtkViewport" id="headline_viewport">
+                                    <property name="visible">True</property>
+                                    <property name="resize_mode">queue</property>
+                                    <child>
+                                      <object class="GtkTextView" id="Iptc.Application2.Headline">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                      </object>
+                                    </child>
+                                  </object>
+                                </child>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="right_attach">2</property>
+                                <property name="top_attach">6</property>
+                                <property name="bottom_attach">7</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkScrolledWindow" id="instruct_scroll">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <child>
+                                  <object class="GtkViewport" id="instruct_viewport">
+                                    <property name="visible">True</property>
+                                    <property name="resize_mode">queue</property>
+                                    <child>
+                                      <object class="GtkTextView" id="Iptc.Application2.SpecialInstructions">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                      </object>
+                                    </child>
+                                  </object>
+                                </child>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="right_attach">2</property>
+                                <property name="top_attach">7</property>
+                                <property name="bottom_attach">8</property>
+                              </packing>
+                            </child>
+                          </object>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+                <child type="tab">
+                  <object class="GtkLabel" id="iptcdesc">
+                    <property name="visible">True</property>
+                    <property name="label" translatable="yes">Description</property>
+                  </object>
+                  <packing>
+                    <property name="tab_fill">False</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkScrolledWindow" id="iptc_category_scroll1">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="hscrollbar_policy">automatic</property>
+                    <property name="vscrollbar_policy">automatic</property>
+                    <child>
+                      <object class="GtkViewport" id="iptc_category_viewport1">
+                        <property name="visible">True</property>
+                        <property name="resize_mode">queue</property>
+                        <property name="shadow_type">none</property>
+                        <child>
+                          <object class="GtkTable" id="table3">
+                            <property name="visible">True</property>
+                            <property name="n_rows">4</property>
+                            <property name="n_columns">2</property>
+                            <property name="column_spacing">3</property>
+                            <property name="row_spacing">3</property>
+                            <child>
+                              <object class="GtkLabel" id="l_keywords1">
+                                <property name="visible">True</property>
+                                <property name="xalign">0</property>
+                                <property name="xpad">3</property>
+                                <property name="ypad">3</property>
+                                <property name="label" translatable="yes">Keywords</property>
+                              </object>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="l_category1">
+                                <property name="visible">True</property>
+                                <property name="xalign">0</property>
+                                <property name="xpad">3</property>
+                                <property name="ypad">3</property>
+                                <property name="label" translatable="yes">Category</property>
+                              </object>
+                              <packing>
+                                <property name="top_attach">1</property>
+                                <property name="bottom_attach">2</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="l_suppcat1">
+                                <property name="visible">True</property>
+                                <property name="xalign">0</property>
+                                <property name="xpad">3</property>
+                                <property name="ypad">3</property>
+                                <property name="label" translatable="yes">Supplemental
+Category</property>
+                              </object>
+                              <packing>
+                                <property name="top_attach">2</property>
+                                <property name="bottom_attach">3</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="l_urgency1">
+                                <property name="visible">True</property>
+                                <property name="xalign">0</property>
+                                <property name="xpad">3</property>
+                                <property name="ypad">3</property>
+                                <property name="label" translatable="yes">Urgency</property>
+                              </object>
+                              <packing>
+                                <property name="top_attach">3</property>
+                                <property name="bottom_attach">4</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkScrolledWindow" id="scrolledwindow10">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <child>
+                                  <object class="GtkViewport" id="viewport10">
+                                    <property name="visible">True</property>
+                                    <property name="resize_mode">queue</property>
+                                    <child>
+                                      <object class="GtkTextView" id="Iptc.Application2.Keywords">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                      </object>
+                                    </child>
+                                  </object>
+                                </child>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="right_attach">2</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkScrolledWindow" id="scrolledwindow12">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <child>
+                                  <object class="GtkViewport" id="viewport12">
+                                    <property name="visible">True</property>
+                                    <property name="resize_mode">queue</property>
+                                    <child>
+                                      <object class="GtkTextView" id="Iptc.Application2.SuppCategory">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                      </object>
+                                    </child>
+                                  </object>
+                                </child>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="right_attach">2</property>
+                                <property name="top_attach">2</property>
+                                <property name="bottom_attach">3</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkEntry" id="Iptc.Application2.Urgency">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="invisible_char">&#x25CF;</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="right_attach">2</property>
+                                <property name="top_attach">3</property>
+                                <property name="bottom_attach">4</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkEntry" id="Iptc.Application2.Category">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="invisible_char">&#x25CF;</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="right_attach">2</property>
+                                <property name="top_attach">1</property>
+                                <property name="bottom_attach">2</property>
+                              </packing>
+                            </child>
+                          </object>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+                <child type="tab">
+                  <object class="GtkLabel" id="iptckeys">
+                    <property name="visible">True</property>
+                    <property name="label" translatable="yes">Keywords/Categories</property>
+                  </object>
+                  <packing>
+                    <property name="position">1</property>
+                    <property name="tab_fill">False</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkScrolledWindow" id="iptc_credit_scroll">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="hscrollbar_policy">automatic</property>
+                    <property name="vscrollbar_policy">automatic</property>
+                    <child>
+                      <object class="GtkViewport" id="iptc_credit_viewport">
+                        <property name="visible">True</property>
+                        <property name="resize_mode">queue</property>
+                        <property name="shadow_type">none</property>
+                        <child>
+                          <object class="GtkTable" id="table4">
+                            <property name="visible">True</property>
+                            <property name="n_rows">9</property>
+                            <property name="n_columns">2</property>
+                            <property name="column_spacing">3</property>
+                            <property name="row_spacing">3</property>
+                            <child>
+                              <object class="GtkHSeparator" id="hseparator3">
+                                <property name="visible">True</property>
+                              </object>
+                              <packing>
+                                <property name="top_attach">2</property>
+                                <property name="bottom_attach">3</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkHSeparator" id="hseparator4">
+                                <property name="visible">True</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="right_attach">2</property>
+                                <property name="top_attach">2</property>
+                                <property name="bottom_attach">3</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="l_credit">
+                                <property name="visible">True</property>
+                                <property name="xalign">0</property>
+                                <property name="xpad">3</property>
+                                <property name="ypad">3</property>
+                                <property name="label" translatable="yes">Credit</property>
+                              </object>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="l_source">
+                                <property name="visible">True</property>
+                                <property name="xalign">0</property>
+                                <property name="xpad">3</property>
+                                <property name="ypad">3</property>
+                                <property name="label" translatable="yes">Source</property>
+                              </object>
+                              <packing>
+                                <property name="top_attach">1</property>
+                                <property name="bottom_attach">2</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkEntry" id="Iptc.Application2.Credit">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="invisible_char">&#x25CF;</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="right_attach">2</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkEntry" id="Iptc.Application2.Source">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="invisible_char">&#x25CF;</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="right_attach">2</property>
+                                <property name="top_attach">1</property>
+                                <property name="bottom_attach">2</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="l_transmission">
+                                <property name="visible">True</property>
+                                <property name="xalign">0</property>
+                                <property name="xpad">3</property>
+                                <property name="ypad">3</property>
+                                <property name="label" translatable="yes">Transmission
+reference</property>
+                              </object>
+                              <packing>
+                                <property name="top_attach">8</property>
+                                <property name="bottom_attach">9</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkEntry" id="Iptc.Application2.TransmissionReference">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="invisible_char">&#x25CF;</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="right_attach">2</property>
+                                <property name="top_attach">8</property>
+                                <property name="bottom_attach">9</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="l_city">
+                                <property name="visible">True</property>
+                                <property name="xalign">0</property>
+                                <property name="xpad">3</property>
+                                <property name="ypad">3</property>
+                                <property name="label" translatable="yes">City</property>
+                              </object>
+                              <packing>
+                                <property name="top_attach">3</property>
+                                <property name="bottom_attach">4</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkEntry" id="Iptc.Application2.City">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="invisible_char">&#x25CF;</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="right_attach">2</property>
+                                <property name="top_attach">3</property>
+                                <property name="bottom_attach">4</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="l_sublocation">
+                                <property name="visible">True</property>
+                                <property name="xalign">0</property>
+                                <property name="xpad">3</property>
+                                <property name="ypad">3</property>
+                                <property name="label" translatable="yes">Sublocation</property>
+                              </object>
+                              <packing>
+                                <property name="top_attach">4</property>
+                                <property name="bottom_attach">5</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkEntry" id="Iptc.Application2.SubLocation">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="invisible_char">&#x25CF;</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="right_attach">2</property>
+                                <property name="top_attach">4</property>
+                                <property name="bottom_attach">5</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="l_province">
+                                <property name="visible">True</property>
+                                <property name="xalign">0</property>
+                                <property name="xpad">3</property>
+                                <property name="ypad">3</property>
+                                <property name="label" translatable="yes">Province/State</property>
+                              </object>
+                              <packing>
+                                <property name="top_attach">5</property>
+                                <property name="bottom_attach">6</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkEntry" id="Iptc.Application2.ProvinceState">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="invisible_char">&#x25CF;</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="right_attach">2</property>
+                                <property name="top_attach">5</property>
+                                <property name="bottom_attach">6</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="l_country">
+                                <property name="visible">True</property>
+                                <property name="xalign">0</property>
+                                <property name="label" translatable="yes">Country</property>
+                              </object>
+                              <packing>
+                                <property name="top_attach">6</property>
+                                <property name="bottom_attach">7</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkEntry" id="Iptc.Application2.CountryName">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="invisible_char">&#x25CF;</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="right_attach">2</property>
+                                <property name="top_attach">6</property>
+                                <property name="bottom_attach">7</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkHSeparator" id="hseparator1">
+                                <property name="visible">True</property>
+                              </object>
+                              <packing>
+                                <property name="top_attach">7</property>
+                                <property name="bottom_attach">8</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkHSeparator" id="hseparator2">
+                                <property name="visible">True</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="right_attach">2</property>
+                                <property name="top_attach">7</property>
+                                <property name="bottom_attach">8</property>
+                              </packing>
+                            </child>
+                          </object>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="position">2</property>
+                  </packing>
+                </child>
+                <child type="tab">
+                  <object class="GtkLabel" id="iptccredits">
+                    <property name="visible">True</property>
+                    <property name="label" translatable="yes">Credits/Origin</property>
+                  </object>
+                  <packing>
+                    <property name="position">2</property>
+                    <property name="tab_fill">False</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkHBox" id="hbox4">
+                <property name="visible">True</property>
+                <property name="spacing">2</property>
+                <child>
+                  <object class="GtkButton" id="iptc_write_button">
+                    <property name="label" translatable="yes">write</property>
+                    <property name="width_request">70</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="position">2</property>
+          </packing>
+        </child>
+        <child type="tab">
+          <object class="GtkLabel" id="iptc">
+            <property name="visible">True</property>
+            <property name="label" translatable="yes">IPTC</property>
+          </object>
+          <packing>
+            <property name="position">2</property>
+            <property name="tab_fill">False</property>
+          </packing>
+        </child>
+      </object>
+      <packing>
+        <property name="position">0</property>
+      </packing>
+    </child>
+  </object>
+</interface>
diff --git a/app/widgets/gimphelp-ids.h b/app/widgets/gimphelp-ids.h
index 72097fb..9becc42 100644
--- a/app/widgets/gimphelp-ids.h
+++ b/app/widgets/gimphelp-ids.h
@@ -40,6 +40,7 @@
 #define GIMP_HELP_FILE_SAVE_AS_TEMPLATE           "gimp-file-save-as-template"
 #define GIMP_HELP_FILE_REVERT                     "gimp-file-revert"
 #define GIMP_HELP_FILE_CLOSE                      "gimp-file-close"
+#define GIMP_HELP_FILE_SHOW_METADATA              "gimp-file-show-metadata"
 #define GIMP_HELP_FILE_CLOSE_ALL                  "gimp-file-close-all"
 #define GIMP_HELP_FILE_CREATE_TEMPLATE            "gimp-file-save-as-template" /* Update string along with gimp-help-2 */
 #define GIMP_HELP_FILE_QUIT                       "gimp-file-quit"
@@ -513,6 +514,7 @@
 #define GIMP_HELP_DISPLAY_FILTER_DIALOG           "gimp-display-filter-dialog"
 #define GIMP_HELP_HISTOGRAM_DIALOG                "gimp-histogram-dialog"
 #define GIMP_HELP_INFO_DIALOG                     "gimp-info-dialog"
+#define GIMP_HELP_METADATA_DIALOG                 "gimp-metadata-dialog"
 #define GIMP_HELP_MODULE_DIALOG                   "gimp-module-dialog"
 #define GIMP_HELP_NAVIGATION_DIALOG               "gimp-navigation-dialog"
 #define GIMP_HELP_TEXT_EDITOR_DIALOG              "gimp-text-editor-dialog"
diff --git a/configure.ac b/configure.ac
index cf329d8..c268899 100644
--- a/configure.ac
+++ b/configure.ac
@@ -60,6 +60,7 @@ m4_define([poppler_required_version], [0.12.4])
 m4_define([libcurl_required_version], [7.15.1])
 m4_define([libgudev_required_version], [167])
 m4_define([exif_required_version], [0.6.15])
+m4_define([gexiv2_required_version], [0.6.1])
 m4_define([lcms_required_version], [2.2])
 m4_define([libpng_required_version], [1.2.37])
 m4_define([liblzma_required_version], [5.0.0])
@@ -1349,6 +1350,28 @@ AC_SUBST(EXIF_LIBS)
 AM_CONDITIONAL(HAVE_LIBEXIF, test "x$have_libexif" = xyes)
 
 
+############################################################
+# libgexiv2: Library to allow gexiv2 handling, and
+# saved to, jpeg files. Currently, this permits exif data to
+# avoid destruction, but no data modification is performed.
+############################################################
+
+AC_ARG_WITH(libgexiv2,  [  --without-libgexiv2       build without GEXIV2 support])
+
+have_libgexiv2=no
+if test "x$with_libgexiv2" != xno && test -z "$GEXIV2_LIBS"; then
+  have_libgexiv2=yes
+  PKG_CHECK_MODULES(GEXIV2, gexiv2 >= gexiv2_required_version,
+    AC_DEFINE(HAVE_LIBGEXIV2, 1, [Define to 1 if libgexiv2 is available]),
+    AC_MSG_ERROR(libgexiv2 not found or too old))
+fi
+
+AC_SUBST(GEXIV2_CFLAGS)
+AC_SUBST(GEXIV2_LIBS)
+
+AM_CONDITIONAL(HAVE_LIBGEXIV2, test "x$have_libgexiv2" = xyes)
+
+
 #################
 # Check for libaa
 #################
@@ -2215,6 +2238,7 @@ app/tools/Makefile
 app/vectors/Makefile
 app/widgets/Makefile
 app/xcf/Makefile
+app/ui/Makefile
 app/tests/Makefile
 app/tests/files/Makefile
 app/tests/gimpdir-empty/Makefile
@@ -2404,6 +2428,7 @@ Optional Plug-Ins:
   WMF:                 $have_libwmf
   X11 Mouse Cursor:    $have_xmc
   XPM:                 $have_libxpm
+  GEXIV2:              $have_libgexiv2
 
 Plug-In Features:
   EXIF support:        $have_libexif
diff --git a/libgimp/Makefile.am b/libgimp/Makefile.am
index 775ed14..494412f 100644
--- a/libgimp/Makefile.am
+++ b/libgimp/Makefile.am
@@ -70,6 +70,11 @@ AM_CPPFLAGS = \
 	$(GEGL_CFLAGS)			\
 	-I$(includedir)			\
 	$(xobjective_c)
+  
+if HAVE_LIBGEXIV2
+AM_CPPFLAGS += \
+  $(GEXIV2_CFLAGS)
+endif
 
 lib_LTLIBRARIES = libgimp-@GIMP_API_VERSION@.la libgimpui-@GIMP_API_VERSION@.la
 
@@ -105,6 +110,7 @@ PDB_WRAPPERS_C = \
 	gimpitemtransform_pdb.c		\
 	gimplayer_pdb.c			\
 	gimpmessage_pdb.c		\
+	gimpmetadata_pdb.c		\
 	gimppainttools_pdb.c		\
 	gimppalette_pdb.c		\
 	gimppalettes_pdb.c		\
@@ -158,6 +164,7 @@ PDB_WRAPPERS_H = \
 	gimpitemtransform_pdb.h		\
 	gimplayer_pdb.h			\
 	gimpmessage_pdb.h		\
+	gimpmetadata_pdb.h		\
 	gimppainttools_pdb.h		\
 	gimppalette_pdb.h		\
 	gimppalettes_pdb.h		\
@@ -243,6 +250,12 @@ libgimp_sources = \
 	stdplugins-intl.h	\
 	libgimp-intl.h
 
+if HAVE_LIBGEXIV2
+libgimp_sources += \
+	gimpmetadata.c		\
+	gimpmetadata.h
+endif
+
 libgimp_built_sources = \
 	gimpenums.c
 
@@ -365,6 +378,11 @@ gimpinclude_HEADERS = \
 	gimpselectbutton.h		\
 	gimpzoompreview.h
 
+if HAVE_LIBGEXIV2
+gimpinclude_HEADERS += \
+	gimpmetadata.h
+endif
+
 libgimp_@GIMP_API_VERSION@_la_LDFLAGS = \
 	-version-info $(LT_VERSION_INFO)	\
 	$(no_undefined)				\
@@ -380,6 +398,11 @@ libgimp_@GIMP_API_VERSION@_la_LIBADD = \
 	$(GDK_PIXBUF_LIBS)	\
 	$(RT_LIBS)
 
+if HAVE_LIBGEXIV2
+libgimp_@GIMP_API_VERSION@_la_LIBADD += \
+  $(GEXIV2_LIBS)
+endif
+
 libgimp_@GIMP_API_VERSION@_la_DEPENDENCIES = \
 	$(gimp_def)		\
 	$(libgimpconfig)	\
diff --git a/libgimp/gimp.def b/libgimp/gimp.def
index fcf3fa8..e0fcdaf 100644
--- a/libgimp/gimp.def
+++ b/libgimp/gimp.def
@@ -445,6 +445,8 @@ EXPORTS
 	gimp_image_lower_vectors_to_bottom
 	gimp_image_merge_down
 	gimp_image_merge_visible_layers
+	gimp_image_metadata_get_metadata
+	gimp_image_metadata_set_metadata
 	gimp_image_new
 	gimp_image_new_with_precision
 	gimp_image_parasite_attach
diff --git a/libgimp/gimp.h b/libgimp/gimp.h
index 5a05e4e..ef11981 100644
--- a/libgimp/gimp.h
+++ b/libgimp/gimp.h
@@ -45,6 +45,7 @@
 #include <libgimp/gimpgradientselect.h>
 #include <libgimp/gimpimage.h>
 #include <libgimp/gimplayer.h>
+#include <libgimp/gimpmetadata.h>
 #include <libgimp/gimppalette.h>
 #include <libgimp/gimppalettes.h>
 #include <libgimp/gimppaletteselect.h>
diff --git a/libgimp/gimp_pdb_headers.h b/libgimp/gimp_pdb_headers.h
index 195c729..de4a39b 100644
--- a/libgimp/gimp_pdb_headers.h
+++ b/libgimp/gimp_pdb_headers.h
@@ -58,6 +58,7 @@
 #include <libgimp/gimpitemtransform_pdb.h>
 #include <libgimp/gimplayer_pdb.h>
 #include <libgimp/gimpmessage_pdb.h>
+#include <libgimp/gimpmetadata_pdb.h>
 #include <libgimp/gimppainttools_pdb.h>
 #include <libgimp/gimppalette_pdb.h>
 #include <libgimp/gimppalettes_pdb.h>
diff --git a/libgimp/gimpmetadata.c b/libgimp/gimpmetadata.c
new file mode 100644
index 0000000..192b8d5
--- /dev/null
+++ b/libgimp/gimpmetadata.c
@@ -0,0 +1,223 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpmetadata.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#include <string.h>
+#include <glib/gprintf.h>
+
+#include "gimp.h"
+#include "libgimpbase/gimpbase.h"
+#include "gimpmetadata.h"
+
+/* private prototypes */
+gint       gimp_image_metadata_length           (gchar *testline, gchar *delim);
+
+/* public functions */
+
+/**
+ * usable from plug-ins
+ * gets metadata from serialized metadata from image
+ */
+GExiv2Metadata *
+gimp_image_metadata_get_metadata (gint32 image_ID)
+{
+  GError          **error = NULL;
+  GExiv2Metadata   *metadata;
+  GString          *buffer;
+  gchar            *metadata_string = NULL;
+  gchar           **meta_info = NULL;
+  gchar           **tag_info = NULL;
+  gchar            *value;
+  gint              i;
+  gint              j;
+  const guint8     *wilber;
+  guint             size;
+  gint              num;
+
+  metadata_string = gimp_image_metadata_get (image_ID);
+
+  if ( gexiv2_initialize ())
+    {
+      metadata = gexiv2_metadata_new ();
+
+      wilber = gimp_wilber_get_data (&size);
+
+      if (! gexiv2_metadata_open_buf (metadata, wilber, size, error))
+        {
+#ifdef GIMP_CONFIG_DEBUG
+          g_printerr ( "Error occured while loading metadata!\n" );
+          g_printerr ( "Message: %s\n", error->message );
+#endif
+          return NULL;
+        }
+    }
+
+  if (metadata && metadata_string)
+    {
+
+      meta_info = g_strsplit (metadata_string, TAG_LINE_DELIMITER, -1);
+
+      i=0;
+
+      while (meta_info[i] != NULL)
+        {
+          num = gimp_image_metadata_length (meta_info[i], TAG_TAG_DELIMITER);
+          tag_info = g_strsplit (meta_info[i], TAG_TAG_DELIMITER, -1);
+          if (num > 0)
+            {
+              if (num > 1)
+                {
+                  buffer = g_string_new (NULL);
+                  for (j = 1; j < (num + 1); j++)
+                    {
+                      g_string_append_printf (buffer, "%s%s", tag_info[j], TAG_TAG_DELIMITER); /* recreates value */
+                    }
+                  value = g_strndup (buffer->str, buffer->len - 1);  /* to avoid the trailing '#' */
+                  g_string_free (buffer, TRUE);
+                }
+              else
+                {
+                  value = tag_info[1];
+                }
+
+              gexiv2_metadata_set_tag_string (metadata, tag_info[0], value);  /* setting value to metadata */
+            }
+          i++;
+        }
+    }
+
+  if (meta_info)
+    g_strfreev (meta_info);
+
+  if (tag_info)
+    g_strfreev (tag_info);
+
+  return metadata;
+}
+
+/**
+ * usable from plug-ins
+ * sets image metadata from serialized metadata
+ */
+void
+gimp_image_metadata_set_metadata (gint32 image_ID,
+                                  GExiv2Metadata *metadata)
+{
+  gchar              **exif_data = NULL;
+  gchar              **iptc_data = NULL;
+  gchar              **xmp_data = NULL;
+  gchar               *value;
+  gint                 i;
+  gint                 n;
+  GString             *metadata_buffer;
+  const gchar         *metadata_string = NULL;
+
+  if (metadata)
+    {
+      metadata_buffer = g_string_new (NULL);
+
+      exif_data = gexiv2_metadata_get_exif_tags (metadata);
+
+      i = 0;
+      while (exif_data[i] != NULL)
+        {
+          value = gexiv2_metadata_get_tag_string (metadata, exif_data[i]);
+          g_string_append_printf (metadata_buffer, "%s%s%s%s", exif_data[i],
+                                  TAG_TAG_DELIMITER,
+                                  value,
+                                  TAG_LINE_DELIMITER);
+          n++;
+          i++;
+        }
+
+      if(exif_data)
+        g_strfreev (exif_data);
+
+      xmp_data = gexiv2_metadata_get_xmp_tags (metadata);
+
+      i = 0;
+      while (xmp_data[i] != NULL)
+        {
+          value = gexiv2_metadata_get_tag_string (metadata, xmp_data[i]);
+          g_string_append_printf (metadata_buffer, "%s%s%s%s", xmp_data[i],
+                                  TAG_TAG_DELIMITER,
+                                  value,
+                                  TAG_LINE_DELIMITER);
+
+          n++;
+          i++;
+        }
+
+      if(xmp_data)
+        g_strfreev (xmp_data);
+
+      iptc_data = gexiv2_metadata_get_iptc_tags (metadata);
+
+      i = 0;
+      while (iptc_data[i] != NULL)
+        {
+          value = gexiv2_metadata_get_tag_string (metadata, iptc_data[i]);
+          g_string_append_printf (metadata_buffer, "%s%s%s%s", iptc_data[i],
+                                  TAG_TAG_DELIMITER,
+                                  value,
+                                  TAG_LINE_DELIMITER);
+
+          n++;
+          i++;
+        }
+
+      if(iptc_data)
+        g_strfreev (iptc_data);
+
+      if (metadata_buffer->len > 1)
+        metadata_string = g_strndup (metadata_buffer->str, metadata_buffer->len - 1);
+      else
+        metadata_string = g_strdup (metadata_buffer->str);
+
+      g_string_free (metadata_buffer, TRUE);
+
+      gimp_image_metadata_set (image_ID, metadata_string);
+    }
+}
+
+
+/* private functions */
+
+gint
+gimp_image_metadata_length (gchar *testline, gchar *delim)
+{
+  gchar     *delim_test;
+  gint       i;
+  gint       sum;
+
+  delim_test = g_strdup (testline);
+
+  sum =0;
+
+  for (i=0; i < strlen (delim_test); i++)
+    {
+      if (delim_test[i] == delim[0])
+        sum++;
+    }
+
+  g_free (delim_test);
+  return sum;
+}
diff --git a/libgimp/gimpmetadata.h b/libgimp/gimpmetadata.h
new file mode 100644
index 0000000..97bcee3
--- /dev/null
+++ b/libgimp/gimpmetadata.h
@@ -0,0 +1,51 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpmetadata.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_METADATA_H__
+#define __GIMP_METADATA_H__
+
+#include <gexiv2/gexiv2.h>
+
+G_BEGIN_DECLS
+
+#define TAG_LINE_DELIMITER "\v"
+#define TAG_TAG_DELIMITER  "#"
+
+typedef struct _GimpImageMetadata GimpImageMetadata;
+
+struct _GimpImageMetadata
+{
+  gchar *tag;
+  gchar *value;
+};
+
+/* For information look into the C source or the html documentation */
+GExiv2Metadata *gimp_image_metadata_get_metadata (gint32          image_ID);
+
+void            gimp_image_metadata_set_metadata (gint32          image_ID,
+                                                  GExiv2Metadata *metadata);
+
+G_END_DECLS
+
+#endif /* __GIMP_METADATA_H__ */
diff --git a/libgimp/gimpmetadata_pdb.c b/libgimp/gimpmetadata_pdb.c
new file mode 100644
index 0000000..9bb974a
--- /dev/null
+++ b/libgimp/gimpmetadata_pdb.c
@@ -0,0 +1,97 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpmetadata_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimpimagemetadata
+ * @title: gimpimagemetadata
+ * @short_description: Metadata procedures
+ *
+ * Metadata procedures.
+ **/
+
+
+/**
+ * gimp_image_metadata_get:
+ * @image_ID: The image.
+ *
+ * Returns images metadata.
+ *
+ * Returns exif/iptc/xmp metadata from image.
+ *
+ * Returns: The exif/ptc/xmp metadata as a string.
+ **/
+gchar *
+gimp_image_metadata_get (gint32 image_ID)
+{
+  GimpParam *return_vals;
+  gint nreturn_vals;
+  gchar *metadata_string = NULL;
+
+  return_vals = gimp_run_procedure ("gimp-image-metadata-get",
+                                    &nreturn_vals,
+                                    GIMP_PDB_IMAGE, image_ID,
+                                    GIMP_PDB_END);
+
+  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+    metadata_string = g_strdup (return_vals[1].data.d_string);
+
+  gimp_destroy_params (return_vals, nreturn_vals);
+
+  return metadata_string;
+}
+
+/**
+ * gimp_image_metadata_set:
+ * @image_ID: The image.
+ * @metadata_string: The exif/ptc/xmp metadata as a string.
+ *
+ * set images metadata.
+ *
+ * Sets exif/iptc/xmp metadata to image.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_metadata_set (gint32       image_ID,
+                         const gchar *metadata_string)
+{
+  GimpParam *return_vals;
+  gint nreturn_vals;
+  gboolean success = TRUE;
+
+  return_vals = gimp_run_procedure ("gimp-image-metadata-set",
+                                    &nreturn_vals,
+                                    GIMP_PDB_IMAGE, image_ID,
+                                    GIMP_PDB_STRING, metadata_string,
+                                    GIMP_PDB_END);
+
+  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+  gimp_destroy_params (return_vals, nreturn_vals);
+
+  return success;
+}
diff --git a/libgimp/gimpmetadata_pdb.h b/libgimp/gimpmetadata_pdb.h
new file mode 100644
index 0000000..53647bd
--- /dev/null
+++ b/libgimp/gimpmetadata_pdb.h
@@ -0,0 +1,42 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpmetadata_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_METADATA_PDB_H__
+#define __GIMP_METADATA_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gchar*   gimp_image_metadata_get (gint32       image_ID);
+gboolean gimp_image_metadata_set (gint32       image_ID,
+                                  const gchar *metadata_string);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_METADATA_PDB_H__ */
diff --git a/libgimpbase/Makefile.am b/libgimpbase/Makefile.am
index 59a258b..f8828b3 100644
--- a/libgimpbase/Makefile.am
+++ b/libgimpbase/Makefile.am
@@ -119,6 +119,8 @@ libgimpbase_sources = \
 	gimputils.h            	\
 	gimpvaluearray.c	\
 	gimpvaluearray.h	\
+  gimpwilber.c     \
+  gimpwilber.h     \
 	gimpwin32-io.h		\
 	gimpwire.c		\
 	gimpwire.h
@@ -150,7 +152,8 @@ libgimpbaseinclude_HEADERS = \
 	gimpsignal.h		\
 	gimpunit.h		\
 	gimputils.h		\
-	gimpvaluearray.h
+	gimpvaluearray.h  \
+  gimpwilber.h
 
 
 libgimpbase_@GIMP_API_VERSION@_la_LDFLAGS = \
diff --git a/libgimpbase/gimpbase.def b/libgimpbase/gimpbase.def
index 9eeb82b..4177564 100644
--- a/libgimpbase/gimpbase.def
+++ b/libgimpbase/gimpbase.def
@@ -139,6 +139,7 @@ EXPORTS
 	gimp_value_array_truncate
 	gimp_value_array_unref
 	gimp_vectors_stroke_type_get_type
+  gimp_wilber_get_data
 	gimp_wire_clear_error
 	gimp_wire_destroy
 	gimp_wire_error
diff --git a/libgimpbase/gimpbase.h b/libgimpbase/gimpbase.h
index 08930dc..6585310 100644
--- a/libgimpbase/gimpbase.h
+++ b/libgimpbase/gimpbase.h
@@ -35,6 +35,7 @@
 #include <libgimpbase/gimputils.h>
 #include <libgimpbase/gimpversion.h>
 #include <libgimpbase/gimpvaluearray.h>
+#include <libgimpbase/gimpwilber.h>
 
 #ifndef G_OS_WIN32
 #include <libgimpbase/gimpsignal.h>
diff --git a/libgimpbase/gimpwilber.c b/libgimpbase/gimpwilber.c
new file mode 100644
index 0000000..16bc23e
--- /dev/null
+++ b/libgimpbase/gimpwilber.c
@@ -0,0 +1,67 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpwilber.c
+ * Copyright (C) 2007 Sven Neumann <sven@gimp.org>
+ *
+ * This library is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#include <glib-object.h>
+
+#include "gimpwilber.h"
+
+const guint8 wilber_jpg[] = {
+  0xff, 0xd8, 0xff, 0xe0, 0x00, 0x10, 0x4a, 0x46, 0x49, 0x46, 0x00, 0x01,
+  0x01, 0x01, 0x00, 0x5a, 0x00, 0x5a, 0x00, 0x00, 0xff, 0xdb, 0x00, 0x43,
+  0x00, 0x50, 0x37, 0x3c, 0x46, 0x3c, 0x32, 0x50, 0x46, 0x41, 0x46, 0x5a,
+  0x55, 0x50, 0x5f, 0x78, 0xc8, 0x82, 0x78, 0x6e, 0x6e, 0x78, 0xf5, 0xaf,
+  0xb9, 0x91, 0xc8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdb, 0x00, 0x43, 0x01, 0x55, 0x5a,
+  0x5a, 0x78, 0x69, 0x78, 0xeb, 0x82, 0x82, 0xeb, 0xff, 0xff, 0xff, 0xff,
+  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+  0xff, 0xff, 0xff, 0xc0, 0x00, 0x11, 0x08, 0x00, 0x10, 0x00, 0x10, 0x03,
+  0x01, 0x22, 0x00, 0x02, 0x11, 0x01, 0x03, 0x11, 0x01, 0xff, 0xc4, 0x00,
+  0x16, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x01, 0x02, 0xff, 0xc4, 0x00,
+  0x1e, 0x10, 0x00, 0x01, 0x05, 0x00, 0x02, 0x03, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x03, 0x11, 0x31,
+  0x04, 0x12, 0x51, 0x61, 0x71, 0xff, 0xc4, 0x00, 0x14, 0x01, 0x01, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0xff, 0xc4, 0x00, 0x14, 0x11, 0x01, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0xff, 0xda, 0x00, 0x0c, 0x03, 0x01, 0x00, 0x02, 0x11, 0x03, 0x11,
+  0x00, 0x3f, 0x00, 0x18, 0xa0, 0x0e, 0x6d, 0xbc, 0xf5, 0xca, 0xf7, 0x78,
+  0xb6, 0xfe, 0x3b, 0x23, 0xb2, 0x1d, 0x64, 0x68, 0xf0, 0x8a, 0x39, 0x4b,
+  0x74, 0x9c, 0xa5, 0x5f, 0x35, 0x8a, 0xb2, 0x7e, 0xa0, 0xff, 0xd9, 0x00
+};
+
+guint wilber_jpg_len = 324;
+
+
+const guint8 *
+gimp_wilber_get_data (guint *length)
+{
+  *length = wilber_jpg_len;
+  return wilber_jpg;
+}
+
diff --git a/libgimpbase/gimpwilber.h b/libgimpbase/gimpwilber.h
new file mode 100644
index 0000000..ddd64e2
--- /dev/null
+++ b/libgimpbase/gimpwilber.h
@@ -0,0 +1,31 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpwilber.h
+ * Copyright (C) 2007 Sven Neumann <sven@gimp.org>
+ *
+ * This library is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GIMP_WILBER_H__
+#define __GIMP_WILBER_H__
+
+G_BEGIN_DECLS
+
+const guint8 *gimp_wilber_get_data   (guint *);
+
+G_END_DECLS
+
+#endif /* __GIMP_WILBER_H__ */
diff --git a/menus/image-menu.xml.in b/menus/image-menu.xml.in
index 26496ee..6214f5d 100644
--- a/menus/image-menu.xml.in
+++ b/menus/image-menu.xml.in
@@ -52,6 +52,7 @@
       <placeholder name="Send" />
       <separator />
       <placeholder name="Info" />
+        <menuitem action="file-show-metadata"/>
       <separator />
       <menuitem action="view-close" />
       <menuitem action="file-close-all" />
diff --git a/plug-ins/color-rotate/color-rotate-callbacks.c b/plug-ins/color-rotate/color-rotate-callbacks.c
index 5c96b75..ff948e5 100644
--- a/plug-ins/color-rotate/color-rotate-callbacks.c
+++ b/plug-ins/color-rotate/color-rotate-callbacks.c
@@ -87,7 +87,7 @@ rcm_360_degrees (GtkWidget *button,
 
   circle->angle->beta = circle->angle->alpha-circle->angle->cw_ccw * 0.001;
 
-  rcm_render_preview (Current.Bna->after);
+  rcm_render_preview (Current_c.Bna->after);
 }
 
 void
@@ -115,7 +115,7 @@ rcm_a_to_b (GtkWidget *button,
 
   SWAP (circle->angle->alpha, circle->angle->beta);
 
-  rcm_render_preview (Current.Bna->after);
+  rcm_render_preview (Current_c.Bna->after);
 }
 
 
@@ -131,14 +131,14 @@ rcm_spinbutton_to_degrees (GtkWidget *button,
   adj = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (button));
 
   gtk_adjustment_configure (adj,
-                            value * rcm_units_factor (Current.Units),
+                            value * rcm_units_factor (Current_c.Units),
                             gtk_adjustment_get_lower (adj), 360.0,
                             0.01, 1.0,
                             gtk_adjustment_get_page_size (adj));
 
   gtk_spin_button_set_digits (GTK_SPIN_BUTTON (button), 2);
 
-  gtk_label_set_text (GTK_LABEL (label), rcm_units_string (Current.Units));
+  gtk_label_set_text (GTK_LABEL (label), rcm_units_string (Current_c.Units));
 }
 
 void
@@ -147,27 +147,27 @@ rcm_switch_to_degrees (GtkWidget *button,
 {
   if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)))
     {
-      Current.Units = DEGREES;
+      Current_c.Units = DEGREES;
 
-      rcm_spinbutton_to_degrees (Current.From->alpha_entry,
-                                 Current.From->angle->alpha,
-                                 Current.From->alpha_units_label);
+      rcm_spinbutton_to_degrees (Current_c.From->alpha_entry,
+                                 Current_c.From->angle->alpha,
+                                 Current_c.From->alpha_units_label);
 
-      rcm_spinbutton_to_degrees (Current.From->beta_entry,
-                                 Current.From->angle->beta,
-                                 Current.From->beta_units_label);
+      rcm_spinbutton_to_degrees (Current_c.From->beta_entry,
+                                 Current_c.From->angle->beta,
+                                 Current_c.From->beta_units_label);
 
-      rcm_spinbutton_to_degrees (Current.To->alpha_entry,
-                                 Current.To->angle->alpha,
-                                 Current.To->alpha_units_label);
+      rcm_spinbutton_to_degrees (Current_c.To->alpha_entry,
+                                 Current_c.To->angle->alpha,
+                                 Current_c.To->alpha_units_label);
 
-      rcm_spinbutton_to_degrees (Current.To->beta_entry,
-                                 Current.To->angle->beta,
-                                 Current.To->beta_units_label);
+      rcm_spinbutton_to_degrees (Current_c.To->beta_entry,
+                                 Current_c.To->angle->beta,
+                                 Current_c.To->beta_units_label);
 
-      rcm_spinbutton_to_degrees (Current.Gray->hue_entry,
-                                 Current.Gray->hue,
-                                 Current.Gray->hue_units_label);
+      rcm_spinbutton_to_degrees (Current_c.Gray->hue_entry,
+                                 Current_c.Gray->hue,
+                                 Current_c.Gray->hue_units_label);
     }
 }
 
@@ -181,14 +181,14 @@ rcm_spinbutton_to_radians (GtkWidget *button,
   adj = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (button));
 
   gtk_adjustment_configure (adj,
-                            value * rcm_units_factor (Current.Units),
+                            value * rcm_units_factor (Current_c.Units),
                             gtk_adjustment_get_lower (adj), TP,
                             0.0001, 0.001,
                             gtk_adjustment_get_page_size (adj));
 
   gtk_spin_button_set_digits (GTK_SPIN_BUTTON (button), 4);
 
-  gtk_label_set_text (GTK_LABEL (label), rcm_units_string (Current.Units));
+  gtk_label_set_text (GTK_LABEL (label), rcm_units_string (Current_c.Units));
 }
 
 void
@@ -197,27 +197,27 @@ rcm_switch_to_radians (GtkWidget *button,
 {
   if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)))
     {
-      Current.Units = RADIANS;
+      Current_c.Units = RADIANS;
 
-      rcm_spinbutton_to_radians (Current.From->alpha_entry,
-                                 Current.From->angle->alpha,
-                                 Current.From->alpha_units_label);
+      rcm_spinbutton_to_radians (Current_c.From->alpha_entry,
+                                 Current_c.From->angle->alpha,
+                                 Current_c.From->alpha_units_label);
 
-      rcm_spinbutton_to_radians (Current.From->beta_entry,
-                                 Current.From->angle->beta,
-                                 Current.From->beta_units_label);
+      rcm_spinbutton_to_radians (Current_c.From->beta_entry,
+                                 Current_c.From->angle->beta,
+                                 Current_c.From->beta_units_label);
 
-      rcm_spinbutton_to_radians (Current.To->alpha_entry,
-                                 Current.To->angle->alpha,
-                                 Current.To->alpha_units_label);
+      rcm_spinbutton_to_radians (Current_c.To->alpha_entry,
+                                 Current_c.To->angle->alpha,
+                                 Current_c.To->alpha_units_label);
 
-      rcm_spinbutton_to_radians (Current.To->beta_entry,
-                                 Current.To->angle->beta,
-                                 Current.To->beta_units_label);
+      rcm_spinbutton_to_radians (Current_c.To->beta_entry,
+                                 Current_c.To->angle->beta,
+                                 Current_c.To->beta_units_label);
 
-      rcm_spinbutton_to_radians (Current.Gray->hue_entry,
-                                 Current.Gray->hue,
-                                 Current.Gray->hue_units_label);
+      rcm_spinbutton_to_radians (Current_c.Gray->hue_entry,
+                                 Current_c.Gray->hue,
+                                 Current_c.Gray->hue_units_label);
     }
 }
 
@@ -231,14 +231,14 @@ rcm_spinbutton_to_radians_over_PI (GtkWidget *button,
   adj = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (button));
 
   gtk_adjustment_configure (adj,
-                            value * rcm_units_factor (Current.Units),
+                            value * rcm_units_factor (Current_c.Units),
                             gtk_adjustment_get_lower (adj), 2.0,
                             0.0001, 0.001,
                             gtk_adjustment_get_page_size (adj));
 
   gtk_spin_button_set_digits (GTK_SPIN_BUTTON (button), 4);
 
-  gtk_label_set_text (GTK_LABEL (label), rcm_units_string (Current.Units));
+  gtk_label_set_text (GTK_LABEL (label), rcm_units_string (Current_c.Units));
 }
 
 void
@@ -247,27 +247,27 @@ rcm_switch_to_radians_over_PI (GtkWidget *button,
 {
   if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)))
     {
-      Current.Units = RADIANS_OVER_PI;
+      Current_c.Units = RADIANS_OVER_PI;
 
-      rcm_spinbutton_to_radians_over_PI (Current.From->alpha_entry,
-                                         Current.From->angle->alpha,
-                                         Current.From->alpha_units_label);
+      rcm_spinbutton_to_radians_over_PI (Current_c.From->alpha_entry,
+                                         Current_c.From->angle->alpha,
+                                         Current_c.From->alpha_units_label);
 
-      rcm_spinbutton_to_radians_over_PI (Current.From->beta_entry,
-                                         Current.From->angle->beta,
-                                         Current.From->beta_units_label);
+      rcm_spinbutton_to_radians_over_PI (Current_c.From->beta_entry,
+                                         Current_c.From->angle->beta,
+                                         Current_c.From->beta_units_label);
 
-      rcm_spinbutton_to_radians_over_PI (Current.To->alpha_entry,
-                                         Current.To->angle->alpha,
-                                         Current.To->alpha_units_label);
+      rcm_spinbutton_to_radians_over_PI (Current_c.To->alpha_entry,
+                                         Current_c.To->angle->alpha,
+                                         Current_c.To->alpha_units_label);
 
-      rcm_spinbutton_to_radians_over_PI (Current.To->beta_entry,
-                                         Current.To->angle->beta,
-                                         Current.To->beta_units_label);
+      rcm_spinbutton_to_radians_over_PI (Current_c.To->beta_entry,
+                                         Current_c.To->angle->beta,
+                                         Current_c.To->beta_units_label);
 
-      rcm_spinbutton_to_radians_over_PI (Current.Gray->hue_entry,
-                                         Current.Gray->hue,
-                                         Current.Gray->hue_units_label);
+      rcm_spinbutton_to_radians_over_PI (Current_c.Gray->hue_entry,
+                                         Current_c.Gray->hue,
+                                         Current_c.Gray->hue_units_label);
     }
 }
 
@@ -280,9 +280,9 @@ rcm_switch_to_gray_to (GtkWidget *button,
 {
   if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)))
     {
-      Current.Gray_to_from = GRAY_TO;
+      Current_c.Gray_to_from = GRAY_TO;
 
-      rcm_render_preview (Current.Bna->after);
+      rcm_render_preview (Current_c.Bna->after);
     }
 }
 
@@ -292,9 +292,9 @@ rcm_switch_to_gray_from (GtkWidget *button,
 {
   if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)))
     {
-      Current.Gray_to_from = GRAY_FROM;
+      Current_c.Gray_to_from = GRAY_FROM;
 
-      rcm_render_preview (Current.Bna->after);
+      rcm_render_preview (Current_c.Bna->after);
     }
 }
 
@@ -305,7 +305,7 @@ void
 rcm_preview_as_you_drag (GtkWidget *button,
 			 gpointer  *value)
 {
-  Current.RealTime = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
+  Current_c.RealTime = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
 }
 
 void
@@ -316,15 +316,15 @@ rcm_combo_callback (GtkWidget *widget,
 
   gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget), &value);
 
-  Current.reduced = rcm_reduce_image (Current.drawable, Current.mask,
+  Current_c.reduced = rcm_reduce_image (Current_c.drawable, Current_c.mask,
                                       MAX_PREVIEW_SIZE, value);
 
-  gtk_widget_set_size_request (Current.Bna->before,
-                               Current.reduced->width,
-                               Current.reduced->height);
-  gtk_widget_set_size_request (Current.Bna->after,
-                               Current.reduced->width,
-                               Current.reduced->height);
+  gtk_widget_set_size_request (Current_c.Bna->before,
+                               Current_c.reduced->width,
+                               Current_c.reduced->height);
+  gtk_widget_set_size_request (Current_c.Bna->after,
+                               Current_c.reduced->width,
+                               Current_c.reduced->height);
 }
 
 
@@ -375,14 +375,14 @@ rcm_button_press_event (GtkWidget      *widget,
 
           gtk_spin_button_set_value (GTK_SPIN_BUTTON (circle->alpha_entry),
                                      circle->angle->alpha *
-                                     rcm_units_factor(Current.Units));
+                                     rcm_units_factor(Current_c.Units));
 
           gtk_spin_button_set_value (GTK_SPIN_BUTTON (circle->beta_entry),
                                      circle->angle->beta *
-                                     rcm_units_factor(Current.Units));
+                                     rcm_units_factor(Current_c.Units));
 
-          if (Current.RealTime)
-            rcm_render_preview (Current.Bna->after);
+          if (Current_c.RealTime)
+            rcm_render_preview (Current_c.Bna->after);
         }
     }
   else
@@ -396,7 +396,7 @@ rcm_release_event (GtkWidget      *widget,
 		   GdkEventButton *event,
 		   RcmCircle      *circle)
 {
-  rcm_render_preview (Current.Bna->after);
+  rcm_render_preview (Current_c.Bna->after);
 
   return TRUE;
 }
@@ -430,14 +430,14 @@ rcm_motion_notify_event (GtkWidget      *widget,
 
       gtk_spin_button_set_value (GTK_SPIN_BUTTON (circle->alpha_entry),
                                  circle->angle->alpha *
-                                 rcm_units_factor(Current.Units));
+                                 rcm_units_factor(Current_c.Units));
 
       gtk_spin_button_set_value (GTK_SPIN_BUTTON (circle->beta_entry),
                                  circle->angle->beta *
-                                 rcm_units_factor(Current.Units));
+                                 rcm_units_factor(Current_c.Units));
 
-      if (Current.RealTime)
-        rcm_render_preview (Current.Bna->after);
+      if (Current_c.RealTime)
+        rcm_render_preview (Current_c.Bna->after);
     }
 
   gdk_event_request_motions (event);
@@ -484,13 +484,13 @@ rcm_gray_button_press_event (GtkWidget      *widget,
   gtk_widget_queue_draw (circle->preview);
 
   gtk_spin_button_set_value (GTK_SPIN_BUTTON (circle->hue_entry),
-                             circle->hue * rcm_units_factor (Current.Units));
+                             circle->hue * rcm_units_factor (Current_c.Units));
 
   gtk_spin_button_set_value (GTK_SPIN_BUTTON (circle->satur_entry),
                              circle->satur);
 
-  if (Current.RealTime)
-    rcm_render_preview (Current.Bna->after);
+  if (Current_c.RealTime)
+    rcm_render_preview (Current_c.Bna->after);
 
   return TRUE;
 }
@@ -500,7 +500,7 @@ rcm_gray_release_event (GtkWidget      *widget,
 			GdkEventButton *event,
 			RcmGray        *circle)
 {
-  rcm_render_preview (Current.Bna->after);
+  rcm_render_preview (Current_c.Bna->after);
 
   return TRUE;
 }
@@ -524,13 +524,13 @@ rcm_gray_motion_notify_event (GtkWidget      *widget,
     circle->satur = 1;
 
   gtk_spin_button_set_value (GTK_SPIN_BUTTON (circle->hue_entry),
-                             circle->hue * rcm_units_factor(Current.Units));
+                             circle->hue * rcm_units_factor(Current_c.Units));
 
   gtk_spin_button_set_value (GTK_SPIN_BUTTON (circle->satur_entry),
                              circle->satur);
 
-  if (Current.RealTime)
-    rcm_render_preview (Current.Bna->after);
+  if (Current_c.RealTime)
+    rcm_render_preview (Current_c.Bna->after);
 
   gdk_event_request_motions (event);
 
@@ -545,11 +545,11 @@ rcm_set_alpha (GtkWidget *entry,
                RcmCircle *circle)
 {
   circle->angle->alpha = (gtk_spin_button_get_value (GTK_SPIN_BUTTON (entry)) /
-                          rcm_units_factor (Current.Units));
+                          rcm_units_factor (Current_c.Units));
 
   gtk_widget_queue_draw (circle->preview);
 
-  rcm_render_preview (Current.Bna->after);
+  rcm_render_preview (Current_c.Bna->after);
 }
 
 void
@@ -557,11 +557,11 @@ rcm_set_beta (GtkWidget *entry,
               RcmCircle *circle)
 {
   circle->angle->beta = (gtk_spin_button_get_value (GTK_SPIN_BUTTON (entry)) /
-                         rcm_units_factor(Current.Units));
+                         rcm_units_factor(Current_c.Units));
 
   gtk_widget_queue_draw (circle->preview);
 
-  rcm_render_preview (Current.Bna->after);
+  rcm_render_preview (Current_c.Bna->after);
 }
 
 void
@@ -569,11 +569,11 @@ rcm_set_hue (GtkWidget *entry,
              RcmGray   *circle)
 {
   circle->hue = (gtk_spin_button_get_value (GTK_SPIN_BUTTON (entry)) /
-                 rcm_units_factor(Current.Units));
+                 rcm_units_factor(Current_c.Units));
 
   gtk_widget_queue_draw (circle->preview);
 
-  rcm_render_preview (Current.Bna->after);
+  rcm_render_preview (Current_c.Bna->after);
 }
 
 void
@@ -584,7 +584,7 @@ rcm_set_satur (GtkWidget *entry,
 
   gtk_widget_queue_draw (circle->preview);
 
-  rcm_render_preview (Current.Bna->after);
+  rcm_render_preview (Current_c.Bna->after);
 }
 
 void
@@ -595,5 +595,5 @@ rcm_set_gray_sat (GtkWidget *entry,
 
   gtk_widget_queue_draw (circle->preview);
 
-  rcm_render_preview (Current.Bna->after);
+  rcm_render_preview (Current_c.Bna->after);
 }
diff --git a/plug-ins/color-rotate/color-rotate-dialog.c b/plug-ins/color-rotate/color-rotate-dialog.c
index 6ffc5a1..d072011 100644
--- a/plug-ins/color-rotate/color-rotate-dialog.c
+++ b/plug-ins/color-rotate/color-rotate-dialog.c
@@ -121,13 +121,13 @@ rcm_create_previews (void)
   gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
   gtk_widget_show (label);
 
-  frame = rcm_create_one_preview (&Current.Bna->before, ORIGINAL,
-                                  Current.reduced->width,
-                                  Current.reduced->height);
+  frame = rcm_create_one_preview (&Current_c.Bna->before, ORIGINAL,
+                                  Current_c.reduced->width,
+                                  Current_c.reduced->height);
   gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
   gtk_widget_show (frame);
 
-  g_signal_connect_after (Current.Bna->before, "size-allocate",
+  g_signal_connect_after (Current_c.Bna->before, "size-allocate",
                           G_CALLBACK (rcm_render_preview),
                           NULL);
 
@@ -139,13 +139,13 @@ rcm_create_previews (void)
   gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
   gtk_widget_show (label);
 
-  frame = rcm_create_one_preview (&Current.Bna->after, CURRENT,
-                                  Current.reduced->width,
-                                  Current.reduced->height);
+  frame = rcm_create_one_preview (&Current_c.Bna->after, CURRENT,
+                                  Current_c.reduced->width,
+                                  Current_c.reduced->height);
   gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
   gtk_widget_show (frame);
 
-  g_signal_connect_after (Current.Bna->after, "size-allocate",
+  g_signal_connect_after (Current_c.Bna->after, "size-allocate",
                           G_CALLBACK (rcm_render_preview),
                           NULL);
 
@@ -155,12 +155,12 @@ rcm_create_previews (void)
 
   button = gtk_check_button_new_with_label (_("Continuous update"));
   gtk_box_pack_start(GTK_BOX (vbox), button, FALSE, FALSE, 0);
-  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), Current.RealTime);
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), Current_c.RealTime);
   gtk_widget_show (button);
 
   g_signal_connect (button, "clicked",
                     G_CALLBACK (rcm_preview_as_you_drag),
-                    &(Current.RealTime));
+                    &(Current_c.RealTime));
 
   hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
   gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
@@ -174,7 +174,7 @@ rcm_create_previews (void)
                                   _("Selection"),    SELECTION,
                                   _("Context"),      SELECTION_IN_CONTEXT,
                                   NULL);
-  gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (combo), Current.Slctn);
+  gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (combo), Current_c.Slctn);
 
   gtk_box_pack_start (GTK_BOX (hbox), combo, TRUE, TRUE, 0);
   gtk_widget_show (combo);
@@ -315,7 +315,7 @@ rcm_create_one_circle (gint         height,
                     st);
 
   /* label */
-  st->alpha_units_label = gtk_label_new (rcm_units_string (Current.Units));
+  st->alpha_units_label = gtk_label_new (rcm_units_string (Current_c.Units));
   gtk_widget_show (st->alpha_units_label);
 
   gtk_table_attach (GTK_TABLE (legend_table),
@@ -341,7 +341,7 @@ rcm_create_one_circle (gint         height,
                     st);
 
   /* label */
-  st->beta_units_label = gtk_label_new (rcm_units_string (Current.Units));
+  st->beta_units_label = gtk_label_new (rcm_units_string (Current_c.Units));
   gtk_widget_show (st->beta_units_label);
 
   gtk_table_attach (GTK_TABLE (legend_table), st->beta_units_label, 5,6, 0,1,
@@ -374,16 +374,16 @@ rcm_create_main (void)
 {
   GtkWidget *vbox;
 
-  Current.From = rcm_create_one_circle (SUM, C_("color-rotate", "From:"));
-  Current.To   = rcm_create_one_circle (SUM, C_("color-rotate", "To:"));
+  Current_c.From = rcm_create_one_circle (SUM, C_("color-rotate", "From:"));
+  Current_c.To   = rcm_create_one_circle (SUM, C_("color-rotate", "To:"));
 
   vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
   gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
   gtk_widget_show (vbox);
 
-  gtk_box_pack_start (GTK_BOX (vbox), Current.From->frame,
+  gtk_box_pack_start (GTK_BOX (vbox), Current_c.From->frame,
 		      FALSE, FALSE, 0);
-  gtk_box_pack_start (GTK_BOX (vbox), Current.To->frame,
+  gtk_box_pack_start (GTK_BOX (vbox), Current_c.To->frame,
 		      FALSE, FALSE, 0);
 
   return vbox;
@@ -407,7 +407,7 @@ rcm_create_gray (void)
   RcmGray   *st;
   GtkAdjustment *adj;
 
-  Current.Gray = st = g_new (RcmGray, 1);
+  Current_c.Gray = st = g_new (RcmGray, 1);
   st->hue   = 0;
   st->satur = 0;
 
@@ -483,7 +483,7 @@ rcm_create_gray (void)
                     st);
 
   /* Gray: Circle: units label */
-  st->hue_units_label = gtk_label_new (rcm_units_string (Current.Units));
+  st->hue_units_label = gtk_label_new (rcm_units_string (Current_c.Units));
   gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
   gtk_table_attach (GTK_TABLE (table), st->hue_units_label, 2, 3, 0, 1,
 		    GTK_FILL, GTK_FILL, 0, 0);
@@ -524,24 +524,24 @@ rcm_create_gray (void)
   gtk_box_pack_start (GTK_BOX (radio_box), button, FALSE, FALSE, 0);
   gtk_widget_show (button);
 
-  if (Current.Gray_to_from == GRAY_FROM)
+  if (Current_c.Gray_to_from == GRAY_FROM)
     gtk_button_clicked (GTK_BUTTON (button));
 
   g_signal_connect (button, "clicked",
                     G_CALLBACK (rcm_switch_to_gray_from),
-                    &(Current.Gray_to_from));
+                    &(Current_c.Gray_to_from));
 
   button = gtk_radio_button_new_with_label (group, _("Change to this"));
   group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
   gtk_box_pack_start (GTK_BOX (radio_box), button, FALSE, FALSE, 0);
   gtk_widget_show (button);
 
-  if (Current.Gray_to_from == GRAY_TO)
+  if (Current_c.Gray_to_from == GRAY_TO)
     gtk_button_clicked (GTK_BUTTON (button));
 
   g_signal_connect (button, "clicked",
                     G_CALLBACK (rcm_switch_to_gray_to),
-                    &(Current.Gray_to_from));
+                    &(Current_c.Gray_to_from));
 
   /** Gray: What is gray? **/
   frame = gimp_frame_new (_("Gray Threshold"));
@@ -598,7 +598,7 @@ rcm_create_units (void)
   gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
   gtk_widget_show (button);
 
-  if (Current.Units == RADIANS)
+  if (Current_c.Units == RADIANS)
     gtk_button_clicked (GTK_BUTTON (button));
 
   g_signal_connect (button, "clicked",
@@ -610,7 +610,7 @@ rcm_create_units (void)
   gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
   gtk_widget_show (button);
 
-  if (Current.Units == RADIANS_OVER_PI)
+  if (Current_c.Units == RADIANS_OVER_PI)
     gtk_button_clicked (GTK_BUTTON (button));
 
   g_signal_connect (button, "clicked",
@@ -621,7 +621,7 @@ rcm_create_units (void)
   gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
   gtk_widget_show (button);
 
-  if (Current.Units == DEGREES)
+  if (Current_c.Units == DEGREES)
     gtk_button_clicked (GTK_BUTTON (button));
 
   g_signal_connect (button, "clicked",
@@ -643,7 +643,7 @@ color_rotate_dialog (void)
   GtkWidget *previews;
   gboolean   run;
 
-  Current.Bna = g_new (RcmBna, 1);
+  Current_c.Bna = g_new (RcmBna, 1);
 
   gimp_ui_init (PLUG_IN_BINARY, TRUE);
   color_rotate_stock_init ();
@@ -664,13 +664,13 @@ color_rotate_dialog (void)
 
   gimp_window_set_transient (GTK_WINDOW (dialog));
 
-  Current.Bna->dlg = dialog;
+  Current_c.Bna->dlg = dialog;
 
   /* Create sub-dialogs */
-  Current.reduced = rcm_reduce_image (Current.drawable, Current.mask,
-                                      MAX_PREVIEW_SIZE, Current.Slctn);
+  Current_c.reduced = rcm_reduce_image (Current_c.drawable, Current_c.mask,
+                                      MAX_PREVIEW_SIZE, Current_c.Slctn);
 
-  Current.Bna->bna_frame = previews = rcm_create_previews ();
+  Current_c.Bna->bna_frame = previews = rcm_create_previews ();
 
   /* H-Box */
   hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
@@ -698,9 +698,9 @@ color_rotate_dialog (void)
 
   gtk_widget_show (dialog);
 
-  rcm_render_circle (Current.From->preview, SUM, MARGIN);
-  rcm_render_circle (Current.To->preview, SUM, MARGIN);
-  rcm_render_circle (Current.Gray->preview, GRAY_SUM, GRAY_MARGIN);
+  rcm_render_circle (Current_c.From->preview, SUM, MARGIN);
+  rcm_render_circle (Current_c.To->preview, SUM, MARGIN);
+  rcm_render_circle (Current_c.Gray->preview, GRAY_SUM, GRAY_MARGIN);
 
   run = (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK);
 
diff --git a/plug-ins/color-rotate/color-rotate-utils.c b/plug-ins/color-rotate/color-rotate-utils.c
index 1fe8da7..38750d0 100644
--- a/plug-ins/color-rotate/color-rotate-utils.c
+++ b/plug-ins/color-rotate/color-rotate-utils.c
@@ -169,7 +169,7 @@ rcm_angle_inside_slice (float     angle,
 gboolean
 rcm_is_gray (float s)
 {
-  return (s <= Current.Gray->gray_sat);
+  return (s <= Current_c.Gray->gray_sat);
 }
 
 
@@ -328,10 +328,10 @@ rcm_render_preview (GtkWidget *preview)
 
   version = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (preview), "mode"));
 
-  reduced   = Current.reduced;
+  reduced   = Current_c.reduced;
   RW        = reduced->width;
   RH        = reduced->height;
-  bytes     = Current.drawable->bpp;
+  bytes     = Current_c.drawable->bpp;
   hsv_array = reduced->hsv;
   rgb_array = reduced->rgb;
 
@@ -355,14 +355,14 @@ rcm_render_preview (GtkWidget *preview)
 
               if (rcm_is_gray(S) && (reduced->mask[i*RW+j] != 0))
                 {
-                  switch (Current.Gray_to_from)
+                  switch (Current_c.Gray_to_from)
                     {
                     case GRAY_FROM:
-                      if (rcm_angle_inside_slice (Current.Gray->hue,
-                                                  Current.From->angle) <= 1)
+                      if (rcm_angle_inside_slice (Current_c.Gray->hue,
+                                                  Current_c.From->angle) <= 1)
                         {
-                          H = Current.Gray->hue/TP;
-                          S = Current.Gray->satur;
+                          H = Current_c.Gray->hue/TP;
+                          S = Current_c.Gray->satur;
                         }
                       else
                         skip = TRUE;
@@ -372,8 +372,8 @@ rcm_render_preview (GtkWidget *preview)
                       unchanged = FALSE;
                       skip = TRUE;
                       gimp_hsv_to_rgb4 (rgb,
-                                        Current.Gray->hue/TP,
-                                        Current.Gray->satur,
+                                        Current_c.Gray->hue/TP,
+                                        Current_c.Gray->satur,
                                         V);
                       break;
 
@@ -385,10 +385,10 @@ rcm_render_preview (GtkWidget *preview)
               if (!skip)
                 {
                   unchanged = FALSE;
-                  H = rcm_linear (rcm_left_end (Current.From->angle),
-                                  rcm_right_end (Current.From->angle),
-                                  rcm_left_end (Current.To->angle),
-                                  rcm_right_end (Current.To->angle),
+                  H = rcm_linear (rcm_left_end (Current_c.From->angle),
+                                  rcm_right_end (Current_c.From->angle),
+                                  rcm_left_end (Current_c.To->angle),
+                                  rcm_right_end (Current_c.To->angle),
                                   H * TP);
 
                   H = angle_mod_2PI(H) / TP;
diff --git a/plug-ins/color-rotate/color-rotate.c b/plug-ins/color-rotate/color-rotate.c
index e4056ab..b811fa4 100644
--- a/plug-ins/color-rotate/color-rotate.c
+++ b/plug-ins/color-rotate/color-rotate.c
@@ -62,7 +62,7 @@ static void  color_rotate (GimpDrawable     *drawable);
 
 /* Global variables */
 
-RcmParams Current =
+RcmParams Current_c =
 {
   SELECTION,           /* SELECTION ONLY */
   TRUE,                /* REAL TIME */
@@ -129,18 +129,18 @@ run (const gchar      *name,
   values[0].type          = GIMP_PDB_STATUS;
   values[0].data.d_status = status;
 
-  Current.drawable = gimp_drawable_get (param[2].data.d_drawable);
-  Current.mask = gimp_drawable_get (gimp_image_get_selection (param[1].data.d_image));
+  Current_c.drawable = gimp_drawable_get (param[2].data.d_drawable);
+  Current_c.mask = gimp_drawable_get (gimp_image_get_selection (param[1].data.d_image));
 
-  if (gimp_drawable_is_rgb (Current.drawable->drawable_id))
+  if (gimp_drawable_is_rgb (Current_c.drawable->drawable_id))
     {
       if (color_rotate_dialog ())
         {
           gimp_progress_init (_("Rotating the colors"));
 
-          gimp_tile_cache_ntiles (2 * (Current.drawable->width /
+          gimp_tile_cache_ntiles (2 * (Current_c.drawable->width /
                                        gimp_tile_width () + 1));
-          color_rotate (Current.drawable);
+          color_rotate (Current_c.drawable);
           gimp_displays_flush ();
         }
       else
@@ -156,7 +156,7 @@ run (const gchar      *name,
   values[0].data.d_status = status;
 
   if (status == GIMP_PDB_SUCCESS)
-    gimp_drawable_detach (Current.drawable);
+    gimp_drawable_detach (Current_c.drawable);
 }
 
 
@@ -185,13 +185,13 @@ color_rotate_row (const guchar *src_row,
 
       if (rcm_is_gray (S))
         {
-          if (Current.Gray_to_from == GRAY_FROM)
+          if (Current_c.Gray_to_from == GRAY_FROM)
             {
-              if (rcm_angle_inside_slice (Current.Gray->hue,
-                                          Current.From->angle) <= 1)
+              if (rcm_angle_inside_slice (Current_c.Gray->hue,
+                                          Current_c.From->angle) <= 1)
                 {
-                  H = Current.Gray->hue / TP;
-                  S = Current.Gray->satur;
+                  H = Current_c.Gray->hue / TP;
+                  S = Current_c.Gray->satur;
                 }
               else
                 {
@@ -201,17 +201,17 @@ color_rotate_row (const guchar *src_row,
           else
             {
               skip = TRUE;
-              gimp_hsv_to_rgb4 (rgb, Current.Gray->hue / TP,
-                                Current.Gray->satur, V);
+              gimp_hsv_to_rgb4 (rgb, Current_c.Gray->hue / TP,
+                                Current_c.Gray->satur, V);
             }
         }
 
       if (! skip)
         {
-          H = rcm_linear (rcm_left_end (Current.From->angle),
-                          rcm_right_end (Current.From->angle),
-                          rcm_left_end (Current.To->angle),
-                          rcm_right_end (Current.To->angle),
+          H = rcm_linear (rcm_left_end (Current_c.From->angle),
+                          rcm_right_end (Current_c.From->angle),
+                          rcm_left_end (Current_c.To->angle),
+                          rcm_right_end (Current_c.To->angle),
                           H * TP);
 
           H = angle_mod_2PI (H) / TP;
diff --git a/plug-ins/color-rotate/color-rotate.h b/plug-ins/color-rotate/color-rotate.h
index 883efc3..fe3698a 100644
--- a/plug-ins/color-rotate/color-rotate.h
+++ b/plug-ins/color-rotate/color-rotate.h
@@ -133,4 +133,4 @@ typedef struct
 
 /* Global variables */
 
-extern RcmParams Current;
+extern RcmParams Current_c;
diff --git a/plug-ins/file-jpeg/jpeg-load.c b/plug-ins/file-jpeg/jpeg-load.c
index 41cd2e4..ecf80e8 100644
--- a/plug-ins/file-jpeg/jpeg-load.c
+++ b/plug-ins/file-jpeg/jpeg-load.c
@@ -343,7 +343,6 @@ load_image (const gchar  *filename,
           exif_data_unref (exif_data);
           exif_data = NULL;
         }
-#endif
 
       /* Step 5.2: check for XMP metadata in APP1 markers (after EXIF) */
       for (marker = cinfo.marker_list; marker; marker = marker->next)
@@ -382,6 +381,7 @@ load_image (const gchar  *filename,
               g_free (xmp_packet);
             }
         }
+#endif
 
       /* Step 5.3: check for an embedded ICC profile in APP2 markers */
       jpeg_icc_read_profile (&cinfo, &profile, &profile_size);
diff --git a/tools/pdbgen/Makefile.am b/tools/pdbgen/Makefile.am
index 4c98901..fda88fb 100644
--- a/tools/pdbgen/Makefile.am
+++ b/tools/pdbgen/Makefile.am
@@ -33,6 +33,7 @@ pdb_sources = \
 	pdb/item_transform.pdb		\
 	pdb/layer.pdb			\
 	pdb/message.pdb			\
+	pdb/metadata.pdb		\
 	pdb/paint_tools.pdb		\
 	pdb/palette.pdb			\
 	pdb/palette_select.pdb		\
diff --git a/tools/pdbgen/pdb/metadata.pdb b/tools/pdbgen/pdb/metadata.pdb
new file mode 100644
index 0000000..51c79e0
--- /dev/null
+++ b/tools/pdbgen/pdb/metadata.pdb
@@ -0,0 +1,85 @@
+# GIMP - The GNU Image Manipulation Program
+# Copyright (C) 1995 Spencer Kimball and Peter Mattis
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# "Perlized" from C source by Manish Singh <yosh@gimp.org>
+
+sub image_metadata_get {
+    $blurb = 'Returns images metadata.';
+    $help  = 'Returns exif/iptc/xmp metadata from image.';
+
+    &std_pdb_misc('2013', '2.9');
+
+    @inargs = (
+   { name => 'image', type => 'image',
+     desc => 'The image' }
+    );
+
+    @outargs = (
+	{ name => 'metadata_string', type => 'string',
+	  desc => 'The exif/ptc/xmp metadata as a string'}
+    );
+
+    %invoke = (
+	code => <<'CODE'
+{
+  GExiv2Metadata *metadata;
+  metadata = gimp_image_get_metadata (image);
+  metadata_string = gimp_image_metadata_serialize (metadata);
+}
+CODE
+    );
+}
+
+sub image_metadata_set {
+    $blurb = 'set images metadata.';
+    $help  = 'Sets exif/iptc/xmp metadata to image.';
+
+    &std_pdb_misc('2013', '2.9');
+
+    @inargs = (
+  { name => 'image', type => 'image',
+    desc => 'The image' },
+	{ name => 'metadata_string', type => 'string',
+	  desc => 'The exif/ptc/xmp metadata as a string' }
+    );
+
+    %invoke = (
+	code => <<'CODE'
+{
+  GExiv2Metadata *metadata;
+  metadata = gimp_image_metadata_deserialize (metadata_string);
+  gimp_image_set_metadata (image, metadata);
+}
+CODE
+    );
+}
+
+@headers = qw("core/gimp.h"
+              "core/gimpimage.h"
+              "core/gimpimage-metadata.h"
+              <gexiv2/gexiv2.h>);
+
+@procs = qw(image_metadata_get
+            image_metadata_set);
+
+%exports = (app => [@procs], lib => [@procs]);
+
+$desc = 'Metadata';
+$doc_title = 'gimpimagemetadata';
+$doc_short_desc = 'Metadata procedures';
+$doc_long_desc = 'Metadata procedures.';
+
+1;
