gthumb r2212 - in trunk: . libgthumb src



Author: mjc
Date: Mon Jan 21 15:44:22 2008
New Revision: 2212
URL: http://svn.gnome.org/viewvc/gthumb?rev=2212&view=rev

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

        * libgthumb/gth-exif-utils.c: (metadata_search),
        (get_metadata_time_from_fd), (free_metadata_entry), (dup_metadata):
        * libgthumb/gth-exif-utils.h:
        * libgthumb/gth-exiv2-utils.cpp:
        * libgthumb/gth-gstreamer-utils.c: (add_metadata):
        * src/gth-exif-data-viewer.c: (gth_exif_data_viewer_construct),
        (tag_is_present_in_category), (add_to_exif_display_list),
        (add_to_display), (update_file_info):
        Split the "writeable_path" field of the metadata entry struct into
        two bits: "full_name" for the full tag name, and "writeable" to
        indicate if the tag can be edited.



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	Mon Jan 21 15:44:22 2008
@@ -36,13 +36,13 @@
 
 
 const char *DATE_TAG_NAMES[] = {
-	"DateTimeOriginal",
-	"exif.DateTimeOriginal",
-	"DateTimeDigitized",
-	"exif.DateTimeDigitized",
-	"DateTime",
-	"exif.DateTime",
-	"photoshop.DateCreated"	};
+	"Exif.Photo.DateTimeOriginal",
+	"Xmp.exif.DateTimeOriginal",
+	"Exif.Photo.DateTimeDigitized",
+	"Xmp.exif.DateTimeDigitized",
+	"Exif.Image.DateTime",
+	"Xmp.exif.DateTime",
+	"Xmp.photoshop.DateCreated" };
 
 
 ExifData *
@@ -151,7 +151,7 @@
 metadata_search (GthMetadata *a,
 			char *b)
 {
-	return strcmp (a->display_name, b);
+	return strcmp (a->full_name, b);
 }
 
 
