Commit c555961a authored by Michael J. Chudobiak's avatar Michael J. Chudobiak Committed by Michael J. Chudobiak
Browse files

Updated some tagsets that will be needed for comments.

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.


svn path=/trunk/; revision=2255
parent c4b62b64
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.
2008-02-05 Michael J. Chudobiak <mjc@svn.gnome.org>
* libgthumb/gth-exiv2-utils.cpp:
......
......@@ -106,6 +106,25 @@ const char *_ORIENTATION_TAG_NAMES[] = {
"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 @@ const char **TAG_NAME_SETS[] = {
_MAKE_TAG_NAMES,
_MODEL_TAG_NAMES,
_FLASH_TAG_NAMES,
_ORIENTATION_TAG_NAMES
_ORIENTATION_TAG_NAMES,
_COMMENT_TAG_NAMES,
_LOCATION_TAG_NAMES,
_KEYWORD_TAG_NAMES
};
......
......@@ -71,7 +71,10 @@ enum {
MAKE_TAG_NAMES,
MODEL_TAG_NAMES,
FLASH_TAG_NAMES,
ORIENTATION_TAG_NAMES
ORIENTATION_TAG_NAMES,
COMMENT_TAG_NAMES,
LOCATION_TAG_NAMES,
KEYWORD_TAG_NAMES
};
......
......@@ -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 @@ struct _GthBrowserPrivateData {
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 @@ update_image_comment (GthBrowser *browser)
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 @@ update_image_comment (GthBrowser *browser)
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,17 +1668,18 @@ gth_browser_set_sidebar (GthBrowser *browser,
static void
save_pixbuf__jpeg_data_saved_cb (const char *uri,
GnomeVFSResult result,
save_pixbuf__image_saved_cb (FileData *file,
gpointer data)
{
GthBrowser *browser = data;
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);
if (file->path != NULL)
browser->priv->image_path_saved = g_strdup (file->path);
browser->priv->image_modified = FALSE;
browser->priv->saving_modified_image = FALSE;
......@@ -1713,85 +1689,14 @@ save_pixbuf__jpeg_data_saved_cb (const char *uri,
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)
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);
}
}
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);
}
#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 @@ gth_browser_finalize (GObject *object)
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;
......
......@@ -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 @@ struct _GthViewerPrivateData {
FileData *image;
gboolean image_error;
#ifdef HAVE_LIBIPTCDATA
IptcData *iptc_data;
#endif /* HAVE_LIBIPTCDATA */
/* misc */
guint cnxn_id[GCONF_NOTIFICATIONS];
......@@ -282,13 +272,6 @@ gth_viewer_finalize (GObject *object)
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 @@ update_image_comment (GthViewer *viewer)
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,11 +781,13 @@ viewer_update_open_with_menu (GthViewer *viewer)
static void
save_pixbuf__jpeg_data_saved_cb (const char *uri,
GnomeVFSResult result,
save_pixbuf__image_saved_cb (FileData *file,
gpointer data)
{
GthViewer *viewer = data;
if (file != NULL)
{
gboolean closing = viewer->priv->closing;
viewer->priv->image_modified = FALSE;
......@@ -825,9 +798,9 @@ save_pixbuf__jpeg_data_saved_cb (const char *uri,
if (closing)
return;
if ((viewer->priv->image != NULL) && ! same_uri (viewer->priv->image->path, uri)) {
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, uri);
file_data_set_path (viewer->priv->image, file->path);
gth_viewer_load (viewer, viewer->priv->image);
}
else {
......@@ -836,78 +809,7 @@ save_pixbuf__jpeg_data_saved_cb (const char *uri,
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);
else
viewer->priv->saving_modified_image = FALSE;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment