gthumb r2255 - in trunk: . libgthumb src



Author: mjc
Date: Tue Feb  5 17:32:28 2008
New Revision: 2255
URL: http://svn.gnome.org/viewvc/gthumb?rev=2255&view=rev

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

        * libgthumb/gth-exif-utils.c:
        * libgthumb/gth-exif-utils.h:
        Updated some tagsets that will be needed for comments.

        * src/gth-browser.c: (update_image_comment),
        (save_pixbuf__image_saved_cb), (gth_browser_finalize):
        * src/gth-viewer.c: (gth_viewer_finalize), (update_image_comment),
        (save_pixbuf__image_saved_cb):
        Removed the ifdef'd libiptcdata code, which has been obsoleted
        by exiv2 support.



Modified:
   trunk/ChangeLog
   trunk/libgthumb/gth-exif-utils.c
   trunk/libgthumb/gth-exif-utils.h
   trunk/src/gth-browser.c
   trunk/src/gth-viewer.c

Modified: trunk/libgthumb/gth-exif-utils.c
==============================================================================
--- trunk/libgthumb/gth-exif-utils.c	(original)
+++ trunk/libgthumb/gth-exif-utils.c	Tue Feb  5 17:32:28 2008
@@ -106,6 +106,25 @@
 	"Xmp.tiff.Orientation",
 	NULL };
 
+const char *_COMMENT_TAG_NAMES[] = {
+        "Exif.Photo.UserComment",
+        "Exif.Image.ImageDescription",
+	"Xmp.tiff.ImageDescription",
+	"Xmp.dc.description",
+	"Iptc.Application2.Caption",
+        NULL };
+
+const char *_LOCATION_TAG_NAMES[] = {
+        "Xmp.iptc.Location",
+        "Iptc.Application2.LocationName",
+        NULL };
+
+const char *_KEYWORD_TAG_NAMES[] = {
+        "Xmp.dc.subject",
+        "Iptc.Application2.Keywords",
+        NULL };
+
+
 /* if you add something here, also update the matching enum in gth-exif-utils.h */
 const char **TAG_NAME_SETS[] = {
         _DATE_TAG_NAMES,
@@ -118,7 +137,10 @@
 	_MAKE_TAG_NAMES,
 	_MODEL_TAG_NAMES,
 	_FLASH_TAG_NAMES,
-	_ORIENTATION_TAG_NAMES
+	_ORIENTATION_TAG_NAMES,
+	_COMMENT_TAG_NAMES,
+	_LOCATION_TAG_NAMES,
+	_KEYWORD_TAG_NAMES
 };
 
 

Modified: trunk/libgthumb/gth-exif-utils.h
==============================================================================
--- trunk/libgthumb/gth-exif-utils.h	(original)
+++ trunk/libgthumb/gth-exif-utils.h	Tue Feb  5 17:32:28 2008
@@ -71,7 +71,10 @@
 	MAKE_TAG_NAMES,
 	MODEL_TAG_NAMES,
 	FLASH_TAG_NAMES,
-	ORIENTATION_TAG_NAMES
+	ORIENTATION_TAG_NAMES,
+	COMMENT_TAG_NAMES,
+	LOCATION_TAG_NAMES,
+	KEYWORD_TAG_NAMES
 };
 
 

Modified: trunk/src/gth-browser.c
==============================================================================
--- trunk/src/gth-browser.c	(original)
+++ trunk/src/gth-browser.c	Tue Feb  5 17:32:28 2008
@@ -72,12 +72,6 @@
 #include "dlg-scripts.h"
 
 #include "jpegutils/jpeg-data.h"
-
-#ifdef HAVE_LIBIPTCDATA
-#include <libiptcdata/iptc-data.h>
-#include <libiptcdata/iptc-jpeg.h>
-#endif /* HAVE_LIBIPTCDATA */
-
 #include "icons/pixbufs.h"
 
 #define GCONF_NOTIFICATIONS 20
@@ -242,10 +236,6 @@
 	guint               view_image_timeout; /* timer for the
 						 * view_image_at_pos function.
 						 */
-#ifdef HAVE_LIBIPTCDATA
-	IptcData           *iptc_data;
-#endif /* HAVE_LIBIPTCDATA */
-
 	/* misc */
 
 	char               *monitor_uri;
