[gimp/metadata-wip-rebased] libgimpbase: add gimp_metadata_duplicate()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/metadata-wip-rebased] libgimpbase: add gimp_metadata_duplicate()
- Date: Thu, 24 Oct 2013 20:45:23 +0000 (UTC)
commit 8a19f00eba146f47bcd3afa67260163841914b83
Author: Michael Natterer <mitch gimp org>
Date: Thu Oct 24 22:44:33 2013 +0200
libgimpbase: add gimp_metadata_duplicate()
libgimpbase/gimpbase.def | 1 +
libgimpbase/gimpmetadata.c | 19 +++++++++++++++++++
libgimpbase/gimpmetadata.h | 1 +
3 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/libgimpbase/gimpbase.def b/libgimpbase/gimpbase.def
index 8355008..d2bfa5a 100644
--- a/libgimpbase/gimpbase.def
+++ b/libgimpbase/gimpbase.def
@@ -51,6 +51,7 @@ EXPORTS
gimp_memsize_to_string
gimp_message_handler_type_get_type
gimp_metadata_deserialize
+ gimp_metadata_duplicate
gimp_metadata_get_resolution
gimp_metadata_is_tag_supported
gimp_metadata_load_from_file
diff --git a/libgimpbase/gimpmetadata.c b/libgimpbase/gimpmetadata.c
index ce2a944..1139233 100644
--- a/libgimpbase/gimpmetadata.c
+++ b/libgimpbase/gimpmetadata.c
@@ -148,6 +148,25 @@ gimp_metadata_new (void)
return metadata;
}
+GimpMetadata *
+gimp_metadata_duplicate (GimpMetadata *metadata)
+{
+ GimpMetadata *new_metadata = NULL;
+
+ g_return_val_if_fail (metadata == NULL || GEXIV2_IS_METADATA (metadata), NULL);
+
+ if (metadata)
+ {
+ gchar *xml;
+
+ xml = gimp_metadata_serialize (metadata);
+ new_metadata = gimp_metadata_deserialize (xml);
+ g_free (xml);
+ }
+
+ return new_metadata;
+}
+
typedef struct
{
gchar name[1024];
diff --git a/libgimpbase/gimpmetadata.h b/libgimpbase/gimpmetadata.h
index 618d73b..ee9fa40 100644
--- a/libgimpbase/gimpmetadata.h
+++ b/libgimpbase/gimpmetadata.h
@@ -40,6 +40,7 @@ typedef enum
GimpMetadata * gimp_metadata_new (void);
+GimpMetadata * gimp_metadata_duplicate (GimpMetadata *metadata);
GimpMetadata * gimp_metadata_deserialize (const gchar *metadata_xml);
gchar * gimp_metadata_serialize (GimpMetadata *metadata);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]