gthumb r2245 - in trunk: . libgthumb src



Author: mjc
Date: Sun Feb  3 20:21:56 2008
New Revision: 2245
URL: http://svn.gnome.org/viewvc/gthumb?rev=2245&view=rev

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

        * libgthumb/dlg-save-image.c: (save_image):
        * libgthumb/pixbuf-utils.c: (_gdk_pixbuf_savev),
        (_gdk_pixbuf_save):
        * libgthumb/pixbuf-utils.h:
        * src/catalog-png-exporter.c: (end_page):
        * src/catalog-web-exporter.c: (save_thumbnail_cb),
        (save_image_preview_cb), (save_resized_image_cb):
        * src/dlg-convert.c: (save_image_and_remove_original):
        * src/gth-batch-op.c: (pixbuf_op_done_cb):
        * src/gth-window-actions-callbacks.c:
        (gth_window_activate_action_file_print),
        (set_wallpaper_from_window):
        * src/rotation-utils.c: (apply_transformation_generic):
        Add support for metadata handling into the _gdk_pixbuf_save /
        _gdk_pixbuf_savev functions. Not fully exploited yet.



Modified:
   trunk/ChangeLog
   trunk/libgthumb/dlg-save-image.c
   trunk/libgthumb/pixbuf-utils.c
   trunk/libgthumb/pixbuf-utils.h
   trunk/src/catalog-png-exporter.c
   trunk/src/catalog-web-exporter.c
   trunk/src/dlg-convert.c
   trunk/src/gth-batch-op.c
   trunk/src/gth-window-actions-callbacks.c
   trunk/src/rotation-utils.c

Modified: trunk/libgthumb/dlg-save-image.c
==============================================================================
--- trunk/libgthumb/dlg-save-image.c	(original)
+++ trunk/libgthumb/dlg-save-image.c	Sun Feb  3 20:21:56 2008
@@ -116,6 +116,7 @@
 			local_file = get_cache_filename_from_uri (file->path);
 			if (_gdk_pixbuf_savev (pixbuf,
 					       local_file,
+					       NULL, /* FIXME - add metadata */
 					       image_type,
 					       keys, values,
 					       &error))

Modified: trunk/libgthumb/pixbuf-utils.c
==============================================================================
--- trunk/libgthumb/pixbuf-utils.c	(original)
+++ trunk/libgthumb/pixbuf-utils.c	Sun Feb  3 20:21:56 2008
@@ -76,6 +76,7 @@
 #include <stdlib.h>
 #include "pixbuf-utils.h"
 #include "file-utils.h"
+#include "gth-exif-utils.h"
 
 #ifdef HAVE_LIBTIFF
 #include <tiffio.h>
@@ -1195,6 +1196,7 @@
 gboolean
 _gdk_pixbuf_savev (GdkPixbuf    *pixbuf,
 		   const char   *local_file,
+		   GList	*metadata,
 		   const char   *type,
 		   char        **keys,
 		   char        **values,
@@ -1231,6 +1233,14 @@
 					   keys, values,
 					   error);
 
+	if (result == TRUE) {
+		update_and_save_metadata (local_file, local_file, metadata);
+
+		/* Saving from pixbuf always implies top-left orientation */
+		update_and_save_metadatum (local_file, local_file, "Exif.Image.Orientation", "1");
+	}
+				
+
 	return result;
 }
 
@@ -1274,6 +1284,7 @@
 gboolean
 _gdk_pixbuf_save (GdkPixbuf    *pixbuf,
 		  const char   *local_file,
+		  GList	       *metadata,
 		  const char   *type,
 		  GError      **error,
 		  ...)
@@ -1292,9 +1303,8 @@
 	collect_save_options (args, &keys, &values);
 	va_end (args);
 
-	result = _gdk_pixbuf_savev (pixbuf, local_file, type,
-				    keys, values,
-				    error);
+	result = _gdk_pixbuf_savev (pixbuf, local_file, metadata, type,
+				    keys, values, error);
 
 	g_strfreev (keys);
 	g_strfreev (values);

Modified: trunk/libgthumb/pixbuf-utils.h
==============================================================================
--- trunk/libgthumb/pixbuf-utils.h	(original)
+++ trunk/libgthumb/pixbuf-utils.h	Sun Feb  3 20:21:56 2008
@@ -47,11 +47,13 @@
 					       GthTransform     transform);
 gboolean   _gdk_pixbuf_save                   (GdkPixbuf       *pixbuf,
 					       const char      *filename,
+					       GList	       *metadata,
 					       const char      *type,
 					       GError         **error,
 					       ...);
 gboolean   _gdk_pixbuf_savev                  (GdkPixbuf       *pixbuf,
 					       const char      *filename,
+					       GList           *metadata,
 					       const char      *type,
 					       char           **keys,
 					       char           **values,

Modified: trunk/src/catalog-png-exporter.c
==============================================================================
--- trunk/src/catalog-png-exporter.c	(original)
+++ trunk/src/catalog-png-exporter.c	Sun Feb  3 20:21:56 2008
@@ -1736,9 +1736,9 @@
 	local_file = get_cache_filename_from_uri (uri);
 	
 	if (strcmp (ce->file_type, "jpeg") == 0)
-		_gdk_pixbuf_save (pixbuf, local_file, "jpeg", NULL, "quality", "85", NULL);
+		_gdk_pixbuf_save (pixbuf, local_file, NULL, "jpeg", NULL, "quality", "85", NULL);
 	else
-		_gdk_pixbuf_save (pixbuf, local_file, ce->file_type, NULL, NULL);
+		_gdk_pixbuf_save (pixbuf, local_file, NULL, ce->file_type, NULL, NULL);
 
 	ce->created_files = g_list_prepend (ce->created_files, uri);
 

Modified: trunk/src/catalog-web-exporter.c
==============================================================================
--- trunk/src/catalog-web-exporter.c	(original)
+++ trunk/src/catalog-web-exporter.c	Sun Feb  3 20:21:56 2008
@@ -2086,14 +2086,6 @@
 }
 
 
