app, libgimp, libgimpbase: new gimp_export_(exif|xmp|iptc)() functions.

These allows plug-ins to know the preferences regarding metadata.
This commit is contained in:
Jehan 2018-01-11 05:14:07 +01:00
parent c49b8463bd
commit 4c4fa84f85
5 changed files with 72 additions and 12 deletions

View file

@ -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;

View file

@ -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;
@ -1375,6 +1378,57 @@ gimp_show_help_button (void)
return _show_help_button;
}
/**
* 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:
*
@ -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);

View file

@ -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;

View file

@ -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,

View file

@ -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;