Commit 1c7028aa authored by Michael Natterer's avatar Michael Natterer 😴

app, libgimp: add boolean "export-comment" gimprc property

export it to libgimp via GPConfig and add new API gimp_export_comment().
Bump the protocol version and improve variable names in both GPConfig
and libgimp/gimp.c.
parent 0b3c4969
......@@ -123,6 +123,7 @@ enum
PROP_IMPORT_RAW_PLUG_IN,
PROP_EXPORT_FILE_TYPE,
PROP_EXPORT_COLOR_PROFILE,
PROP_EXPORT_COMMENT,
PROP_EXPORT_METADATA_EXIF,
PROP_EXPORT_METADATA_XMP,
PROP_EXPORT_METADATA_IPTC,
......@@ -734,6 +735,13 @@ gimp_core_config_class_init (GimpCoreConfigClass *klass)
TRUE,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_EXPORT_COMMENT,
"export-comment",
"Export Comment",
EXPORT_COMMENT_BLURB,
TRUE,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_EXPORT_METADATA_EXIF,
"export-metadata-exif",
"Export Exif metadata",
......@@ -1069,6 +1077,9 @@ gimp_core_config_set_property (GObject *object,
case PROP_EXPORT_COLOR_PROFILE:
core_config->export_color_profile = g_value_get_boolean (value);
break;
case PROP_EXPORT_COMMENT:
core_config->export_comment = g_value_get_boolean (value);
break;
case PROP_EXPORT_METADATA_EXIF:
core_config->export_metadata_exif = g_value_get_boolean (value);
break;
......@@ -1277,6 +1288,9 @@ gimp_core_config_get_property (GObject *object,
case PROP_EXPORT_COLOR_PROFILE:
g_value_set_boolean (value, core_config->export_color_profile);
break;
case PROP_EXPORT_COMMENT:
g_value_set_boolean (value, core_config->export_comment);
break;
case PROP_EXPORT_METADATA_EXIF:
g_value_set_boolean (value, core_config->export_metadata_exif);
break;
......
......@@ -98,6 +98,7 @@ struct _GimpCoreConfig
gchar *import_raw_plug_in;
GimpExportFileType export_file_type;
gboolean export_color_profile;
gboolean export_comment;
gboolean export_metadata_exif;
gboolean export_metadata_xmp;
gboolean export_metadata_iptc;
......
......@@ -217,6 +217,9 @@ _("Export file type used by default.")
#define EXPORT_COLOR_PROFILE_BLURB \
_("Export the image's color profile by default.")
#define EXPORT_COMMENT_BLURB \
_("Export the image's comment by default.")
/* Translators: tooltip for configuration option (checkbox).
* It determines how file export plug-ins handle Exif by default.
*/
......
......@@ -1527,6 +1527,9 @@ prefs_dialog_new (Gimp *gimp,
button = prefs_check_button_add (object, "export-color-profile",
_("Export the i_mage's color profile by default"),
GTK_BOX (vbox2));
button = prefs_check_button_add (object, "export-comment",
_("Export the image's comment by default"),
GTK_BOX (vbox2));
button = prefs_check_button_add (object, "export-metadata-exif",
/* Translators: label for
* configuration option (checkbox).
......
......@@ -200,35 +200,37 @@ gimp_plug_in_manager_call_run (GimpPlugInManager *manager,
icon_theme_dir = gimp_get_icon_theme_dir (manager->gimp);
config.tile_width = GIMP_PLUG_IN_TILE_WIDTH;
config.tile_height = GIMP_PLUG_IN_TILE_HEIGHT;
config.shm_id = (manager->shm ?
gimp_plug_in_shm_get_id (manager->shm) : -1);
config.check_size = display_config->transparency_size;
config.check_type = display_config->transparency_type;
config.show_help_button = (gui_config->use_help &&
gui_config->show_help_button);
config.use_cpu_accel = manager->gimp->use_cpu_accel;
config.use_opencl = gegl_config->use_opencl;
config.export_profile = core_config->export_color_profile;
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.gdisp_id = display_id;
config.app_name = (gchar *) g_get_application_name ();
config.wm_class = (gchar *) gimp_get_program_class (manager->gimp);
config.display_name = gimp_get_display_name (manager->gimp,
display_id,
&monitor,
&config.monitor_number);
config.timestamp = gimp_get_user_time (manager->gimp);
config.icon_theme_dir = icon_theme_dir ?
g_file_get_path (icon_theme_dir) :
NULL;
config.tile_cache_size = gegl_config->tile_cache_size;
config.swap_path = gegl_config->swap_path;
config.swap_compression = gegl_config->swap_compression;
config.num_processors = gegl_config->num_processors;
config.tile_width = GIMP_PLUG_IN_TILE_WIDTH;
config.tile_height = GIMP_PLUG_IN_TILE_HEIGHT;
config.shm_id = (manager->shm ?
gimp_plug_in_shm_get_id (manager->shm) :
-1);
config.check_size = display_config->transparency_size;
config.check_type = display_config->transparency_type;
config.show_help_button = (gui_config->use_help &&
gui_config->show_help_button);
config.use_cpu_accel = manager->gimp->use_cpu_accel;
config.use_opencl = gegl_config->use_opencl;
config.export_color_profile = core_config->export_color_profile;
config.export_comment = core_config->export_comment;
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.default_display_id = display_id;
config.app_name = (gchar *) g_get_application_name ();
config.wm_class = (gchar *) gimp_get_program_class (manager->gimp);
config.display_name = gimp_get_display_name (manager->gimp,
display_id,
&monitor,
&config.monitor_number);
config.timestamp = gimp_get_user_time (manager->gimp);
config.icon_theme_dir = (icon_theme_dir ?
g_file_get_path (icon_theme_dir) :
NULL);
config.tile_cache_size = gegl_config->tile_cache_size;
config.swap_path = gegl_config->swap_path;
config.swap_compression = gegl_config->swap_compression;
config.num_processors = gegl_config->num_processors;
proc_run.name = (gchar *) gimp_object_get_name (procedure);
proc_run.n_params = gimp_value_array_length (args);
......
......@@ -134,27 +134,28 @@ static void gimp_plugin_sigfatal_handler (gint sig_num);
#endif /* G_OS_WIN32 */
static GimpPlugIn *PLUG_IN = NULL;
static GimpPDB *PDB = NULL;
static gint _tile_width = -1;
static gint _tile_height = -1;
static gboolean _show_help_button = TRUE;
static gboolean _export_profile = FALSE;
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 _gdisp_id = -1;
static gchar *_wm_class = NULL;
static gchar *_display_name = NULL;
static gint _monitor_number = 0;
static guint32 _timestamp = 0;
static gchar *_icon_theme_dir = NULL;
static const gchar *progname = NULL;
static GimpStackTraceMode stack_trace_mode = GIMP_STACK_TRACE_NEVER;
static GimpPlugIn *PLUG_IN = NULL;
static GimpPDB *PDB = NULL;
static gint _tile_width = -1;
static gint _tile_height = -1;
static gboolean _show_help_button = TRUE;
static gboolean _export_color_profile = FALSE;
static gboolean _export_comment = FALSE;
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 _default_display_id = -1;
static gchar *_wm_class = NULL;
static gchar *_display_name = NULL;
static gint _monitor_number = 0;
static guint32 _timestamp = 0;
static gchar *_icon_theme_dir = NULL;
static const gchar *progname = NULL;
static GimpStackTraceMode stack_trace_mode = GIMP_STACK_TRACE_NEVER;
/**
......@@ -711,7 +712,23 @@ gimp_show_help_button (void)
gboolean
gimp_export_color_profile (void)
{
return _export_profile;
return _export_color_profile;
}
/**
* gimp_export_comment:
*
* Returns whether file plug-ins should default to exporting the
* image's comment.
*
* Returns: TRUE if preferences are set to export the comment.
*
* Since: 3.0
**/
gboolean
gimp_export_comment (void)
{
return _export_comment;
}
/**
......@@ -813,7 +830,7 @@ gimp_check_type (void)
GimpDisplay *
gimp_default_display (void)
{
return gimp_display_get_by_id (_gdisp_id);
return gimp_display_get_by_id (_default_display_id);
}
/**
......@@ -1105,21 +1122,21 @@ _gimp_config (GPConfig *config)
GFile *file;
gchar *path;
_tile_width = config->tile_width;
_tile_height = config->tile_height;
_check_size = config->check_size;
_check_type = config->check_type;
_show_help_button = config->show_help_button ? TRUE : FALSE;
_export_profile = config->export_profile ? TRUE : FALSE;
_export_exif = config->export_exif ? TRUE : FALSE;
_export_xmp = config->export_xmp ? TRUE : FALSE;
_export_iptc = config->export_iptc ? TRUE : FALSE;
_gdisp_id = config->gdisp_id;
_wm_class = g_strdup (config->wm_class);
_display_name = g_strdup (config->display_name);
_monitor_number = config->monitor_number;
_timestamp = config->timestamp;
_icon_theme_dir = g_strdup (config->icon_theme_dir);
_tile_width = config->tile_width;
_tile_height = config->tile_height;
_check_size = config->check_size;
_check_type = config->check_type;
_show_help_button = config->show_help_button ? TRUE : FALSE;
_export_color_profile = config->export_color_profile ? TRUE : FALSE;
_export_exif = config->export_exif ? TRUE : FALSE;
_export_xmp = config->export_xmp ? TRUE : FALSE;
_export_iptc = config->export_iptc ? TRUE : FALSE;
_default_display_id = config->default_display_id;
_wm_class = g_strdup (config->wm_class);
_display_name = g_strdup (config->display_name);
_monitor_number = config->monitor_number;
_timestamp = config->timestamp;
_icon_theme_dir = g_strdup (config->icon_theme_dir);
if (config->app_name)
g_set_application_name (config->app_name);
......
......@@ -255,6 +255,7 @@ EXPORTS
gimp_eraser
gimp_eraser_default
gimp_export_color_profile
gimp_export_comment
gimp_export_exif
gimp_export_iptc
gimp_export_xmp
......
......@@ -172,6 +172,7 @@ guint gimp_tile_width (void) G_GNUC_CONST;
guint gimp_tile_height (void) G_GNUC_CONST;
gboolean gimp_show_help_button (void) G_GNUC_CONST;
gboolean gimp_export_color_profile (void) G_GNUC_CONST;
gboolean gimp_export_comment (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;
......
......@@ -506,7 +506,11 @@ _gp_config_read (GIOChannel *channel,
user_data))
goto cleanup;
if (! _gimp_wire_read_int8 (channel,
(guint8 *) &config->export_profile, 1,
(guint8 *) &config->export_color_profile, 1,
user_data))
goto cleanup;
if (! _gimp_wire_read_int8 (channel,
(guint8 *) &config->export_comment, 1,
user_data))
goto cleanup;
if (! _gimp_wire_read_int8 (channel,
......@@ -522,7 +526,8 @@ _gp_config_read (GIOChannel *channel,
user_data))
goto cleanup;
if (! _gimp_wire_read_int32 (channel,
(guint32 *) &config->gdisp_id, 1, user_data))
(guint32 *) &config->default_display_id, 1,
user_data))
goto cleanup;
if (! _gimp_wire_read_string (channel,
......@@ -609,7 +614,11 @@ _gp_config_write (GIOChannel *channel,
user_data))
return;
if (! _gimp_wire_write_int8 (channel,
(const guint8 *) &config->export_profile, 1,
(const guint8 *) &config->export_color_profile, 1,
user_data))
return;
if (! _gimp_wire_write_int8 (channel,
(const guint8 *) &config->export_comment, 1,
user_data))
return;
if (! _gimp_wire_write_int8 (channel,
......@@ -625,7 +634,7 @@ _gp_config_write (GIOChannel *channel,
user_data))
return;
if (! _gimp_wire_write_int32 (channel,
(const guint32 *) &config->gdisp_id, 1,
(const guint32 *) &config->default_display_id, 1,
user_data))
return;
if (! _gimp_wire_write_string (channel,
......
......@@ -26,7 +26,7 @@ G_BEGIN_DECLS
/* Increment every time the protocol changes
*/
#define GIMP_PROTOCOL_VERSION 0x010D
#define GIMP_PROTOCOL_VERSION 0x010E
enum
......@@ -109,11 +109,12 @@ struct _GPConfig
gint8 show_help_button;
gint8 use_cpu_accel;
gint8 use_opencl;
gint8 export_profile;
gint8 export_color_profile;
gint8 export_comment;
gint8 export_exif;
gint8 export_xmp;
gint8 export_iptc;
gint32 gdisp_id;
gint32 default_display_id;
gchar *app_name;
gchar *wm_class;
gchar *display_name;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment