[gimp/wip/bug790552-metadata-preferences: 2/4] app, libgimp, libgimpbase: new gimp_export_(exif|xmp|iptc)() functions.



commit 68b12a380a2624d37e7d1e5ef5674536a77dc5a8
Author: Jehan <jehan girinstud io>
Date:   Thu Jan 11 05:14:07 2018 +0100

    app, libgimp, libgimpbase: new gimp_export_(exif|xmp|iptc)() functions.
    
    These allows plug-ins to know the preferences regarding metadata.

 app/plug-in/gimppluginmanager-call.c |    6 ++--
 libgimp/gimp.c                       |   57 ++++++++++++++++++++++++++++++++++
 libgimp/gimp.h                       |    3 ++
 libgimpbase/gimpprotocol.c           |   12 +++---
 libgimpbase/gimpprotocol.h           |    6 ++--
 5 files changed, 72 insertions(+), 12 deletions(-)
---
diff --git a/app/plug-in/gimppluginmanager-call.c b/app/plug-in/gimppluginmanager-call.c
index a78a45d..680b354 100644
--- a/app/plug-in/gimppluginmanager-call.c
+++ b/app/plug-in/gimppluginmanager-call.c
@@ -206,9 +206,9 @@ gimp_plug_in_manager_call_run (GimpPlugInManager   *manager,
                                  gui_config->show_help_button);
       config.use_cpu_accel    = manager->gimp->use_cpu_accel;
       config.use_opencl       = gegl_config->use_opencl;
-      config.gimp_reserved_6  = 0;
-      config.gimp_reserved_7  = 0;
-      config.gimp_reserved_8  = 0;
+      config.export_exif      = core_config->export_metadata_exif;
+      config.export_xmp       = core_config->export_metadata_xmp;
+      config.export_iptc      = core_config->export_metadata_iptc;
       config.install_cmap     = FALSE;
       config.show_tooltips    = gui_config->show_tooltips;
       config.min_colors       = 144;
diff --git a/libgimp/gimp.c b/libgimp/gimp.c
index 2080137..98a2b53 100644
--- a/libgimp/gimp.c
+++ b/libgimp/gimp.c
@@ -195,6 +195,9 @@ static const gdouble  _gamma_val         = 2.2;
 static gboolean       _install_cmap      = FALSE;
 static gboolean       _show_tool_tips    = TRUE;
 static gboolean       _show_help_button  = TRUE;
+static gboolean       _export_exif       = FALSE;
+static gboolean       _export_xmp        = FALSE;
+static gboolean       _export_iptc       = FALSE;
 static GimpCheckSize  _check_size        = GIMP_CHECK_SIZE_MEDIUM_CHECKS;
 static GimpCheckType  _check_type        = GIMP_CHECK_TYPE_GRAY_CHECKS;
 static gint           _min_colors        = 144;
