xmpedit

GTK+ editor for XMP metadata embedded in images
git clone https://code.djc.id.au/git/xmpedit/
commit 7afeb3d2b9359d5b0f7c3cf5001b3e3d3c24c420
parent a53b41d36ddcc303718465482cf1cdd656afdcf4
Author: Dan Callaghan <djc@djc.id.au>
Date:   Wed,  1 Sep 2010 21:54:26 +1000

better debugging output

Diffstat:
Msrc/ImageMetadata.vala | 19+++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/src/ImageMetadata.vala b/src/ImageMetadata.vala
@@ -184,11 +184,18 @@ public class ImageMetadata : Object, Gtk.TreeModel {
         var exiv_metadata = new GExiv2.Metadata();
         exiv_metadata.open_path(path);
         string xmp = exiv_metadata.get_xmp_packet();
-        stdout.puts(xmp);
+#if DEBUG
+        stderr.puts("=== Extracted XMP packet:\n");
+        stderr.puts(xmp);
+        stderr.putc('\n');
+#endif
         var base_uri = File.new_for_path(path).get_uri();
         graph = new RDF.Graph.from_xml(xmp, base_uri);
+#if DEBUG
+        stderr.puts("=== Parsed RDF graph:\n");
         foreach (var s in graph.get_statements())
-            stdout.puts(@"$s\n");
+            stderr.puts(@"$s\n");
+#endif
         subject = new RDF.URIRef(base_uri);
         foreach (var type in PropertyEditor.all_types()) {
             var pe = (PropertyEditor) Object.new(type);
@@ -203,10 +210,14 @@ public class ImageMetadata : Object, Gtk.TreeModel {
     }
     
     public void save() {
+#if DEBUG
+        stderr.puts("=== Final RDF graph:\n");
         foreach (var s in graph.get_statements())
-            stdout.puts(@"$s\n");
+            stderr.puts(@"$s\n");
+        stderr.puts("=== Serialized RDF XML:\n");
+        stderr.puts(graph.to_xml(subject));
+#endif
         // XXX actually write it out
-        // XXX gc unreachable nodes in the graph
     }
     
     /****** TREEMODEL IMPLEMENTATION STUFF **********/