gthumb r2183 - in trunk: . libgthumb src



Author: mjc
Date: Fri Jan 11 20:15:12 2008
New Revision: 2183
URL: http://svn.gnome.org/viewvc/gthumb?rev=2183&view=rev

Log:
2008-01-11  Michael J. Chudobiak  <mjc svn gnome org>

        * libgthumb/gth-exif-utils.c: (free_metadata_entry):
        * libgthumb/gth-exif-utils.h:
        * libgthumb/gth-exiv2-utils.cpp:
        * libgthumb/gth-gstreamer-utils.c: (add_metadata):
        * src/gth-exif-data-viewer.c: (add_to_display), (gth_read_exif),
        (sort_by_tag_name), (update_metadata):
        Use HAVE_EVIX2_XMP_HPP instead of HAVE_XMP. Not sure why it matters.
        Also, split the tag name into two pieces - a full path and a short
        display name.



Modified:
   trunk/ChangeLog
   trunk/libgthumb/gth-exif-utils.c
   trunk/libgthumb/gth-exif-utils.h
   trunk/libgthumb/gth-exiv2-utils.cpp
   trunk/libgthumb/gth-gstreamer-utils.c
   trunk/src/gth-exif-data-viewer.c

Modified: trunk/libgthumb/gth-exif-utils.c
==============================================================================
--- trunk/libgthumb/gth-exif-utils.c	(original)
+++ trunk/libgthumb/gth-exif-utils.c	Fri Jan 11 20:15:12 2008
@@ -758,7 +758,8 @@
 void free_metadata_entry (GthMetadata *entry)
 {
 	if (entry != NULL) {
-		g_free (entry->name);
+		g_free (entry->full_name);
+		g_free (entry->display_name);
 		g_free (entry->value);
 		g_free (entry);
 	}

Modified: trunk/libgthumb/gth-exif-utils.h
==============================================================================
--- trunk/libgthumb/gth-exif-utils.h	(original)
+++ trunk/libgthumb/gth-exif-utils.h	Fri Jan 11 20:15:12 2008
@@ -66,7 +66,8 @@
  
 typedef struct {
         GthMetadataCategory category;
-        char *name;
+	char *full_name;
+        char *display_name;
         char *value;
         int   position;
 } GthMetadata;

Modified: trunk/libgthumb/gth-exiv2-utils.cpp
==============================================================================
--- trunk/libgthumb/gth-exiv2-utils.cpp	(original)
+++ trunk/libgthumb/gth-exiv2-utils.cpp	Fri Jan 11 20:15:12 2008
@@ -32,7 +32,7 @@
 #include <vector>
 #include <iomanip>
 
-#ifdef HAVE_XMP
+#ifdef HAVE_EXIV2_XMP_HPP
 #include <exiv2/xmp.hpp>
 #endif
 
@@ -68,16 +68,18 @@
 }
 
 inline static GList *
-add (GList *metadata,
-		const gchar *path, 
-		const gchar *value, 
-		GthMetadataCategory category)
+add (GList              *metadata,
+     const gchar        *full_name, 
+     const gchar        *display_name,
+     const gchar	*value,
+     GthMetadataCategory category)
 {
 	GthMetadata *new_entry;
 
 	new_entry = g_new (GthMetadata, 1);
 	new_entry->category = category;
-	new_entry->name = g_strdup (path);
+	new_entry->full_name = g_strdup (full_name);
+	new_entry->display_name = g_strdup (display_name);
 	new_entry->value = g_strdup (value);
 	new_entry->position = 0;
 	metadata = g_list_prepend (metadata, new_entry);
@@ -128,7 +130,7 @@
 				string value = stream.str();
 
 				//disable "improve" untils it works :-)
-				metadata = add (metadata, i->key().c_str(), improve(value).c_str(), cat);
+				metadata = add (metadata, i->key().c_str(), i->key().c_str(), improve(value).c_str(), cat);
 			}
 		}
 
@@ -148,14 +150,14 @@
 				stringstream value;
 				value << *md;
 
-                                stringstream name;
-                                name << md->tagName();
+                                stringstream short_name;
+                                short_name << md->tagName();
 
-				metadata = add (metadata, name.str().c_str(), value.str().c_str(), cat);
+				metadata = add (metadata, md->key().c_str(), short_name.str().c_str(), value.str().c_str(), cat);
 			}
 		}
 