@@ -1376,6 +1379,57 @@ gimp_show_help_button (void)
 }
 
 /**
+ * gimp_export_exif:
+ *
+ * Returns whether file plug-ins should default to exporting Exif
+ * metadata, according preferences (original settings is #FALSE since
+ * metadata can contain sensitive information).
+ *
+ * Return value: TRUE if preferences are set to export Exif.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_export_exif (void)
+{
+  return _export_exif;
+}
+
+/**
+ * gimp_export_xmp:
+ *
+ * Returns whether file plug-ins should default to exporting XMP
+ * metadata, according preferences (original settings is #FALSE since
+ * metadata can contain sensitive information).
+ *
+ * Return value: TRUE if preferences are set to export XMP.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_export_xmp (void)
+{
+  return _export_xmp;
+}
+
+/**
+ * gimp_export_iptc:
+ *
+ * Returns whether file plug-ins should default to exporting IPTC
+ * metadata, according preferences (original settings is #FALSE since
+ * metadata can contain sensitive information).
+ *
+ * Return value: TRUE if preferences are set to export IPTC.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_export_iptc (void)
+{
+  return _export_iptc;
+}
+
+/**
  * gimp_check_size:
  *
  * Returns the size of the checkerboard to be used in previews.
@@ -2054,6 +2108,9 @@ gimp_config (GPConfig *config)
   _install_cmap     = config->install_cmap     ? TRUE : FALSE;
   _show_tool_tips   = config->show_tooltips    ? TRUE : FALSE;
   _show_help_button = config->show_help_button ? TRUE : FALSE;
+  _export_exif      = config->export_exif      ? TRUE : FALSE;
+  _export_xmp       = config->export_xmp       ? TRUE : FALSE;
+  _export_iptc      = config->export_iptc      ? TRUE : FALSE;
   _min_colors       = config->min_colors;
   _gdisp_ID         = config->gdisp_ID;
   _wm_class         = g_strdup (config->wm_class);
diff --git a/libgimp/gimp.h b/libgimp/gimp.h
index 6c07092..087c5d7 100644
--- a/libgimp/gimp.h
+++ b/libgimp/gimp.h
@@ -326,6 +326,9 @@ guchar       * gimp_shm_addr            (void) G_GNUC_CONST;
 gdouble        gimp_gamma               (void) G_GNUC_CONST;
 gboolean       gimp_show_tool_tips      (void) G_GNUC_CONST;
 gboolean       gimp_show_help_button    (void) G_GNUC_CONST;
+gboolean       gimp_export_exif         (void) G_GNUC_CONST;
+gboolean       gimp_export_xmp          (void) G_GNUC_CONST;
+gboolean       gimp_export_iptc         (void) G_GNUC_CONST;
 GimpCheckSize  gimp_check_size          (void) G_GNUC_CONST;
 GimpCheckType  gimp_check_type          (void) G_GNUC_CONST;
 gint32         gimp_default_display     (void) G_GNUC_CONST;
diff --git a/libgimpbase/gimpprotocol.c b/libgimpbase/gimpprotocol.c
index e57ac2d..0cf1d7a 100644
--- a/libgimpbase/gimpprotocol.c
+++ b/libgimpbase/gimpprotocol.c
@@ -504,15 +504,15 @@ _gp_config_read (GIOChannel      *channel,
                               user_data))
     goto cleanup;
   if (! _gimp_wire_read_int8 (channel,
-                              (guint8 *) &config->gimp_reserved_6, 1,
+                              (guint8 *) &config->export_exif, 1,
                               user_data))
     goto cleanup;
   if (! _gimp_wire_read_int8 (channel,
-                              (guint8 *) &config->gimp_reserved_7, 1,
+                              (guint8 *) &config->export_xmp, 1,
                               user_data))
     goto cleanup;
   if (! _gimp_wire_read_int8 (channel,
-                              (guint8 *) &config->gimp_reserved_8, 1,
+                              (guint8 *) &config->export_iptc, 1,
                               user_data))
     goto cleanup;
   if (! _gimp_wire_read_int8 (channel,
@@ -596,15 +596,15 @@ _gp_config_write (GIOChannel      *channel,
                                user_data))
     return;
   if (! _gimp_wire_write_int8 (channel,
-                               (const guint8 *) &config->gimp_reserved_6, 1,
+                               (const guint8 *) &config->export_exif, 1,
                                user_data))
     return;
   if (! _gimp_wire_write_int8 (channel,
-                               (const guint8 *) &config->gimp_reserved_7, 1,
+                               (const guint8 *) &config->export_xmp, 1,
                                user_data))
     return;
   if (! _gimp_wire_write_int8 (channel,
-                               (const guint8 *) &config->gimp_reserved_8, 1,
+                               (const guint8 *) &config->export_iptc, 1,
                                user_data))
     return;
   if (! _gimp_wire_write_int8 (channel,
diff --git a/libgimpbase/gimpprotocol.h b/libgimpbase/gimpprotocol.h
index e01edb3..3151f26 100644
--- a/libgimpbase/gimpprotocol.h
+++ b/libgimpbase/gimpprotocol.h
@@ -70,9 +70,9 @@ struct _GPConfig
   gint8    show_help_button;
   gint8    use_cpu_accel;
   gint8    use_opencl;
-  gint8    gimp_reserved_6;
-  gint8    gimp_reserved_7;
-  gint8    gimp_reserved_8;
+  gint8    export_exif;
+  gint8    export_xmp;
+  gint8    export_iptc;
   gint8    install_cmap;
   gint8    show_tooltips;
   gint32   min_colors;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]