From 7230d2673c89e4e7b29d5ca43a7a12b94c6a8168 Mon Sep 17 00:00:00 2001 From: Roman Joost Date: Sat, 20 Jun 2009 22:16:55 +1000 Subject: [PATCH 1/4] Merges the exif-data to the xmp-model. Added a function to merge the Exif data into the xmp model. The function is using the image id and to access the Exif data parasite. For each Exif property a corresponding value in the XMP model is created. --- plug-ins/file-jpeg/gimpexif.c | 10 +++ plug-ins/metadata/Makefile.am | 12 ++-- plug-ins/metadata/exif-decode.c | 84 ++++++++++++++++++++++ plug-ins/metadata/exif-decode.h | 35 ++++++++++ plug-ins/metadata/metadata.c | 119 +++++++++++++++++--------------- 5 files changed, 200 insertions(+), 60 deletions(-) create mode 100644 plug-ins/metadata/exif-decode.c create mode 100644 plug-ins/metadata/exif-decode.h diff --git a/plug-ins/file-jpeg/gimpexif.c b/plug-ins/file-jpeg/gimpexif.c index 57cccab626..7f4f752ede 100644 --- a/plug-ins/file-jpeg/gimpexif.c +++ b/plug-ins/file-jpeg/gimpexif.c @@ -50,6 +50,8 @@ void gimp_metadata_store_exif (gint32 image_ID, ExifData *exif_data) { + GimpParam *return_vals; + gint nreturn_vals; GimpParasite *parasite = NULL; guchar *exif_buf = NULL; guint exif_buf_len = 0; @@ -64,6 +66,14 @@ void gimp_metadata_store_exif (gint32 image_ID, gimp_image_parasite_attach (image_ID, parasite); gimp_parasite_free (parasite); } + return_vals = gimp_run_procedure ("plug-in-metadata-decode-exif", + &nreturn_vals, + GIMP_PDB_IMAGE, image_ID, + GIMP_PDB_INT32, exif_data->size, + GIMP_PDB_INT8ARRAY, exif_data, + GIMP_PDB_END); + if (return_vals[0].data.d_status != GIMP_PDB_SUCCESS) + g_warning ("JPEG Exif -> XMP Merge failed"); free (exif_buf); } diff --git a/plug-ins/metadata/Makefile.am b/plug-ins/metadata/Makefile.am index dd9bb3d122..78bbb6702c 100644 --- a/plug-ins/metadata/Makefile.am +++ b/plug-ins/metadata/Makefile.am @@ -30,11 +30,11 @@ metadata_SOURCES = \ xmp-encode.h \ xmp-encode.c \ xmp-schemas.h \ - xmp-schemas.c -# interface.h \ -# interface.c \ -# exif-decode.h \ -# exif-decode.c \ + xmp-schemas.c \ + interface.h \ + interface.c \ + exif-decode.h \ + exif-decode.c # exif-encode.h \ # exif-encode.c \ # iptc-decode.h \ @@ -56,10 +56,12 @@ INCLUDES = \ LDADD = \ $(libgimp) \ + $(libgimpui) \ $(libgimpconfig) \ $(libgimpcolor) \ $(libgimpbase) \ $(libgimpmath) \ + $(EXIF_LIBS) \ $(GTK_LIBS) \ $(RT_LIBS) \ $(INTLLIBS) diff --git a/plug-ins/metadata/exif-decode.c b/plug-ins/metadata/exif-decode.c new file mode 100644 index 0000000000..7e0968a948 --- /dev/null +++ b/plug-ins/metadata/exif-decode.c @@ -0,0 +1,84 @@ +/* exif-decode.c - decodes exif data and converts it to XMP + * + * Copyright (C) 2004-2005, Róman Joost + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include + +#include + +#include + +#include + +#include + +#include "xmp-model.h" +#include "xmp-schemas.h" + +#include "exif-decode.h" + +/* prototypes of local functions */ +// static void exif_iter_content (XMPModel *xmp_model, +// ExifData *data); +static void exif_foreach_content_cb (ExifContent *content, + XMPModel *xmp_model); +static void exif_foreach_entry_cb (ExifEntry *entry, + XMPModel *xmp_model); + + +gboolean +xmp_merge_from_exifbuffer (XMPModel *xmp_model, + gint32 image_ID, + GError **error) +{ + ExifData *exif_data; + GimpParasite *parasite = gimp_image_parasite_find(image_ID, "exif-data"); + + if (parasite) + { + g_warning ("Found parasite, extracting exif"); + exif_data = exif_data_new_from_data (gimp_parasite_data (parasite), + gimp_parasite_data_size (parasite)); + if (exif_data) { + exif_data_foreach_content (exif_data, + (void *) exif_foreach_content_cb, + xmp_model); + } else { + g_printerr ("\nSomething went wrong, when reading from buffer.\n"); + return FALSE; + } + } + + return TRUE; +} + +static void +exif_foreach_content_cb (ExifContent *content, + XMPModel *xmp_model) +{ + exif_content_foreach_entry (content, (void *) exif_foreach_entry_cb, xmp_model); +} + +static void +exif_foreach_entry_cb (ExifEntry *entry, + XMPModel *xmp_model) +{ + g_printerr ("\nWuff! Wuff!:"); + +} diff --git a/plug-ins/metadata/exif-decode.h b/plug-ins/metadata/exif-decode.h new file mode 100644 index 0000000000..80f9791356 --- /dev/null +++ b/plug-ins/metadata/exif-decode.h @@ -0,0 +1,35 @@ +/* exif-decode.h - decode exif data and convert it to XMP + * + * Copyright (C) 2008, Róman Joost + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ +#ifndef EXIF_DECODE_H +#define EXIF_DECODE_H + +G_BEGIN_DECLS + +gboolean exif_merge_to_xmp (XMPModel *xmp_model, + const gchar *filename, + GError **error); + +gboolean xmp_merge_from_exifbuffer (XMPModel *xmp_model, + gint32 image_ID, + GError **error); + +G_END_DECLS + +#endif /* EXIF_DECODE_H */ diff --git a/plug-ins/metadata/metadata.c b/plug-ins/metadata/metadata.c index c45c30c278..78fc7d59cf 100644 --- a/plug-ins/metadata/metadata.c +++ b/plug-ins/metadata/metadata.c @@ -23,14 +23,16 @@ #include +#include + #include "libgimp/stdplugins-intl.h" #include "metadata.h" #include "xmp-encode.h" -/* FIXME: uncomment when these are working #include "interface.h" #include "exif-decode.h" +/* FIXME: uncomment when these are working #include "exif-encode.h" #include "iptc-decode.h" */ @@ -65,14 +67,12 @@ MAIN () static void query (void) { -/* FIXME: uncomment when these are working static const GimpParamDef editor_args[] = { { GIMP_PDB_INT32, "run-mode", "The run mode { RUN-INTERACTIVE (0), RUN-NONINTERACTIVE (1) }" }, { GIMP_PDB_IMAGE, "image", "Input image" }, { GIMP_PDB_DRAWABLE, "drawable", "Input drawable (unused)" } }; -*/ static const GimpParamDef decode_xmp_args[] = { @@ -89,7 +89,6 @@ query (void) { GIMP_PDB_STRING, "xmp", "XMP packet" } }; -/* FIXME: uncomment when these are working static const GimpParamDef decode_exif_args[] = { { GIMP_PDB_IMAGE, "image", "Input image" }, @@ -97,6 +96,7 @@ query (void) { GIMP_PDB_INT8ARRAY, "exif", "EXIF block" } }; +/* FIXME: uncomment when these are working static const GimpParamDef encode_exif_args[] = { { GIMP_PDB_IMAGE, "image", "Input image" } @@ -179,17 +179,16 @@ query (void) { GIMP_PDB_INT32, "overwrite", "Overwrite existing file: { FALSE (0), TRUE (1) }" } }; -/* FIXME: uncomment when these are working gimp_install_procedure (EDITOR_PROC, - N_("View and edit metadata (EXIF, IPTC, XMP)"), + N_("View and edit metadata (EXIF, IPTC, XMP)"), "View and edit metadata information attached to the " "current image. This can include EXIF, IPTC and/or " "XMP information. Some or all of this metadata " "will be saved in the file, depending on the output " "file format.", - "Raphaël Quinet ", - "Raphaël Quinet ", - "2004-2005", + "Raphaël Quinet ", + "Raphaël Quinet ", + "2004-2005", N_("Propert_ies"), "RGB*, INDEXED*, GRAY*", GIMP_PLUGIN, @@ -197,18 +196,17 @@ query (void) editor_args, NULL); gimp_plugin_menu_register (EDITOR_PROC, "/File/Info"); - gimp_plugin_icon_register (EDITOR_PROC, GIMP_ICON_TYPE_STOCK_ID, - */ + // XXX gimp_plugin_icon_register (EDITOR_PROC, GIMP_ICON_TYPE_STOCK_ID, gimp_install_procedure (DECODE_XMP_PROC, - "Decode an XMP packet", + "Decode an XMP packet", "Parse an XMP packet and merge the results with " "any metadata already attached to the image. This " "should be used when an XMP packet is read from an " "image file.", - "Raphaël Quinet ", - "Raphaël Quinet ", - "2005", + "Raphaël Quinet ", + "Raphaël Quinet ", + "2005", NULL, NULL, GIMP_PLUGIN, @@ -216,13 +214,13 @@ query (void) decode_xmp_args, NULL); gimp_install_procedure (ENCODE_XMP_PROC, - "Encode metadata into an XMP packet", + "Encode metadata into an XMP packet", "Generate an XMP packet from the metadata " "information attached to the image. The new XMP " "packet can then be saved into a file.", - "Raphaël Quinet ", - "Raphaël Quinet ", - "2005", + "Róman Joost ", + "Róman Joost ", + "2008", NULL, NULL, GIMP_PLUGIN, @@ -230,30 +228,30 @@ query (void) G_N_ELEMENTS (encode_xmp_return_vals), encode_xmp_args, encode_xmp_return_vals); -/* FIXME: uncomment when these are working gimp_install_procedure (DECODE_EXIF_PROC, - "Decode an EXIF block", + "Decode an EXIF block", "Parse an EXIF block and merge the results with " "any metadata already attached to the image. This " "should be used when an EXIF block is read from an " "image file.", - "Raphaël Quinet ", - "Raphaël Quinet ", - "2005", + "Raphaël Quinet ", + "Raphaël Quinet ", + "2005", NULL, NULL, GIMP_PLUGIN, G_N_ELEMENTS (decode_exif_args), 0, decode_exif_args, NULL); +/* FIXME: uncomment when these are working gimp_install_procedure (ENCODE_EXIF_PROC, - "Encode metadata into an EXIF block", + "Encode metadata into an EXIF block", "Generate an EXIF block from the metadata " "information attached to the image. The new EXIF " "block can then be saved into a file.", - "Raphaël Quinet ", - "Raphaël Quinet ", - "2005", + "Raphaël Quinet ", + "Raphaël Quinet ", + "2005", NULL, NULL, GIMP_PLUGIN, @@ -263,12 +261,12 @@ query (void) */ gimp_install_procedure (GET_PROC, - "Retrieve the values of an XMP property", + "Retrieve the values of an XMP property", "Retrieve the list of values associated with " "an XMP property.", - "Raphaël Quinet ", - "Raphaël Quinet ", - "2005", + "Raphaël Quinet ", + "Raphaël Quinet ", + "2005", NULL, NULL, GIMP_PLUGIN, @@ -277,13 +275,13 @@ query (void) get_args, get_return_vals); gimp_install_procedure (SET_PROC, - "Set the values of an XMP property", + "Set the values of an XMP property", "Set the list of values associated with " "an XMP property. If a property with the same " "name already exists, it will be replaced.", - "Raphaël Quinet ", - "Raphaël Quinet ", - "2005", + "Raphaël Quinet ", + "Raphaël Quinet ", + "2005", NULL, NULL, GIMP_PLUGIN, @@ -291,15 +289,15 @@ query (void) set_args, NULL); gimp_install_procedure (GET_SIMPLE_PROC, - "Retrieve the value of an XMP property", + "Retrieve the value of an XMP property", "Retrieve value associated with a scalar XMP " "property. This can only be done for simple " "property types such as text or integers. " "Structured types must be retrieved with " "plug_in_metadata_get().", - "Raphaël Quinet ", - "Raphaël Quinet ", - "2005", + "Raphaël Quinet ", + "Raphaël Quinet ", + "2005", NULL, NULL, GIMP_PLUGIN, @@ -308,14 +306,14 @@ query (void) get_simple_args, get_simple_return_vals); gimp_install_procedure (SET_SIMPLE_PROC, - "Set the value of an XMP property", + "Set the value of an XMP property", "Set the value of a scalar XMP property. This " "can only be done for simple property types such " "as text or integers. Structured types need to " "be set with plug_in_metadata_set().", - "Raphaël Quinet ", - "Raphaël Quinet ", - "2005", + "Raphaël Quinet ", + "Raphaël Quinet ", + "2005", NULL, NULL, GIMP_PLUGIN, @@ -323,14 +321,14 @@ query (void) set_simple_args, NULL); gimp_install_procedure (IMPORT_PROC, - "Import XMP from a file into the current image", + "Import XMP from a file into the current image", "Load an XMP packet from a file and import it into " "the current image. This can be used to add a " "license statement or some other predefined " "metadata to an image", - "Raphaël Quinet ", - "Raphaël Quinet ", - "2005", + "Raphaël Quinet ", + "Raphaël Quinet ", + "2005", NULL, NULL, GIMP_PLUGIN, @@ -338,16 +336,16 @@ query (void) import_args, NULL); gimp_install_procedure (EXPORT_PROC, - "Export XMP from the current image to a file", + "Export XMP from the current image to a file", "Export the metadata associated with the current " "image into a file. The metadata will be saved as " "an XMP packet. If overwrite is TRUE, then any " "existing file will be overwritten without warning. " "If overwrite is FALSE, then an error will occur if " "the file already exists.", - "Raphaël Quinet ", - "Raphaël Quinet ", - "2005", + "Raphaël Quinet ", + "Raphaël Quinet ", + "2005", NULL, NULL, GIMP_PLUGIN, @@ -388,6 +386,7 @@ run (const gchar *name, if (parasite) { GError *error = NULL; + g_warning ("Parsing Metadata XMP parasite."); if (!! strncmp (gimp_parasite_data (parasite), METADATA_MARKER, METADATA_MARKER_LEN) @@ -396,7 +395,7 @@ run (const gchar *name, + METADATA_MARKER_LEN, gimp_parasite_data_size (parasite) - METADATA_MARKER_LEN, - FALSE, &error)) + TRUE, &error)) { g_printerr ("Metadata parasite seems to be corrupt"); /* continue anyway, we will attach a clean parasite later */ @@ -432,11 +431,23 @@ run (const gchar *name, if (! xmp_model_parse_buffer (xmp_model, buffer, strlen (buffer), FALSE, &error)) status = GIMP_PDB_EXECUTION_ERROR; + } else if (! strcmp (name, ENCODE_XMP_PROC)) { /* done below together with the parasite */ } + else if (! strcmp (name, DECODE_EXIF_PROC)) + { +#ifdef HAVE_EXIF + GError *error = NULL; + + if (! xmp_merge_from_exifbuffer (xmp_model, + image_ID, + &error)) + status = GIMP_PDB_EXECUTION_ERROR; +#endif + } else if (! strcmp (name, GET_PROC)) { g_printerr ("Not implemented yet (GET_PROC)\n"); /* FIXME */ @@ -509,7 +520,6 @@ run (const gchar *name, } else if (! strcmp (name, EDITOR_PROC)) { - /* FIXME: uncomment when these are working GimpRunMode run_mode; run_mode = param[0].data.d_int32; @@ -519,7 +529,6 @@ run (const gchar *name, status = GIMP_PDB_CANCEL; } - */ g_printerr ("Not implemented yet (EDITOR_PROC)\n"); status = GIMP_PDB_EXECUTION_ERROR; } From e0fddee12829bca85565ca903a7d6e464c8cb2ec Mon Sep 17 00:00:00 2001 From: Roman Joost Date: Sun, 28 Jun 2009 15:26:24 +1000 Subject: [PATCH 2/4] Set scalar properties for XMP (exif). --- plug-ins/metadata/exif-decode.c | 50 ++++++++++++++++++++------------- plug-ins/metadata/metadata.c | 7 +++-- 2 files changed, 36 insertions(+), 21 deletions(-) diff --git a/plug-ins/metadata/exif-decode.c b/plug-ins/metadata/exif-decode.c index 7e0968a948..96e3a09258 100644 --- a/plug-ins/metadata/exif-decode.c +++ b/plug-ins/metadata/exif-decode.c @@ -33,36 +33,44 @@ #include "exif-decode.h" -/* prototypes of local functions */ -// static void exif_iter_content (XMPModel *xmp_model, -// ExifData *data); + static void exif_foreach_content_cb (ExifContent *content, XMPModel *xmp_model); static void exif_foreach_entry_cb (ExifEntry *entry, XMPModel *xmp_model); - +/** + * xmp_merge_from_exifbuffer: + * @xmp_model: pointer to the #XMPModel in which the results will be stored + * @image_ID: id of the image where the exif data parasite is attached to + * @error: return location for a #GErrror + * + * Load the Exif data, which is attached to the image as a parasite. The + * parsed Exif data is merged into the XMP model. + * + * Return value: %TRUE on success, %FALSE if an error occured during + * reading/writing + * + **/ gboolean xmp_merge_from_exifbuffer (XMPModel *xmp_model, gint32 image_ID, GError **error) { ExifData *exif_data; - GimpParasite *parasite = gimp_image_parasite_find(image_ID, "exif-data"); + GimpParasite *parasite = gimp_image_parasite_find (image_ID, "exif-data"); - if (parasite) - { - g_warning ("Found parasite, extracting exif"); - exif_data = exif_data_new_from_data (gimp_parasite_data (parasite), - gimp_parasite_data_size (parasite)); - if (exif_data) { - exif_data_foreach_content (exif_data, - (void *) exif_foreach_content_cb, - xmp_model); - } else { - g_printerr ("\nSomething went wrong, when reading from buffer.\n"); - return FALSE; - } + if (!parasite) + return FALSE; + + exif_data = exif_data_new_from_data (gimp_parasite_data (parasite), + gimp_parasite_data_size (parasite)); + if (exif_data) { + exif_data_foreach_content (exif_data, + (void *) exif_foreach_content_cb, + xmp_model); + } else { + return FALSE; } return TRUE; @@ -79,6 +87,10 @@ static void exif_foreach_entry_cb (ExifEntry *entry, XMPModel *xmp_model) { - g_printerr ("\nWuff! Wuff!:"); + char value[1024]; + xmp_model_set_scalar_property (xmp_model, + XMP_SCHEMA_EXIF, + exif_tag_get_name (entry->tag), + exif_entry_get_value (entry, value, sizeof (value))); } diff --git a/plug-ins/metadata/metadata.c b/plug-ins/metadata/metadata.c index 78fc7d59cf..f34b54e95b 100644 --- a/plug-ins/metadata/metadata.c +++ b/plug-ins/metadata/metadata.c @@ -397,7 +397,7 @@ run (const gchar *name, - METADATA_MARKER_LEN, TRUE, &error)) { - g_printerr ("Metadata parasite seems to be corrupt"); + g_printerr ("\nMetadata parasite seems to be corrupt"); /* continue anyway, we will attach a clean parasite later */ } gimp_parasite_free (parasite); @@ -445,7 +445,10 @@ run (const gchar *name, if (! xmp_merge_from_exifbuffer (xmp_model, image_ID, &error)) - status = GIMP_PDB_EXECUTION_ERROR; + { + status = GIMP_PDB_EXECUTION_ERROR; + g_printerr ("\nExif to XMP merge failed.\n"); + } #endif } else if (! strcmp (name, GET_PROC)) From 46ad0f6c2a079587274b1cef8647b4b9661f370a Mon Sep 17 00:00:00 2001 From: Roman Joost Date: Sun, 28 Jun 2009 15:34:42 +1000 Subject: [PATCH 3/4] Replace open by save button in the export dialog. The interface.c was retabbed before to remove existing tabs and replace them with spaces. --- plug-ins/metadata/interface.c | 72 +++++++++++++++++------------------ 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/plug-ins/metadata/interface.c b/plug-ins/metadata/interface.c index 31a21efa42..1fb1372b1f 100644 --- a/plug-ins/metadata/interface.c +++ b/plug-ins/metadata/interface.c @@ -69,9 +69,9 @@ typedef struct static void value_edited (GtkCellRendererText *cell, - const gchar *path_string, - const gchar *new_text, - gpointer data) + const gchar *path_string, + const gchar *new_text, + gpointer data) { GtkTreeModel *model = data; GtkTreePath *path = gtk_tree_path_new_from_string (path_string); @@ -85,8 +85,8 @@ value_edited (GtkCellRendererText *cell, /* FIXME: update value[] array */ /* FIXME: check widget xref and update other widget if not NULL */ gtk_tree_store_set (GTK_TREE_STORE (model), &iter, - COL_XMP_VALUE, new_text, - -1); + COL_XMP_VALUE, new_text, + -1); gtk_tree_path_free (path); } @@ -135,7 +135,7 @@ add_view_columns (GtkTreeView *treeview) g_object_set (renderer, "xalign", 0.0, NULL); g_signal_connect (renderer, "edited", - G_CALLBACK (value_edited), model); + G_CALLBACK (value_edited), model); col_offset = gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview), -1, _("Value"), @@ -217,7 +217,7 @@ register_entry_xref (GtkWidget *entry, xref->property_name = property_name; xref->widget_list = g_slist_prepend (NULL, entry); g_signal_connect (GTK_ENTRY (entry), "changed", - G_CALLBACK (entry_changed), xref); + G_CALLBACK (entry_changed), xref); } static void @@ -244,7 +244,7 @@ register_text_xref (GtkTextBuffer *text_buffer, xref->property_name = property_name; xref->widget_list = g_slist_prepend (NULL, text_buffer); g_signal_connect (GTK_TEXT_BUFFER (text_buffer), "changed", - G_CALLBACK (text_changed), xref); + G_CALLBACK (text_changed), xref); } static void @@ -259,7 +259,7 @@ add_description_tab (GtkWidget *notebook) frame = gimp_frame_new (_("Description")); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), frame, - gtk_label_new (_("Description"))); + gtk_label_new (_("Description"))); gtk_container_set_border_width (GTK_CONTAINER (frame), 10); /* gtk_widget_show (frame); */ @@ -272,21 +272,21 @@ add_description_tab (GtkWidget *notebook) entry = gtk_entry_new (); register_entry_xref (entry, XMP_SCHEMA_DUBLIN_CORE, "title"); gimp_table_attach_aligned (GTK_TABLE (table), 0, 0, - _("Image _title:"), 0.0, 0.5, - entry, 1, FALSE); + _("Image _title:"), 0.0, 0.5, + entry, 1, FALSE); entry = gtk_entry_new (); register_entry_xref (entry, XMP_SCHEMA_DUBLIN_CORE, "creator"); gimp_table_attach_aligned (GTK_TABLE (table), 0, 1, - _("_Author:"), 0.0, 0.5, - entry, 1, FALSE); + _("_Author:"), 0.0, 0.5, + entry, 1, FALSE); scrolled_window = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window), GTK_SHADOW_IN); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), - GTK_POLICY_AUTOMATIC, - GTK_POLICY_AUTOMATIC); + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); text_view = gtk_text_view_new (); text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view)); gtk_text_buffer_set_text (text_buffer, @@ -297,28 +297,28 @@ add_description_tab (GtkWidget *notebook) register_text_xref (text_buffer, XMP_SCHEMA_DUBLIN_CORE, "description"); gtk_container_add (GTK_CONTAINER (scrolled_window), text_view); gimp_table_attach_aligned (GTK_TABLE (table), 0, 2, - _("_Description:"), 0.0, 0.5, - scrolled_window, 1, FALSE); + _("_Description:"), 0.0, 0.5, + scrolled_window, 1, FALSE); entry = gtk_entry_new (); register_entry_xref (entry, XMP_SCHEMA_PHOTOSHOP, "CaptionWriter"); gimp_table_attach_aligned (GTK_TABLE (table), 0, 3, - _("Description _writer:"), 0.0, 0.5, - entry, 1, FALSE); + _("Description _writer:"), 0.0, 0.5, + entry, 1, FALSE); scrolled_window = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window), GTK_SHADOW_IN); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), - GTK_POLICY_AUTOMATIC, - GTK_POLICY_AUTOMATIC); + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); text_view = gtk_text_view_new (); text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view)); register_text_xref (text_buffer, XMP_SCHEMA_PDF, "Keywords"); gtk_container_add (GTK_CONTAINER (scrolled_window), text_view); gimp_table_attach_aligned (GTK_TABLE (table), 0, 4, - _("_Keywords:"), 0.0, 0.5, - scrolled_window, 1, FALSE); + _("_Keywords:"), 0.0, 0.5, + scrolled_window, 1, FALSE); gtk_widget_show_all (frame); } @@ -331,7 +331,7 @@ add_copyright_tab (GtkWidget *notebook) /* FIXME: add entries, cross-link with XMP model */ label = gtk_label_new (_("Empty")); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), label, - gtk_label_new (_("Copyright"))); + gtk_label_new (_("Copyright"))); gtk_widget_show (label); } @@ -343,7 +343,7 @@ add_origin_tab (GtkWidget *notebook) /* FIXME: add entries, cross-link with XMP model */ label = gtk_label_new (_("Empty")); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), label, - gtk_label_new (_("Origin"))); + gtk_label_new (_("Origin"))); gtk_widget_show (label); } @@ -355,7 +355,7 @@ add_camera1_tab (GtkWidget *notebook) /* FIXME: add entries, cross-link with XMP model */ label = gtk_label_new (_("Empty")); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), label, - gtk_label_new (_("Camera 1"))); + gtk_label_new (_("Camera 1"))); gtk_widget_show (label); } @@ -367,7 +367,7 @@ add_camera2_tab (GtkWidget *notebook) /* FIXME: add entries, cross-link with XMP model */ label = gtk_label_new (_("Empty")); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), label, - gtk_label_new (_("Camera 2"))); + gtk_label_new (_("Camera 2"))); gtk_widget_show (label); } @@ -382,13 +382,13 @@ add_thumbnail_tab (GtkWidget *notebook) (GtkIconSize) -1, "thumbnail"); image = gtk_image_new_from_pixbuf (default_thumb); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), image, - gtk_label_new (_("Thumbnail"))); + gtk_label_new (_("Thumbnail"))); gtk_widget_show (image); } static void add_advanced_tab (GtkWidget *notebook, - GtkTreeModel *model) + GtkTreeModel *model) { GtkWidget *sw; GtkWidget *treeview; @@ -396,12 +396,12 @@ add_advanced_tab (GtkWidget *notebook, /* Advanced tab */ sw = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), - GTK_SHADOW_ETCHED_IN); + GTK_SHADOW_ETCHED_IN); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), - GTK_POLICY_AUTOMATIC, - GTK_POLICY_AUTOMATIC); + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), sw, - gtk_label_new (_("Advanced"))); + gtk_label_new (_("Advanced"))); /* create tree view - model will be unref'ed in xmp_model_free() */ treeview = gtk_tree_view_new_with_model (model); @@ -413,7 +413,7 @@ add_advanced_tab (GtkWidget *notebook, /* expand all rows after the treeview widget has been realized */ g_signal_connect (treeview, "realize", - G_CALLBACK (gtk_tree_view_expand_all), NULL); + G_CALLBACK (gtk_tree_view_expand_all), NULL); gtk_widget_show (treeview); gtk_widget_show (sw); } @@ -590,7 +590,7 @@ file_export_dialog (GtkWidget *parent, GTK_FILE_CHOOSER_ACTION_SAVE, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OPEN, GTK_RESPONSE_OK, + GTK_STOCK_SAVE, GTK_RESPONSE_OK, NULL); @@ -683,7 +683,7 @@ metadata_dialog (gint32 image_ID, gtk_notebook_set_tab_pos (GTK_NOTEBOOK (notebook), GTK_POS_TOP); gtk_container_set_border_width (GTK_CONTAINER (notebook), 12); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (mgui.dlg)->vbox), notebook, - TRUE, TRUE, 0); + TRUE, TRUE, 0); gtk_widget_show (notebook); mgui.xmp_model = xmp_model; From 5bc14cdc96736ac6a3e5ce2dbc667eec232073f5 Mon Sep 17 00:00:00 2001 From: Roman Joost Date: Tue, 30 Jun 2009 18:41:38 +1000 Subject: [PATCH 4/4] Reformatted source code and removed unused prototypes. --- plug-ins/metadata/exif-decode.c | 14 +++++++++++++- plug-ins/metadata/exif-decode.h | 4 ---- plug-ins/metadata/metadata.c | 1 - 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/plug-ins/metadata/exif-decode.c b/plug-ins/metadata/exif-decode.c index 96e3a09258..de1e6ad9fd 100644 --- a/plug-ins/metadata/exif-decode.c +++ b/plug-ins/metadata/exif-decode.c @@ -34,11 +34,18 @@ #include "exif-decode.h" +/* local function prototypes */ + +gboolean xmp_merge_from_exifbuffer (XMPModel *xmp_model, + gint32 image_ID, + GError **error); static void exif_foreach_content_cb (ExifContent *content, XMPModel *xmp_model); static void exif_foreach_entry_cb (ExifEntry *entry, XMPModel *xmp_model); +/* public functions */ + /** * xmp_merge_from_exifbuffer: * @xmp_model: pointer to the #XMPModel in which the results will be stored @@ -76,11 +83,16 @@ xmp_merge_from_exifbuffer (XMPModel *xmp_model, return TRUE; } + +/* private functions */ + static void exif_foreach_content_cb (ExifContent *content, XMPModel *xmp_model) { - exif_content_foreach_entry (content, (void *) exif_foreach_entry_cb, xmp_model); + exif_content_foreach_entry (content, + (void *) exif_foreach_entry_cb, + xmp_model); } static void diff --git a/plug-ins/metadata/exif-decode.h b/plug-ins/metadata/exif-decode.h index 80f9791356..487cc58c1a 100644 --- a/plug-ins/metadata/exif-decode.h +++ b/plug-ins/metadata/exif-decode.h @@ -22,10 +22,6 @@ G_BEGIN_DECLS -gboolean exif_merge_to_xmp (XMPModel *xmp_model, - const gchar *filename, - GError **error); - gboolean xmp_merge_from_exifbuffer (XMPModel *xmp_model, gint32 image_ID, GError **error); diff --git a/plug-ins/metadata/metadata.c b/plug-ins/metadata/metadata.c index f34b54e95b..6010b3eb85 100644 --- a/plug-ins/metadata/metadata.c +++ b/plug-ins/metadata/metadata.c @@ -386,7 +386,6 @@ run (const gchar *name, if (parasite) { GError *error = NULL; - g_warning ("Parsing Metadata XMP parasite."); if (!! strncmp (gimp_parasite_data (parasite), METADATA_MARKER, METADATA_MARKER_LEN)