[gimp] app: save compatibility mode data in a parasite.
- From: Jehan Pagès <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: save compatibility mode data in a parasite.
- Date: Tue, 1 Sep 2015 17:29:39 +0000 (UTC)
commit cb84d4bd7e7ea599bca622fc1419c150edc3825e
Author: Jehan <jehan girinstud io>
Date: Tue Sep 1 16:16:41 2015 +0200
app: save compatibility mode data in a parasite.
If one explicitely enabled the compat mode on an image, we should assume
this mode should be reused upon following saves, even after shutdown.
app/xcf/xcf-load.c | 11 +++++++++++
app/xcf/xcf-save.c | 29 +++++++++++++++++++++++++----
2 files changed, 36 insertions(+), 4 deletions(-)
---
diff --git a/app/xcf/xcf-load.c b/app/xcf/xcf-load.c
index 71326e4..9539cd1 100644
--- a/app/xcf/xcf-load.c
+++ b/app/xcf/xcf-load.c
@@ -363,6 +363,17 @@ xcf_load_image (Gimp *gimp,
gimp_parasite_name (parasite));
}
+ /* check for a gimp-compatibility-mode parasite */
+ parasite = gimp_image_parasite_find (GIMP_IMAGE (image),
+ "gimp-compatibility-mode");
+ if (parasite)
+ {
+ GimpImagePrivate *private = GIMP_IMAGE_GET_PRIVATE (image);
+
+ gimp_image_set_xcf_compat_mode (image, TRUE);
+ gimp_parasite_list_remove (private->parasites,
+ gimp_parasite_name (parasite));
+ }
xcf_progress_update (info);
while (TRUE)
diff --git a/app/xcf/xcf-save.c b/app/xcf/xcf-save.c
index 7d25229..855539c 100644
--- a/app/xcf/xcf-save.c
+++ b/app/xcf/xcf-save.c
@@ -337,10 +337,11 @@ xcf_save_image_props (XcfInfo *info,
GimpImage *image,
GError **error)
{
- GimpImagePrivate *private = GIMP_IMAGE_GET_PRIVATE (image);
- GimpParasite *grid_parasite = NULL;
- GimpParasite *meta_parasite = NULL;
- GimpUnit unit = gimp_image_get_unit (image);
+ GimpImagePrivate *private = GIMP_IMAGE_GET_PRIVATE (image);
+ GimpParasite *grid_parasite = NULL;
+ GimpParasite *meta_parasite = NULL;
+ GimpParasite *compat_parasite = NULL;
+ GimpUnit unit = gimp_image_get_unit (image);
gdouble xres;
gdouble yres;
@@ -410,6 +411,20 @@ xcf_save_image_props (XcfInfo *info,
}
}
+ if (gimp_image_get_xcf_compat_mode (image))
+ {
+ gint gimp_version;
+
+ /* Save the GIMP version we are trying to get compatible with.
+ * This specific information is unused as of now though. */
+ gimp_image_get_xcf_version (image, FALSE, &gimp_version, NULL);
+ compat_parasite = gimp_parasite_new ("gimp-compatibility-mode",
+ GIMP_PARASITE_PERSISTENT,
+ sizeof (gimp_version),
+ &gimp_version);
+ gimp_parasite_list_add (private->parasites, compat_parasite);
+ }
+
if (gimp_parasite_list_length (private->parasites) > 0)
{
xcf_check_error (xcf_save_prop (info, image, PROP_PARASITES, error,
@@ -430,6 +445,12 @@ xcf_save_image_props (XcfInfo *info,
gimp_parasite_free (meta_parasite);
}
+ if (compat_parasite)
+ {
+ gimp_parasite_list_remove (private->parasites,
+ gimp_parasite_name (compat_parasite));
+ gimp_parasite_free (compat_parasite);
+ }
xcf_check_error (xcf_save_prop (info, image, PROP_END, error));
return TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]