@@ -511,13 +501,6 @@
 	char                  *comment = NULL;
 	GtkTextBuffer         *text_buffer;
 
-#ifdef HAVE_LIBIPTCDATA
-	if (priv->iptc_data != NULL) {
-		iptc_data_unref (priv->iptc_data);
-		priv->iptc_data = NULL;
-	}
-#endif /* HAVE_LIBIPTCDATA */
-
 	text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->image_comment));
 
 	if (priv->image == NULL) {
@@ -529,14 +512,6 @@
 
 	cdata = comments_load_comment (priv->image->path, TRUE);
 
-#ifdef HAVE_LIBIPTCDATA
-	if (cdata != NULL) {
-		priv->iptc_data = cdata->iptc_data;
-		if (priv->iptc_data != NULL)
-			iptc_data_ref (priv->iptc_data);
-	}
-#endif /* HAVE_LIBIPTCDATA */
-
 	if (comment_text_is_void (cdata)) {
 		GtkTextIter  iter;
 		const char  *click_here = _("[Press 'c' to add a comment]");
@@ -1693,105 +1668,35 @@
 
 
 static void
-save_pixbuf__jpeg_data_saved_cb (const char     *uri,
-				 GnomeVFSResult  result,
-    				 gpointer        data)
+save_pixbuf__image_saved_cb (FileData *file,
+			     gpointer  data)
 {
 	GthBrowser *browser = data;
-	gboolean    closing = browser->priv->closing;
+	
+	if (file != NULL) {
+		gboolean closing = browser->priv->closing;
 			
-	g_free (browser->priv->image_path_saved);
-	browser->priv->image_path_saved = NULL;
-	if (uri != NULL)
-		browser->priv->image_path_saved = g_strdup (uri);
+		g_free (browser->priv->image_path_saved);
+		browser->priv->image_path_saved = NULL;
+		if (file->path != NULL)
+			browser->priv->image_path_saved = g_strdup (file->path);
 
-	browser->priv->image_modified = FALSE;
-	browser->priv->saving_modified_image = FALSE;
-	if (browser->priv->image_saved_func != NULL)
-		(*browser->priv->image_saved_func) (NULL, browser);
+		browser->priv->image_modified = FALSE;
+		browser->priv->saving_modified_image = FALSE;
+		if (browser->priv->image_saved_func != NULL)
+			(*browser->priv->image_saved_func) (NULL, browser);
 
-	if (! closing) {
-		GList *file_list;
+		if (! closing) {
+			GList *file_list;
 		
-		file_list = g_list_prepend (NULL, (char*) uri);
-		if (gth_file_list_pos_from_path (browser->priv->file_list, uri) != -1)
-			all_windows_notify_files_changed (file_list);
-		else
-			all_windows_notify_files_created (file_list);
-		g_list_free (file_list);
-	}
-}
-
-
-static CopyData*
-save_jpeg_data (GthBrowser   *browser,
-		FileData     *file,
-		CopyDoneFunc  done_func,
-		gpointer      done_data)
-{
-	GthBrowserPrivateData *priv = browser->priv;
-	gboolean               data_to_save = FALSE;
-	JPEGData              *jdata;
-	char                  *local_file = NULL;
-
-	local_file = get_cache_filename_from_uri (file->path);
-	if (local_file == NULL)
-		return update_file_from_cache (file, done_func, done_data);
-
-	if (! image_is_jpeg (file->path))
-		return update_file_from_cache (file, done_func, done_data);
-
-#ifdef HAVE_LIBIPTCDATA
-	if (priv->iptc_data != NULL)
-		data_to_save = TRUE;
-#endif /* HAVE_LIBIPTCDATA */
-
-	if (! data_to_save)
-		return update_file_from_cache (file, done_func, done_data);
-
-	jdata = jpeg_data_new_from_file (local_file);
-	if (jdata == NULL)
-		return update_file_from_cache (file, done_func, done_data);
-
-#ifdef HAVE_LIBIPTCDATA
-	if (priv->iptc_data != NULL) {
-		unsigned char *out_buf, *iptc_buf;
-		unsigned int   iptc_len, ps3_len;
-
-		out_buf = g_malloc (256*256);
-		iptc_data_save (priv->iptc_data, &iptc_buf, &iptc_len);
-		ps3_len = iptc_jpeg_ps3_save_iptc (NULL, 0, iptc_buf,
-						   iptc_len, out_buf, 256*256);
-		iptc_data_free_buf (priv->iptc_data, iptc_buf);
-		if (ps3_len > 0)
-			jpeg_data_set_header_data (jdata,
-						   JPEG_MARKER_APP13,
-						   out_buf, 
-						   ps3_len);
-		g_free (out_buf);
+			file_list = g_list_prepend (NULL, (char*) file->path);
+			if (gth_file_list_pos_from_path (browser->priv->file_list, file->path) != -1)
+				all_windows_notify_files_changed (file_list);
+			else
+				all_windows_notify_files_created (file_list);
+			g_list_free (file_list);
+		}
 	}
-#endif /* HAVE_LIBIPTCDATA */
-
-	jpeg_data_save_file (jdata, local_file);
-	jpeg_data_unref (jdata);
-
-	g_free (local_file);
-	
-	return update_file_from_cache (file, done_func, done_data);
-}
-
-
-static void
-save_pixbuf__image_saved_cb (FileData *file,
-			     gpointer  data)
-{
-	GthBrowser *browser = data;
-	
-	if (file != NULL)
-		save_jpeg_data (browser, 
-				file, 
-				save_pixbuf__jpeg_data_saved_cb,
-				browser);
 	else
 		browser->priv->saving_modified_image = FALSE;
 }
@@ -5537,13 +5442,6 @@
 			priv->image_path_saved = NULL;
 		}
 
-#ifdef HAVE_LIBIPTCDATA
-		if (priv->iptc_data != NULL) {
-			iptc_data_unref (priv->iptc_data);
-			priv->iptc_data = NULL;
-		}
-#endif /* HAVE_LIBIPTCDATA */
-
 		if (priv->new_image) {
 			file_data_unref (priv->new_image);
 			priv->new_image = NULL;

Modified: trunk/src/gth-viewer.c
==============================================================================
--- trunk/src/gth-viewer.c	(original)
+++ trunk/src/gth-viewer.c	Tue Feb  5 17:32:28 2008
@@ -31,12 +31,6 @@
 #include <libgnomevfs/gnome-vfs-mime.h>
 
 #include "jpegutils/jpeg-data.h"
-
-#ifdef HAVE_LIBIPTCDATA
-#include <libiptcdata/iptc-data.h>
-#include <libiptcdata/iptc-jpeg.h>
-#endif /* HAVE_LIBIPTCDATA */
-
 #include "comments.h"
 #include "dlg-save-image.h"
 #include "dlg-categories.h"
@@ -122,10 +116,6 @@
 	FileData        *image;
 	gboolean         image_error;
 
-#ifdef HAVE_LIBIPTCDATA
-	IptcData        *iptc_data;
-#endif /* HAVE_LIBIPTCDATA */
-
 	/* misc */
 
 	guint            cnxn_id[GCONF_NOTIFICATIONS];
@@ -282,13 +272,6 @@
 			if (viewer->priv->cnxn_id[i] != -1)
 				eel_gconf_notification_remove (viewer->priv->cnxn_id[i]);
 
-#ifdef HAVE_LIBIPTCDATA
-		if (priv->iptc_data != NULL) {
-			iptc_data_unref (priv->iptc_data);
-			priv->iptc_data = NULL;
-		}
-#endif /* HAVE_LIBIPTCDATA */
-
 		file_data_unref (priv->image);
 		file_data_unref (priv->new_image);
 
@@ -637,18 +620,6 @@
 	char                 *comment;
 	GtkTextBuffer        *text_buffer;
 
-#ifdef HAVE_LIBIPTCDATA
-	if (priv->iptc_data != NULL) {
-		iptc_data_unref (priv->iptc_data);
-		priv->iptc_data = NULL;
-	}
-	if (priv->image != NULL) {
-		char *local_file = get_cache_filename_from_uri (priv->image->path);
-		priv->iptc_data = iptc_data_new_from_jpeg (local_file);
-		g_free (local_file);
-	}
-#endif /* HAVE_LIBIPTCDATA */
-
 	text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->image_comment));
 
 	if (priv->image == NULL) {
@@ -810,104 +781,35 @@
 
 
 static void
-save_pixbuf__jpeg_data_saved_cb (const char     *uri,
-				 GnomeVFSResult  result,
-    				 gpointer        data)
-{
-	GthViewer *viewer = data;
-	gboolean   closing = viewer->priv->closing;
-	
-	viewer->priv->image_modified = FALSE;
-	viewer->priv->saving_modified_image = FALSE;
-	if (viewer->priv->image_saved_func != NULL)
-		(*viewer->priv->image_saved_func) (NULL, viewer);
-
-	if (closing)
-		return;
-
-	if ((viewer->priv->image != NULL) && ! same_uri (viewer->priv->image->path, uri)) {
-		/*FIXME: gtk_widget_show (gth_viewer_new (uri));*/
-		file_data_set_path (viewer->priv->image, uri);
-		gth_viewer_load (viewer, viewer->priv->image);
-	}
-	else {
-		viewer_update_statusbar_image_info (viewer);
-		viewer_update_image_info (viewer);
-		viewer_update_title (viewer);
-		viewer_update_sensitivity (viewer);
-	}	
-}
-
-
-static CopyData*
-save_jpeg_data (GthViewer    *viewer,
-		FileData     *file,
-		CopyDoneFunc  done_func,
-		gpointer      done_data)
-{
-	GthViewerPrivateData  *priv = viewer->priv;
-	gboolean               data_to_save = FALSE;
-	JPEGData              *jdata;
-        char                  *local_file = NULL;
-
-	local_file = get_cache_filename_from_uri (file->path);
-	if (local_file == NULL)
-		return update_file_from_cache (file, done_func, done_data);
-
-	if (! image_is_jpeg (local_file))
-		return update_file_from_cache (file, done_func, done_data);
-
-#ifdef HAVE_LIBIPTCDATA
-	if (priv->iptc_data != NULL)
-		data_to_save = TRUE;
-#endif /* HAVE_LIBIPTCDATA */
-
-	if (! data_to_save)
-		return update_file_from_cache (file, done_func, done_data);
-
-	jdata = jpeg_data_new_from_file (local_file);
-	if (jdata == NULL)
-		return update_file_from_cache (file, done_func, done_data);
-
-#ifdef HAVE_LIBIPTCDATA
-	if (priv->iptc_data != NULL) {
-		guchar *out_buf, *iptc_buf;
-		guint   iptc_len, ps3_len;
-
-		out_buf = g_malloc (256*256);
-		iptc_data_save (priv->iptc_data, &iptc_buf, &iptc_len);
-		ps3_len = iptc_jpeg_ps3_save_iptc (NULL, 0, iptc_buf,
-						   iptc_len, out_buf, 256*256);
-		iptc_data_free_buf (priv->iptc_data, iptc_buf);
-		if (ps3_len > 0)
-			jpeg_data_set_header_data (jdata,
-						   JPEG_MARKER_APP13,
-						   out_buf, 
-						   ps3_len);
-		g_free (out_buf);
-	}
-#endif /* HAVE_LIBIPTCDATA */
-
-	jpeg_data_save_file (jdata, local_file);
-	jpeg_data_unref (jdata);
-
-        g_free (local_file);
-        
-        return update_file_from_cache (file, done_func, done_data);
-}
-
-
-static void
 save_pixbuf__image_saved_cb (FileData *file,
 			     gpointer  data)
 {
 	GthViewer *viewer = data;
 	
 	if (file != NULL)
-		save_jpeg_data (viewer, 
-				file, 
-				save_pixbuf__jpeg_data_saved_cb,
-				viewer);
+		{
+		gboolean closing = viewer->priv->closing;
+
+		viewer->priv->image_modified = FALSE;
+		viewer->priv->saving_modified_image = FALSE;
+		if (viewer->priv->image_saved_func != NULL)
+			(*viewer->priv->image_saved_func) (NULL, viewer);
+
+		if (closing)
+			return;
+	
+		if ((viewer->priv->image != NULL) && ! same_uri (viewer->priv->image->path, file->path)) {
+			/*FIXME: gtk_widget_show (gth_viewer_new (uri));*/
+			file_data_set_path (viewer->priv->image, file->path);
+			gth_viewer_load (viewer, viewer->priv->image);
+		}
+		else {
+			viewer_update_statusbar_image_info (viewer);
+			viewer_update_image_info (viewer);
+			viewer_update_title (viewer);
+			viewer_update_sensitivity (viewer);
+		}	
+	}
 	else
 		viewer->priv->saving_modified_image = FALSE;
 }



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