gthumb r2253 - in trunk: . libgthumb src



Author: mjc
Date: Tue Feb  5 13:44:27 2008
New Revision: 2253
URL: http://svn.gnome.org/viewvc/gthumb?rev=2253&view=rev

Log:
2008-02-05  Michael J. Chudobiak  <mjc svn gnome org>

        * libgthumb/comments.h:
        * libgthumb/gth-exif-utils.c: (get_metadata_time_from_fd),
        (get_orientation_from_fd), (get_metadata_string),
        (get_metadata_tagset_string):
        * libgthumb/gth-exif-utils.h:
        * src/catalog-web-exporter.c: (gth_parsed_doc_print):
        * src/gth-fullscreen.c: (get_file_info):
        Renamed get_metadata_string_from_fd to get_metadata_tagset_string.
        Added get_metadata_string function, which is a simplified version of
        get_metadata_tagset_string accepting just one tag name, for
        convenience.



Modified:
   trunk/ChangeLog
   trunk/libgthumb/comments.h
   trunk/libgthumb/gth-exif-utils.c
   trunk/libgthumb/gth-exif-utils.h
   trunk/src/catalog-web-exporter.c
   trunk/src/gth-fullscreen.c

Modified: trunk/libgthumb/comments.h
==============================================================================
--- trunk/libgthumb/comments.h	(original)
+++ trunk/libgthumb/comments.h	Tue Feb  5 13:44:27 2008
@@ -23,11 +23,6 @@
 #include <glib.h>
 #include <time.h>
 
-#ifdef HAVE_LIBIPTCDATA
-#include <libiptcdata/iptc-data.h>
-#include <libiptcdata/iptc-jpeg.h>
-#endif /* HAVE_LIBIPTCDATA */
-
 #ifndef COMMENTS_H
 #define COMMENTS_H
 
@@ -43,11 +38,6 @@
 				     * gthumb for GNOME 1.x saved text in
 				     * locale format, gthumb for
 				     * GNOME 2.x saves in utf8 format. */
-
-#ifdef HAVE_LIBIPTCDATA
-	IptcData  *iptc_data;
-#endif /* HAVE_LIBIPTCDATA */
-
 	gboolean   changed;
 } CommentData;
 

Modified: trunk/libgthumb/gth-exif-utils.c
==============================================================================
--- trunk/libgthumb/gth-exif-utils.c	(original)
+++ trunk/libgthumb/gth-exif-utils.c	Tue Feb  5 13:44:27 2008
@@ -224,7 +224,7 @@
 	char   *date = NULL;
 	time_t  result = 0;
 
-	date = get_metadata_string_from_fd (fd, TAG_NAME_SETS[DATE_TAG_NAMES]);
+	date = get_metadata_tagset_string (fd, TAG_NAME_SETS[DATE_TAG_NAMES]);
 	if (date != NULL)
 		result = exif_string_to_time_t (date);
 	
@@ -239,7 +239,7 @@
         char         *orientation_string = NULL;
 	GthTransform  result = GTH_TRANSFORM_NONE;
 
-        orientation_string = get_metadata_string_from_fd (fd, TAG_NAME_SETS[ORIENTATION_TAG_NAMES]);
+        orientation_string = get_metadata_tagset_string (fd, TAG_NAME_SETS[ORIENTATION_TAG_NAMES]);
 	
 	if (orientation_string == NULL)
 		result = GTH_TRANSFORM_NONE;
@@ -267,11 +267,32 @@
 
 
 char *
