[gimp] plug-ins: reverse the logic for setting GimpMetadataSaveFlags
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] plug-ins: reverse the logic for setting GimpMetadataSaveFlags
- Date: Sun, 27 Oct 2013 14:40:42 +0000 (UTC)
commit a44e06d05976492b8b942af0937e00763fe5d70e
Author: Michael Natterer <mitch gimp org>
Date: Sun Oct 27 15:38:42 2013 +0100
plug-ins: reverse the logic for setting GimpMetadataSaveFlags
start with flags = ALL (which now includes all possible current and
future flags), and optionally *remove* individual flags instead of
adding them. This way the plug-ins default to TRUE for future flags.
libgimpbase/gimpmetadata.h | 9 ++-------
plug-ins/common/file-png.c | 10 +++++-----
plug-ins/common/file-tiff-save.c | 10 +++++-----
plug-ins/file-jpeg/jpeg.c | 10 +++++-----
plug-ins/file-psd/psd-save.c | 10 +++++-----
5 files changed, 22 insertions(+), 27 deletions(-)
---
diff --git a/libgimpbase/gimpmetadata.h b/libgimpbase/gimpmetadata.h
index fb83c76..03bca87 100644
--- a/libgimpbase/gimpmetadata.h
+++ b/libgimpbase/gimpmetadata.h
@@ -30,9 +30,7 @@ typedef enum
GIMP_METADATA_LOAD_RESOLUTION = 1 << 1,
GIMP_METADATA_LOAD_ORIENTATION = 1 << 2,
- GIMP_METADATA_LOAD_ALL = (GIMP_METADATA_LOAD_COMMENT |
- GIMP_METADATA_LOAD_RESOLUTION |
- GIMP_METADATA_LOAD_ORIENTATION)
+ GIMP_METADATA_LOAD_ALL = 0xffffffff
} GimpMetadataLoadFlags;
typedef enum
@@ -42,10 +40,7 @@ typedef enum
GIMP_METADATA_SAVE_IPTC = 1 << 2,
GIMP_METADATA_SAVE_THUMBNAIL = 1 << 3,
- GIMP_METADATA_SAVE_ALL = (GIMP_METADATA_SAVE_EXIF |
- GIMP_METADATA_SAVE_XMP |
- GIMP_METADATA_SAVE_IPTC |
- GIMP_METADATA_SAVE_THUMBNAIL)
+ GIMP_METADATA_SAVE_ALL = 0xffffffff
} GimpMetadataSaveFlags;
diff --git a/plug-ins/common/file-png.c b/plug-ins/common/file-png.c
index d1926a5..ba895c5 100644
--- a/plug-ins/common/file-png.c
+++ b/plug-ins/common/file-png.c
@@ -603,14 +603,14 @@ run (const gchar *name,
if (metadata)
{
GFile *file;
- GimpMetadataSaveFlags flags = 0;
+ GimpMetadataSaveFlags flags = GIMP_METADATA_SAVE_ALL;
gimp_metadata_set_bits_per_sample (metadata, 8);
- if (pngvals.save_exif) flags |= GIMP_METADATA_SAVE_EXIF;
- if (pngvals.save_xmp) flags |= GIMP_METADATA_SAVE_XMP;
- if (pngvals.save_iptc) flags |= GIMP_METADATA_SAVE_IPTC;
- if (pngvals.save_thumbnail) flags |= GIMP_METADATA_SAVE_THUMBNAIL;
+ if (! pngvals.save_exif) flags &= ~GIMP_METADATA_SAVE_EXIF;
+ if (! pngvals.save_xmp) flags &= ~GIMP_METADATA_SAVE_XMP;
+ if (! pngvals.save_iptc) flags &= ~GIMP_METADATA_SAVE_IPTC;
+ if (! pngvals.save_thumbnail) flags &= ~GIMP_METADATA_SAVE_THUMBNAIL;
file = g_file_new_for_path (param[3].data.d_string);
gimp_image_metadata_save_finish (image_ID,
diff --git a/plug-ins/common/file-tiff-save.c b/plug-ins/common/file-tiff-save.c
index 03c36ad..e93f5e0 100644
--- a/plug-ins/common/file-tiff-save.c
+++ b/plug-ins/common/file-tiff-save.c
@@ -369,14 +369,14 @@ run (const gchar *name,
if (metadata)
{
GFile *file;
- GimpMetadataSaveFlags flags = 0;
+ GimpMetadataSaveFlags flags = GIMP_METADATA_SAVE_ALL;
gimp_metadata_set_bits_per_sample (metadata, saved_bpp);
- if (tsvals.save_exif) flags |= GIMP_METADATA_SAVE_EXIF;
- if (tsvals.save_xmp) flags |= GIMP_METADATA_SAVE_XMP;
- if (tsvals.save_iptc) flags |= GIMP_METADATA_SAVE_IPTC;
- if (tsvals.save_thumbnail) flags |= GIMP_METADATA_SAVE_THUMBNAIL;
+ if (! tsvals.save_exif) flags &= ~GIMP_METADATA_SAVE_EXIF;
+ if (! tsvals.save_xmp) flags &= ~GIMP_METADATA_SAVE_XMP;
+ if (! tsvals.save_iptc) flags &= ~GIMP_METADATA_SAVE_IPTC;
+ if (! tsvals.save_thumbnail) flags &= ~GIMP_METADATA_SAVE_THUMBNAIL;
file = g_file_new_for_path (param[3].data.d_string);
gimp_image_metadata_save_finish (image,
diff --git a/plug-ins/file-jpeg/jpeg.c b/plug-ins/file-jpeg/jpeg.c
index 176485a..39e15ed 100644
--- a/plug-ins/file-jpeg/jpeg.c
+++ b/plug-ins/file-jpeg/jpeg.c
@@ -520,14 +520,14 @@ run (const gchar *name,
if (metadata)
{
GFile *file;
- GimpMetadataSaveFlags flags = 0;
+ GimpMetadataSaveFlags flags = GIMP_METADATA_SAVE_ALL;
gimp_metadata_set_bits_per_sample (metadata, 8);
- if (jsvals.save_exif) flags |= GIMP_METADATA_SAVE_EXIF;
- if (jsvals.save_xmp) flags |= GIMP_METADATA_SAVE_XMP;
- if (jsvals.save_iptc) flags |= GIMP_METADATA_SAVE_IPTC;
- if (jsvals.save_thumbnail) flags |= GIMP_METADATA_SAVE_THUMBNAIL;
+ if (! jsvals.save_exif) flags &= ~GIMP_METADATA_SAVE_EXIF;
+ if (! jsvals.save_xmp) flags &= ~GIMP_METADATA_SAVE_XMP;
+ if (! jsvals.save_iptc) flags &= ~GIMP_METADATA_SAVE_IPTC;
+ if (! jsvals.save_thumbnail) flags &= ~GIMP_METADATA_SAVE_THUMBNAIL;
file = g_file_new_for_path (param[3].data.d_string);
gimp_image_metadata_save_finish (image_ID,
diff --git a/plug-ins/file-psd/psd-save.c b/plug-ins/file-psd/psd-save.c
index c5bf4e7..70883d1 100644
--- a/plug-ins/file-psd/psd-save.c
+++ b/plug-ins/file-psd/psd-save.c
@@ -301,14 +301,14 @@ run (const gchar *name,
if (metadata)
{
GFile *file;
- GimpMetadataSaveFlags flags = 0;
+ GimpMetadataSaveFlags flags = GIMP_METADATA_SAVE_ALL;
gimp_metadata_set_bits_per_sample (metadata, 8);
- if (TRUE) flags |= GIMP_METADATA_SAVE_EXIF;
- if (TRUE) flags |= GIMP_METADATA_SAVE_XMP;
- if (TRUE) flags |= GIMP_METADATA_SAVE_IPTC;
- if (TRUE) flags |= GIMP_METADATA_SAVE_THUMBNAIL;
+ if (FALSE) flags &= ~GIMP_METADATA_SAVE_EXIF;
+ if (FALSE) flags &= ~GIMP_METADATA_SAVE_XMP;
+ if (FALSE) flags &= ~GIMP_METADATA_SAVE_IPTC;
+ if (FALSE) flags &= ~GIMP_METADATA_SAVE_THUMBNAIL;
file = g_file_new_for_path (param[3].data.d_string);
gimp_image_metadata_save_finish (image_id,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]