-static void
-copy_exif_from_orig_and_reset_orientation (FileData   *file,
-		     			   const char *dest_uri)
-{
-	update_and_save_metadatum (file->path, dest_uri, "Exif.Image.Orientation", "1");
-}
-
-
 static gboolean
 save_thumbnail_cb (gpointer data)
 {
@@ -2126,12 +2118,11 @@
 		
 		debug (DEBUG_INFO, "save thumbnail: %s", local_file);
 
-		if (_gdk_pixbuf_save (idata->thumb,
-				      local_file,
-				      "jpeg",
-				      NULL, NULL)) {
-			copy_exif_from_orig_and_reset_orientation (idata->src_file, thumb_uri);
-		} 
+		_gdk_pixbuf_save (idata->thumb,
+				  local_file,
+				  idata->src_file->metadata,
+				  "jpeg",
+				  NULL, NULL); 
 
 		g_free (local_file);
 		g_free (thumb_uri);
@@ -2405,12 +2396,13 @@
 			
 			debug (DEBUG_INFO, "saving preview: %s", local_file);
 
-			if (_gdk_pixbuf_save (idata->preview,
-					      local_file,
-					      "jpeg",
-					      NULL, NULL)) {
-				copy_exif_from_orig_and_reset_orientation (idata->src_file, preview_uri);
-			}
+			update_metadata (idata->src_file);
+
+			_gdk_pixbuf_save (idata->preview,
+					  local_file,
+					  idata->src_file->metadata,
+					  "jpeg",
+					  NULL, NULL);
 			 
 			g_free (local_file);
 			g_free (preview_uri);
@@ -2447,11 +2439,13 @@
 			
 			debug (DEBUG_INFO, "saving image: %s", local_file);
 
+			update_metadata (idata->src_file);
+
 			if (_gdk_pixbuf_save (idata->image,
 					      local_file,
+					      idata->src_file->metadata,
 					      "jpeg",
 					      NULL, NULL)) {
-				copy_exif_from_orig_and_reset_orientation (idata->src_file, image_uri);
 				idata->src_file->size = get_file_size (image_uri);
 			} 
 			

Modified: trunk/src/dlg-convert.c
==============================================================================
--- trunk/src/dlg-convert.c	(original)
+++ trunk/src/dlg-convert.c	Sun Feb  3 20:21:56 2008
@@ -254,6 +254,7 @@
 	local_file = get_cache_filename_from_uri (data->new_path);
 	if (! _gdk_pixbuf_savev (data->pixbuf,
 			         local_file,
+				 NULL, /* TODO: data->current_image->data->metadata ? */
 			         data->image_type,
 			         data->keys,
 			         data->values,

Modified: trunk/src/gth-batch-op.c
==============================================================================
--- trunk/src/gth-batch-op.c	(original)
+++ trunk/src/gth-batch-op.c	Sun Feb  3 20:21:56 2008
@@ -473,6 +473,7 @@
 	local_file = get_cache_filename_from_uri (PD(bop)->new_path);
 	if (! _gdk_pixbuf_savev (pixop->dest,
 			         local_file,
+				 NULL, /* TODO: is this OK? No metadata? */
 			         PD(bop)->image_type,
 			         PD(bop)->keys,
 			         PD(bop)->values,

Modified: trunk/src/gth-window-actions-callbacks.c
==============================================================================
--- trunk/src/gth-window-actions-callbacks.c	(original)
+++ trunk/src/gth-window-actions-callbacks.c	Sun Feb  3 20:21:56 2008
@@ -223,6 +223,7 @@
 		tmp_filename = get_temp_file_name (tmp_dir, ".jpeg");
 		if (! _gdk_pixbuf_save (pixbuf,
 					tmp_filename,
+					NULL,
 					"jpeg",
 					&error,
 					NULL)) 
@@ -792,6 +793,7 @@
 		local_file = get_local_path_from_uri (wallpaper_filename);
 		if (! _gdk_pixbuf_save (pixbuf,
 					local_file,
+					NULL,
 					"jpeg",
 					&error,
 					NULL)) 

Modified: trunk/src/rotation-utils.c
==============================================================================
--- trunk/src/rotation-utils.c	(original)
+++ trunk/src/rotation-utils.c	Sun Feb  3 20:21:56 2008
@@ -266,6 +266,7 @@
 		
 		success = _gdk_pixbuf_save (transformed_pixbuf,
 					    local_file,
+					    file->metadata,
 					    image_type,
 					    error,
 					    NULL);



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