-get_metadata_string_from_fd (FileData *fd, const char *tagnames[])
+get_metadata_string (FileData *fd, const char *tagname)
+{
+        char   *string = NULL;
+
+	/* Searches for one (and only one) tag name */
+
+        update_metadata (fd);
+
+        GList *search_result = g_list_find_custom (fd->metadata, tagname, (GCompareFunc) metadata_search);
+        if (search_result != NULL) {
+		GthMetadata *md_entry = search_result->data;
+                string = g_strdup (md_entry->formatted_value);
+        }
+
+        return string;
+}
+
+
+char *
+get_metadata_tagset_string (FileData *fd, const char *tagnames[])
 {
 	int     i;
 	char   *string = NULL;
 
+	/* Searches for the best tag from a list of acceptable tag names */
+
 	update_metadata (fd);
 
 	for (i = 0; (tagnames[i] != NULL) && (string == NULL); i++) {		

Modified: trunk/libgthumb/gth-exif-utils.h
==============================================================================
--- trunk/libgthumb/gth-exif-utils.h	(original)
+++ trunk/libgthumb/gth-exif-utils.h	Tue Feb  5 13:44:27 2008
@@ -83,7 +83,9 @@
 time_t        get_metadata_time           (const char   *mime_type,
 					   const char   *uri,
 					   GList        *md);
-char *	      get_metadata_string_from_fd (FileData	*fd,
+char *        get_metadata_string         (FileData     *fd,
+					   const char *tagname);
+char *	      get_metadata_tagset_string  (FileData     *fd,
 					   const char   *tagnames[]);
 GList *       simple_add_metadata         (GList        *metadata,
 			                   const gchar  *key,

Modified: trunk/src/catalog-web-exporter.c
==============================================================================
--- trunk/src/catalog-web-exporter.c	(original)
+++ trunk/src/catalog-web-exporter.c	Tue Feb  5 13:44:27 2008
@@ -1751,7 +1751,7 @@
 		case GTH_TAG_EXIF_EXPOSURE_TIME:
 			idx = get_image_idx (tag, ce);
 			idata = g_list_nth (ce->file_list, idx)->data;
-			line = get_metadata_string_from_fd (idata->src_file, 
+			line = get_metadata_tagset_string (idata->src_file, 
 							    TAG_NAME_SETS[EXPTIME_TAG_NAMES]);
 			write_markup_escape_line (line, fout);
 			break;
@@ -1759,7 +1759,7 @@
 		case GTH_TAG_EXIF_EXPOSURE_MODE:
 			idx = get_image_idx (tag, ce);
 			idata = g_list_nth (ce->file_list, idx)->data;
-			line = get_metadata_string_from_fd (idata->src_file,
+			line = get_metadata_tagset_string (idata->src_file,
 							    TAG_NAME_SETS[EXPMODE_TAG_NAMES]);
 			write_markup_escape_line (line, fout);
 			break;
@@ -1767,7 +1767,7 @@
 		case GTH_TAG_EXIF_FLASH:
 			idx = get_image_idx (tag, ce);
 			idata = g_list_nth (ce->file_list, idx)->data;
-			line = get_metadata_string_from_fd (idata->src_file,
+			line = get_metadata_tagset_string (idata->src_file,
 					     		    TAG_NAME_SETS[FLASH_TAG_NAMES]);
 			write_markup_escape_line (line, fout);
 			break;
@@ -1775,7 +1775,7 @@
 		case GTH_TAG_EXIF_SHUTTER_SPEED:
 			idx = get_image_idx (tag, ce);
 			idata = g_list_nth (ce->file_list, idx)->data;
-			line = get_metadata_string_from_fd (idata->src_file,
+			line = get_metadata_tagset_string (idata->src_file,
 							    TAG_NAME_SETS[SHUTTERSPEED_TAG_NAMES]);
 			write_markup_escape_line (line, fout);
 			break;
@@ -1783,7 +1783,7 @@
 		case GTH_TAG_EXIF_APERTURE_VALUE:
 			idx = get_image_idx (tag, ce);
 			idata = g_list_nth (ce->file_list, idx)->data;
-			line = get_metadata_string_from_fd (idata->src_file,
+			line = get_metadata_tagset_string (idata->src_file,
 							    TAG_NAME_SETS[APERTURE_TAG_NAMES]); 
 			write_markup_escape_line (line, fout);
 			break;
@@ -1791,7 +1791,7 @@
 		case GTH_TAG_EXIF_FOCAL_LENGTH:
 			idx = get_image_idx (tag, ce);
 			idata = g_list_nth (ce->file_list, idx)->data;
-			line = get_metadata_string_from_fd (idata->src_file,
+			line = get_metadata_tagset_string (idata->src_file,
 					     		    TAG_NAME_SETS[FOCAL_TAG_NAMES]);
 			write_markup_escape_line (line, fout);
 			break;
@@ -1820,14 +1820,14 @@
 		case GTH_TAG_EXIF_CAMERA_MODEL:
 			idx = get_image_idx (tag, ce);
 			idata = g_list_nth (ce->file_list, idx)->data;
-			line = get_metadata_string_from_fd (idata->src_file,
+			line = get_metadata_tagset_string (idata->src_file,
 							    TAG_NAME_SETS[MAKE_TAG_NAMES]);
 			write_markup_escape_line (line, fout);
 			g_free (line);
 
 			write_line (" &nbsp; ", fout);
 
-			line = get_metadata_string_from_fd (idata->src_file,
+			line = get_metadata_tagset_string (idata->src_file,
 					    		    TAG_NAME_SETS[MODEL_TAG_NAMES]);
 			write_markup_escape_line (line, fout);
 			break;

Modified: trunk/src/gth-fullscreen.c
==============================================================================
--- trunk/src/gth-fullscreen.c	(original)
+++ trunk/src/gth-fullscreen.c	Tue Feb  5 13:44:27 2008
@@ -893,10 +893,10 @@
                 );
 
         /* load exif data */
-	exif_exposure_time   = get_metadata_string_from_fd (current_file, TAG_NAME_SETS[EXPTIME_TAG_NAMES]);
-	exif_ISOSpeed_rating = get_metadata_string_from_fd (current_file, TAG_NAME_SETS[ISOSPEED_TAG_NAMES]);
-	exif_aperture_value =  get_metadata_string_from_fd (current_file, TAG_NAME_SETS[APERTURE_TAG_NAMES]);
-	exif_focal_length =    get_metadata_string_from_fd (current_file, TAG_NAME_SETS[FOCAL_TAG_NAMES]);
+	exif_exposure_time   = get_metadata_tagset_string (current_file, TAG_NAME_SETS[EXPTIME_TAG_NAMES]);
+	exif_ISOSpeed_rating = get_metadata_tagset_string (current_file, TAG_NAME_SETS[ISOSPEED_TAG_NAMES]);
+	exif_aperture_value =  get_metadata_tagset_string (current_file, TAG_NAME_SETS[APERTURE_TAG_NAMES]);
+	exif_focal_length =    get_metadata_tagset_string (current_file, TAG_NAME_SETS[FOCAL_TAG_NAMES]);
 
         
         /* build exif info string */



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