-#ifdef HAVE_XMP
+#ifdef HAVE_EXIV2_XMP_HPP
 		Exiv2::XmpData &xmpData = image->xmpData();
 		if (!xmpData.empty()) {
 
@@ -171,10 +173,10 @@
 				stringstream value;
 				value << *md;
 
-				stringstream name;
-				name << md->groupName() << "." << md->tagName();
+				stringstream short_name;
+				short_name << md->groupName() << "." << md->tagName();
 
-				metadata = add (metadata, name.str().c_str(), value.str().c_str(), cat);
+				metadata = add (metadata, md->key().c_str(), short_name.str().c_str(), value.str().c_str(), cat);
 			}
 		}
 #endif
@@ -193,7 +195,7 @@
 read_exiv2_sidecar (const char *uri, GList *metadata)
 {
 	try {
-#ifdef HAVE_XMP
+#ifdef HAVE_EXIV2_XMP_HPP
 	        Exiv2::DataBuf buf = Exiv2::readFile(uri);
         	std::string xmpPacket;
 	        xmpPacket.assign(reinterpret_cast<char*>(buf.pData_), buf.size_);
@@ -216,10 +218,10 @@
                                 stringstream value;
                                 value << *md;
 
-                                stringstream name;
-                                name << md->groupName() << "." << md->tagName();
+                                stringstream short_name;
+                                short_name << md->groupName() << "." << md->tagName();
 
-                                metadata = add (metadata, name.str().c_str(), value.str().c_str(), cat);
+                                metadata = add (metadata, md->key().c_str(), short_name.str().c_str(), value.str().c_str(), cat);
 			}
 		}
 	        Exiv2::XmpParser::terminate();

Modified: trunk/libgthumb/gth-gstreamer-utils.c
==============================================================================
--- trunk/libgthumb/gth-gstreamer-utils.c	(original)
+++ trunk/libgthumb/gth-gstreamer-utils.c	Fri Jan 11 20:15:12 2008
@@ -350,7 +350,8 @@
 	if (value != NULL) {
 		new_entry = g_new (GthMetadata, 1);
         	new_entry->category = GTH_METADATA_CATEGORY_GSTREAMER;
-		new_entry->name = key;
+		new_entry->full_name = g_strdup (key);
+		new_entry->display_name = key;
         	new_entry->value = value;
 	       	new_entry->position = 0;
         	metadata = g_list_prepend (metadata, new_entry);

Modified: trunk/src/gth-exif-data-viewer.c
==============================================================================
--- trunk/src/gth-exif-data-viewer.c	(original)
+++ trunk/src/gth-exif-data-viewer.c	Fri Jan 11 20:15:12 2008
@@ -619,7 +619,7 @@
 {
 	add_to_exif_display_list (edv,
 		       		  entry->category,
-			  	  entry->name,
+			  	  entry->display_name,
 				  entry->value,
 				  entry->position);
 }
@@ -709,7 +709,8 @@
 
 				new_entry = g_new (GthMetadata, 1);
 				new_entry->category = category;
-				new_entry->name = g_strdup (utf8_name);
+				new_entry->full_name = g_strdup (utf8_name);
+				new_entry->display_name = g_strdup (utf8_name);
 				new_entry->value = g_strdup (utf8_value);
 				new_entry->position = position;
 				metadata = g_list_prepend (metadata, new_entry);
@@ -760,7 +761,8 @@
 
 	                                new_entry = g_new (GthMetadata, 1);
                                 	new_entry->category = GTH_METADATA_CATEGORY_MAKERNOTE;
-                        	        new_entry->name = g_strdup (utf8_name);
+					new_entry->full_name = g_strdup (utf8_name);
+                        	        new_entry->display_name = g_strdup (utf8_name);
                 	                new_entry->value = g_strdup (utf8_value);
         	                        new_entry->position = unique_id_for_unsorted_tags;
 	                                metadata = g_list_prepend (metadata, new_entry);
@@ -784,7 +786,7 @@
 static gint
 sort_by_tag_name (GthMetadata *entry1, GthMetadata *entry2)
 {
-	return strcmp_null_tolerant (entry1->name, entry2->name);
+	return strcmp_null_tolerant (entry1->display_name, entry2->display_name);
 }
 
 
@@ -796,7 +798,7 @@
 	if (uri == NULL)
 		return metadata;
 
-/* for now, use both exiv2 and libexif, until we're more comfortable with exiv2 */
+	/* for now, use both exiv2 and libexif, until we're more comfortable with exiv2 */
 	if ( mime_type_is_image (mime_type))
 		metadata = gth_read_exiv2 (uri, metadata);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]