@@ -163,7 +163,7 @@
 	time_t  result = 0;
 
 	for (i = 0; (i < G_N_ELEMENTS (DATE_TAG_NAMES)) && (date == NULL); i++) {			
-		GList *search_result = g_list_find_custom (fd->metadata, DATE_TAG_NAMES[i], (GCompareFunc)metadata_search);
+		GList *search_result = g_list_find_custom (fd->metadata, DATE_TAG_NAMES[i], (GCompareFunc) metadata_search);
 		if (search_result != NULL) {
 			GthMetadata *md_entry = search_result->data;
 			date = g_strdup (md_entry->value);
@@ -623,7 +623,7 @@
 void free_metadata_entry (GthMetadata *entry)
 {
 	if (entry != NULL) {
-		g_free (entry->writeable_path);
+		g_free (entry->full_name);
 		g_free (entry->display_name);
 		g_free (entry->value);
 		g_free (entry);
@@ -648,11 +648,12 @@
 		GthMetadata *source_entry = source_list->data;
 		GthMetadata *new_entry = g_new0 (GthMetadata, 1);
 		
-		new_entry->writeable_path = g_strdup (source_entry->writeable_path);
+		new_entry->full_name = g_strdup (source_entry->full_name);
 		new_entry->display_name = g_strdup (source_entry->display_name);
 		new_entry->value = g_strdup (source_entry->value);
 		new_entry->category = source_entry->category;
 		new_entry->position = source_entry->position;
+		new_entry->writeable = source_entry->writeable;
 		
 		new_list = g_list_prepend (new_list, new_entry);
 		

Modified: trunk/libgthumb/gth-exif-utils.h
==============================================================================
--- trunk/libgthumb/gth-exif-utils.h	(original)
+++ trunk/libgthumb/gth-exif-utils.h	Mon Jan 21 15:44:22 2008
@@ -66,10 +66,11 @@
  
 typedef struct {
         GthMetadataCategory category;
-	char *writeable_path;
-        char *display_name;
-        char *value;
-        int   position;
+	char    *full_name;
+        char    *display_name;
+        char    *value;
+        int      position;
+	gboolean writeable;
 } GthMetadata;
 
 

Modified: trunk/libgthumb/gth-exiv2-utils.cpp
==============================================================================
--- trunk/libgthumb/gth-exiv2-utils.cpp	(original)
+++ trunk/libgthumb/gth-exiv2-utils.cpp	Mon Jan 21 15:44:22 2008
@@ -363,7 +363,7 @@
 /* Add the tag the gThumb metadata store. */
 inline static GList *
 add (GList              *metadata,
-     const gchar        *writeable_path, 
+     const gchar        *full_name, 
      const gchar        *display_name,
      const gchar	*value,
      GthMetadataCategory category,
@@ -373,10 +373,11 @@
 
 	new_entry = g_new (GthMetadata, 1);
 	new_entry->category = category;
-	new_entry->writeable_path = g_strdup (writeable_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 = position;
+	new_entry->writeable = TRUE;
 	metadata = g_list_prepend (metadata, new_entry);
 
 	return metadata;

Modified: trunk/libgthumb/gth-gstreamer-utils.c
==============================================================================
--- trunk/libgthumb/gth-gstreamer-utils.c	(original)
+++ trunk/libgthumb/gth-gstreamer-utils.c	Mon Jan 21 15:44:22 2008
@@ -350,10 +350,11 @@
 	if (value != NULL) {
 		new_entry = g_new (GthMetadata, 1);
         	new_entry->category = GTH_METADATA_CATEGORY_GSTREAMER;
-		new_entry->writeable_path = NULL;
+		new_entry->full_name = g_strdup (key);
 		new_entry->display_name = key;
         	new_entry->value = value;
 	       	new_entry->position = 0;
+		new_entry->writeable = FALSE;
         	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	Mon Jan 21 15:44:22 2008
@@ -58,10 +58,11 @@
 
 
 enum {
-	WRITEABLE_PATH_COLUMN,
-	NAME_COLUMN,
+	FULL_NAME_COLUMN,
+	DISPLAY_NAME_COLUMN,
 	VALUE_COLUMN,
 	POS_COLUMN,
+	WRITEABLE_COLUMN,
 	NUM_COLUMNS
 };
 
@@ -139,11 +140,12 @@
 	edv->priv->image_exif_view = gtk_tree_view_new ();
 	gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (edv->priv->image_exif_view), FALSE);
 	gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (edv->priv->image_exif_view), TRUE);
-	edv->priv->image_exif_model = gtk_tree_store_new (4,
+	edv->priv->image_exif_model = gtk_tree_store_new (5,
 							  G_TYPE_STRING,
 							  G_TYPE_STRING,
 							  G_TYPE_STRING,
-							  G_TYPE_INT);
+							  G_TYPE_INT,
+							  G_TYPE_BOOLEAN);
 	gtk_tree_view_set_model (GTK_TREE_VIEW (edv->priv->image_exif_view),
 				 GTK_TREE_MODEL (edv->priv->image_exif_model));
 	g_object_unref (edv->priv->image_exif_model);
@@ -154,7 +156,7 @@
 	renderer = gtk_cell_renderer_text_new ();
 	column = gtk_tree_view_column_new_with_attributes ("",
 							   renderer,
-							   "text", NAME_COLUMN,
+							   "text", DISPLAY_NAME_COLUMN,
 							   NULL);
 	gtk_tree_view_column_set_expand (column, FALSE);
 	gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
@@ -258,7 +260,7 @@
 
 		gtk_tree_model_get (model,
 				    &iter,
-				    NAME_COLUMN, &tag_name2,
+				    DISPLAY_NAME_COLUMN, &tag_name2,
 				    -1);
 		if ((tag_name2 != NULL)
 		    && (strcmp (tag_name, tag_name2) == 0)) {
@@ -276,10 +278,11 @@
 static void
 add_to_exif_display_list (GthExifDataViewer   *edv,
 			  GthMetadataCategory  category,
-			  const char	      *writeable_path,
-			  const char 	      *utf8_name,
+			  const char	      *full_name,
+			  const char 	      *display_name,
 			  const char	      *utf8_value,
-	 		  int		       position)
+	 		  int		       position,
+			  gboolean	       writeable)
 {
 	GtkTreeModel *model = GTK_TREE_MODEL (edv->priv->image_exif_model);
 	GtkTreeIter   root_iter;
@@ -289,10 +292,11 @@
 		GtkTreePath *path;
 		gtk_tree_store_append (edv->priv->image_exif_model, &root_iter, NULL);
 		gtk_tree_store_set (edv->priv->image_exif_model, &root_iter,
-				    WRITEABLE_PATH_COLUMN, NULL,
-				    NAME_COLUMN, _(metadata_category_name[category]),
+				    FULL_NAME_COLUMN, NULL,
+				    DISPLAY_NAME_COLUMN, _(metadata_category_name[category]),
 				    VALUE_COLUMN, "",
 				    POS_COLUMN, category,
+				    WRITEABLE_COLUMN, writeable,
 				    -1);
 		path = gtk_tree_model_get_path (model, &root_iter);
 		edv->priv->category_root[category] = gtk_tree_row_reference_new (model, path);
@@ -309,10 +313,11 @@
 
 	gtk_tree_store_append (edv->priv->image_exif_model, &iter, &root_iter);
 	gtk_tree_store_set (edv->priv->image_exif_model, &iter,
-			    WRITEABLE_PATH_COLUMN, writeable_path,
-			    NAME_COLUMN, utf8_name,
+			    FULL_NAME_COLUMN, full_name,
+			    DISPLAY_NAME_COLUMN, display_name,
 			    VALUE_COLUMN, utf8_value,
 			    POS_COLUMN, position,
+			    WRITEABLE_COLUMN, writeable,
 			    -1);
 }
 
@@ -323,10 +328,11 @@
 {
 	add_to_exif_display_list (edv,
 		       		  entry->category,
-				  entry->writeable_path,
+				  entry->full_name,
 			  	  entry->display_name,
 				  entry->value,
-				  entry->position);
+				  entry->position,
+				  entry->writeable);
 }
 
 
@@ -370,15 +376,15 @@
 	
 	/**/
 
-	add_to_exif_display_list (edv, GTH_METADATA_CATEGORY_FILE, NULL, _("Name"), utf8_name, -7);
-	add_to_exif_display_list (edv, GTH_METADATA_CATEGORY_FILE, NULL, _("Path"), utf8_fullname, -6);
+	add_to_exif_display_list (edv, GTH_METADATA_CATEGORY_FILE, NULL, _("Name"), utf8_name, -7, FALSE);
+	add_to_exif_display_list (edv, GTH_METADATA_CATEGORY_FILE, NULL, _("Path"), utf8_fullname, -6, FALSE);
 
 	if (mime_type_is_image (mime_type))
-		add_to_exif_display_list (edv, GTH_METADATA_CATEGORY_FILE, NULL, _("Dimensions"), size_txt, -5);
+		add_to_exif_display_list (edv, GTH_METADATA_CATEGORY_FILE, NULL, _("Dimensions"), size_txt, -5, FALSE);
 
-	add_to_exif_display_list (edv, GTH_METADATA_CATEGORY_FILE, NULL, _("Size"), file_size_txt, -4);
-	add_to_exif_display_list (edv, GTH_METADATA_CATEGORY_FILE, NULL, _("Modified"), utf8_time_txt, -3);
-	add_to_exif_display_list (edv, GTH_METADATA_CATEGORY_FILE, NULL, _("Type"), mime_type, -2);
+	add_to_exif_display_list (edv, GTH_METADATA_CATEGORY_FILE, NULL, _("Size"), file_size_txt, -4, FALSE);
+	add_to_exif_display_list (edv, GTH_METADATA_CATEGORY_FILE, NULL, _("Modified"), utf8_time_txt, -3, FALSE);
+	add_to_exif_display_list (edv, GTH_METADATA_CATEGORY_FILE, NULL, _("Type"), mime_type, -2, FALSE);
 
 	/**/
 



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