Commit 9cf7d2fa authored by Paolo Bacchilega's avatar Paolo Bacchilega Committed by Paolo Bacchilega
Browse files

remove remove unnecessary #ifdefs

2006-10-08  Paolo Bacchilega  <paobac@cvs.gnome.org>

    * many files: remove remove unnecessary #ifdefs

    Patch by Rennie deGraaf

    * configure.in: Patch to make libexif and libjpeg mandatory (v2)

    Patch by Rennie deGraaf

	* many files:

	Applied patch by Michael Chudobiak from bug #343867 comment #130

	Merged branch exif-testing:

2006-10-06  Bill Skaggs  <weskaggs@primate.ucdavis.edu>

	* libgthumb/gth-exif-utils.c
	* libgthumb/gth-exif-utils.h
	* libgthumb/jpegutils/.cvsignore
	* libgthumb/jpegutils/Makefile.am
	* libgthumb/jpegutils/README
	* libgthumb/jpegutils/jpeg-data.c
	* libgthumb/jpegutils/jpeg-data.h
	* libgthumb/jpegutils/jpeg-marker.c
	* libgthumb/jpegutils/jpeg-marker.h
	* libgthumb/jpegutils/jpegtran.c
	* libgthumb/jpegutils/jpegtran.h
	* libgthumb/jpegutils/transupp.c
	* libgthumb/jpegutils/transupp.h: new files

	* configure.in
	* components/catalog-view/Makefile.am
	* components/image-viewer/Makefile.am
	* data/gthumb.schemas.in
	* data/glade/gthumb_preferences.glade
	* data/glade/gthumb_tools.glade
	* doc/C/gthumb.xml
	* libgthumb/Makefile.am
	* libgthumb/gthumb-module.c
	* libgthumb/image-loader.c
	* libgthumb/preferences.h
	* src/Makefile.am
	* src/dlg-jpegtran.c
	* src/dlg-jpegtran.h
	* src/dlg-photo-importer.c
	* src/dlg-preferences.c
	* src/gth-browser-ui.h
	* src/gth-window-actions-callbacks.c
	* src/gth-window-actions-callbacks.h
	* src/gth-window-actions-entries.h
	* src/rotation-utils.c
	* src/rotation-utils.h: modified files.

	Committed patches listed in comment #106 of bug #343867,
	as follows:

	patch -p0 < gthumb-exif-v3.patch
	patch -p0 < gthumb_reset_exif_orientation_v2.patch
	patch -p0 < importer.patch
	patch -p0 < gthumb_rotate_v3.patch
	patch -p1 < gthumb-20061006-exif-rotate.patch
	patch -p1 < delete-checkbox-v2.patch

	This is development aimed at improving gthumb's handling
	of exif metadata.

2006-10-06  Bill Skaggs  <weskaggs@primate.ucdavis.edu>

	Initiating "exif-testing" branch.  Testing to make sure commit
	goes to the right branch, and not to HEAD.
parent 1dd3673d
2006-10-08 Paolo Bacchilega <paobac@cvs.gnome.org>
* many files: remove remove unnecessary #ifdefs
Patch by Rennie deGraaf
* configure.in: Patch to make libexif and libjpeg mandatory (v2)
Patch by Rennie deGraaf
* many files:
Applied patch by Michael Chudobiak from bug #343867 comment #130
Merged branch exif-testing:
2006-10-06 Bill Skaggs <weskaggs@primate.ucdavis.edu>
* libgthumb/gth-exif-utils.c
* libgthumb/gth-exif-utils.h
* libgthumb/jpegutils/.cvsignore
* libgthumb/jpegutils/Makefile.am
* libgthumb/jpegutils/README
* libgthumb/jpegutils/jpeg-data.c
* libgthumb/jpegutils/jpeg-data.h
* libgthumb/jpegutils/jpeg-marker.c
* libgthumb/jpegutils/jpeg-marker.h
* libgthumb/jpegutils/jpegtran.c
* libgthumb/jpegutils/jpegtran.h
* libgthumb/jpegutils/transupp.c
* libgthumb/jpegutils/transupp.h: new files
* configure.in
* components/catalog-view/Makefile.am
* components/image-viewer/Makefile.am
* data/gthumb.schemas.in
* data/glade/gthumb_preferences.glade
* data/glade/gthumb_tools.glade
* doc/C/gthumb.xml
* libgthumb/Makefile.am
* libgthumb/gthumb-module.c
* libgthumb/image-loader.c
* libgthumb/preferences.h
* src/Makefile.am
* src/dlg-jpegtran.c
* src/dlg-jpegtran.h
* src/dlg-photo-importer.c
* src/dlg-preferences.c
* src/gth-browser-ui.h
* src/gth-window-actions-callbacks.c
* src/gth-window-actions-callbacks.h
* src/gth-window-actions-entries.h
* src/rotation-utils.c
* src/rotation-utils.h: modified files.
Committed patches listed in comment #106 of bug #343867,
as follows:
patch -p0 < gthumb-exif-v3.patch
patch -p0 < gthumb_reset_exif_orientation_v2.patch
patch -p0 < importer.patch
patch -p0 < gthumb_rotate_v3.patch
patch -p1 < gthumb-20061006-exif-rotate.patch
patch -p1 < delete-checkbox-v2.patch
This is development aimed at improving gthumb's handling
of exif metadata.
2006-10-06 Bill Skaggs <weskaggs@primate.ucdavis.edu>
Initiating "exif-testing" branch. Testing to make sure commit
goes to the right branch, and not to HEAD.
2006-10-08 Paolo Bacchilega <paobac@cvs.gnome.org>
* configure.in: changed version to 2.9.0
......
......@@ -29,6 +29,7 @@ gthumb_catalog_view_SOURCES = \
gthumb_catalog_view_LDADD = \
$(COMPONENT_LIBS) \
$(EXIF_LIBS) \
$(JPEG_LIBS) \
$(IPTCDATA_LIBS) \
$(TIFF_LIBS) \
......
......@@ -34,6 +34,7 @@ gthumb_image_viewer_SOURCES = \
gthumb_image_viewer_LDADD = \
$(COMPONENT_LIBS) \
$(EXIF_LIBS) \
$(JPEG_LIBS) \
$(IPTCDATA_LIBS) \
$(TIFF_LIBS) \
......
......@@ -31,7 +31,6 @@ LIBGNOMEPRINT_REQUIRED=2.6.0
LIBGNOMEPRINTUI_REQUIRED=2.6.0
LIBBONOBO_REQUIRED=2.6.0
LIBBONOBOUI_REQUIRED=2.6.0
LIBEXIF_0_5_REQUIRED=0.5.12
LIBEXIF_REQUIRED=0.6.9
LIBIPTCDATA_REQUIRED=0.2.1
LIBGPHOTO_REQUIRED=2.1.3
......@@ -66,6 +65,7 @@ PKG_CHECK_MODULES(GTHUMB, \
libgnomecanvas-2.0 >= $LIBGNOMECANVAS_REQUIRED \
gnome-vfs-2.0 >= $GNOME_VFS_REQUIRED \
gnome-vfs-module-2.0 \
libexif >= $LIBEXIF_REQUIRED \
libxml-2.0 >= $LIBXML_REQUIRED \
libglade-2.0 >= $LIBGLADE_REQUIRED \
libgnomeprint-2.2 >= $LIBGNOMEPRINT_REQUIRED \
......@@ -83,6 +83,7 @@ PKG_CHECK_MODULES(COMPONENT, \
libgnomecanvas-2.0 >= $LIBGNOMECANVAS_REQUIRED \
gnome-vfs-2.0 >= $GNOME_VFS_REQUIRED \
gnome-vfs-module-2.0 \
libexif >= $LIBEXIF_REQUIRED \
libxml-2.0 >= $LIBXML_REQUIRED \
libglade-2.0 >= $LIBGLADE_REQUIRED \
libgnomeprint-2.2 >= $LIBGNOMEPRINT_REQUIRED \
......@@ -96,34 +97,28 @@ AC_C_BIGENDIAN
AC_PROG_CPP
# This can be removed once we've cleaned out all the "#ifdef HAVE_LIBEXIF"s
AC_DEFINE(HAVE_LIBEXIF, 1, [Define to 1 if we have libexif support])
#
# Checks for libjpeg
#
AC_ARG_ENABLE([jpeg],
[AC_HELP_STRING([--disable-jpeg],[disable support for jpeg])],,
[enable_jpeg=yes])
if test x$enable_jpeg = xyes ; then
AC_MSG_CHECKING(JPEG Support)
AC_MSG_RESULT()
AC_MSG_CHECKING(JPEG Support)
AC_MSG_RESULT()
AC_CHECK_LIB(jpeg, jpeg_destroy_decompress,
[AC_CHECK_HEADER(jpeglib.h,,[AC_MSG_ERROR([*** JPEG headers not found ***])])],
[AC_MSG_ERROR([*** JPEG library not found ***])])
AC_CHECK_LIB(jpeg, jpeg_destroy_decompress,
[AC_CHECK_HEADER(jpeglib.h,,[AC_MSG_ERROR([*** JPEG headers not found ***])])],
[AC_MSG_ERROR([*** JPEG library not found ***])])
AC_CHECK_LIB(jpeg, jpeg_simple_progression,
[AC_DEFINE(HAVE_PROGRESSIVE_JPEG, 1, [Define to 1 if libjpeg supports progressive JPEG.])],
[AC_MSG_WARN(JPEG library does not support progressive saving.)])
AC_CHECK_LIB(jpeg, jpeg_simple_progression,
[AC_DEFINE(HAVE_PROGRESSIVE_JPEG, 1, [Define to 1 if libjpeg supports progressive JPEG.])],
[AC_MSG_WARN(JPEG library does not support progressive saving.)])
AC_DEFINE(HAVE_LIBJPEG, 1, [Define to 1 if libjpeg support is included])
AC_DEFINE(HAVE_LIBJPEG, 1, [Define to 1 if libjpeg support is included])
JPEG_LIBS='-ljpeg -lm -lz'
AC_SUBST(JPEG_LIBS)
HAVE_JPEG=yes
else
HAVE_JPEG=no
fi
JPEG_LIBS='-ljpeg -lm -lz'
AC_SUBST(JPEG_LIBS)
#
......@@ -218,26 +213,6 @@ fi
AC_SUBST(XF86GAMMA_LIBS)
#
# Checks for libexif
#
AC_ARG_ENABLE([exif],
[AC_HELP_STRING([--disable-exif],[disable support for libexif])],,
[enable_exif=yes])
HAVE_EXIF=no
if test x$enable_exif = xyes ; then
PKG_CHECK_MODULES(EXIF, libexif >= $LIBEXIF_REQUIRED,
AC_DEFINE(HAVE_LIBEXIF, 1, [Define to 1 if we have libexif support])
HAVE_EXIF=yes,
[AC_MSG_RESULT(no)
PKG_CHECK_MODULES(EXIF, libexif >= $LIBEXIF_0_5_REQUIRED,
[AC_DEFINE(HAVE_LIBEXIF_0_5, 1, [Using libexif 0.5])]
HAVE_EXIF=[yes],
HAVE_EXIF=[no])
])
fi
#
# Checks for libiptcdata
#
......@@ -250,9 +225,7 @@ if test x$enable_iptcdata = xyes ; then
AC_MSG_CHECKING(IPTC Data Support)
IPTCDATA_LIBS=""
IPTCDATA_CFLAGS=""
if test "x$EXIF_LIBS" = "x"; then
HAVE_IPTC="no iptc support without libexif"
elif pkg-config --atleast-version=$LIBIPTCDATA_REQUIRED libiptcdata; then
if pkg-config --atleast-version=$LIBIPTCDATA_REQUIRED libiptcdata; then
HAVE_IPTC="yes"
IPTCDATA_LIBS=`pkg-config --libs libiptcdata`
IPTCDATA_CFLAGS=`pkg-config --cflags libiptcdata`
......@@ -330,9 +303,9 @@ po/Makefile.in
libgthumb/Makefile
libgthumb/cursors/Makefile
libgthumb/icons/Makefile
libgthumb/jpegutils/Makefile
src/Makefile
src/icons/Makefile
src/jpegutils/Makefile
components/Makefile
components/image-viewer/Makefile
components/catalog-view/Makefile
......@@ -357,9 +330,7 @@ Configuration:
Have XRender: ${HAVE_RENDER}
Have XTest: ${have_xtest}
Have XF86VidModeSetGamma: ${have_xf86gamma}
Have libexif: ${HAVE_EXIF}
Have libiptcdata: ${HAVE_IPTC}
Have libjpeg: ${HAVE_JPEG}
Have libtiff: ${HAVE_TIFF}
Have libgphoto: ${HAVE_GPHOTO2}
......
......@@ -221,7 +221,7 @@
<child>
<widget class="GtkTable" id="i_commands_table">
<property name="visible">True</property>
<property name="n_rows">5</property>
<property name="n_rows">6</property>
<property name="n_columns">2</property>
<property name="homogeneous">False</property>
<property name="row_spacing">6</property>
......@@ -446,6 +446,28 @@
<property name="y_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="reset_exif_tag_on_import_checkbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Reset photo orientation</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">2</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
......
......@@ -18,6 +18,7 @@
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
<property name="urgency_hint">False</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
......@@ -579,6 +580,7 @@
<property name="action">GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER</property>
<property name="local_only">True</property>
<property name="show_hidden">False</property>
<property name="do_overwrite_confirmation">False</property>
<property name="width_chars">-1</property>
</widget>
<packing>
......
......@@ -762,25 +762,6 @@
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="j_from_exif_checkbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Adjust photo _orientation</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
......@@ -789,6 +770,26 @@
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="j_reset_exif_tag_on_rotate_checkbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Reset photo orientation</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="j_apply_to_all_checkbutton">
<property name="visible">True</property>
......
......@@ -95,7 +95,20 @@
</locale>
</schema>
<!-- Broswer -->
<schema>
<key>/schemas/apps/gthumb/general/use_exif_orientation</key>
<applyto>/apps/gthumb/general/use_exif_orientation</applyto>
<owner>gthumb</owner>
<type>bool</type>
<default>false</default>
<locale name="C">
<short></short>
<long>
</long>
</locale>
</schema>
<!-- Browser -->
<schema>
<key>/schemas/apps/gthumb/browser/show_hidden_files</key>
......
......@@ -1988,13 +1988,6 @@
<para>
Click on <guibutton>Apply</guibutton> to apply the changes.
</para>
<para>
If you check the <guilabel>Adjust photo orientation</guilabel>
option, an attempt is done to read the current orientation from
the photo data embedded in the image, if the orientation data is
found an automatic rotation is applied to the image in order to
visualize the image in the right orientation.
</para>
<para>
If you check the <guilabel>Apply to all images</guilabel>
option, the rotation is applied to the
......
SUBDIRS = icons cursors
DIST_SUBDIRS = icons cursors
SUBDIRS = icons cursors jpegutils
DIST_SUBDIRS = icons cursors jpegutils
if ENABLE_DEPRECATIONS
DISABLE_DEPRECATED = -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGNOME_VFS_DISABLE_DEPRECATED -DGNOME_DISABLE_DEPRECATED -DBONOBO_DISABLE_DEPRECATED
......@@ -10,6 +10,7 @@ endif
gladedir = $(datadir)/gthumb/glade
INCLUDES = \
$(EXIF_CFLAGS) \
$(GTHUMB_CFLAGS) \
-DGTHUMB_MODULEDIR=\""$(libdir)/gthumb/modules"\" \
-DGTHUMB_GLADEDIR=\""$(gladedir)"\" \
......@@ -44,6 +45,7 @@ HEADER_FILES = \
gnome-print-font-picker.h \
gnome-print-font-dialog.h \
gstringlist.h \
gth-exif-utils.h \
gth-image-list.h \
gth-iviewer.h \
gth-file-list.h \
......@@ -100,6 +102,7 @@ libgthumb_la_SOURCES = \
gnome-print-font-picker.c \
gnome-print-font-dialog.c \
gstringlist.c \
gth-exif-utils.c \
gth-pixbuf-op.c \
gth-image-list.c \
gth-iviewer.c \
......@@ -129,9 +132,11 @@ libgthumb_la_SOURCES = \
thumb-loader.c
libgthumb_la_LIBADD = \
$(EXIF_LIBS) \
$(TIFF_LIBS) \
$(GTHUMB_LIBS) \
$(IPTCDATA_LIBS)
$(IPTCDATA_LIBS) \
$(top_builddir)/libgthumb/jpegutils/libgthumb-jpegutils.la
gthumb-marshal.h: gthumb-marshal.list $(GLIB_GENMARSHAL)
$(GLIB_GENMARSHAL) $(top_srcdir)/libgthumb/gthumb-marshal.list --header --prefix=gthumb_marshal > $(top_srcdir)/libgthumb/gthumb-marshal.h
......
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* GThumb
*
* Copyright (C) 2003 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
*/
#include <config.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <glib.h>
#include "file-utils.h"
#include "gth-exif-utils.h"
char *
get_exif_tag (const char *filename,
ExifTag etag)
{
ExifData *edata;
unsigned int i, j;
filename = get_file_path_from_uri (filename);
if (filename == NULL)
return g_strdup ("-");
edata = exif_data_new_from_file (filename);
if (edata == NULL)
return g_strdup ("-");
for (i = 0; i < EXIF_IFD_COUNT; i++) {
ExifContent *content = edata->ifd[i];
if (! edata->ifd[i] || ! edata->ifd[i]->count)
continue;
for (j = 0; j < content->count; j++) {
ExifEntry *e = content->entries[j];
if (! content->entries[j])
continue;
if (e->tag == etag) {
const char *value;
char *retval = NULL;
value = get_exif_entry_value (e);
if (value != NULL)
retval = g_locale_to_utf8 (value, -1, 0, 0, 0);
else
retval = g_strdup ("-");
exif_data_unref (edata);
return retval;
}
}
}
exif_data_unref (edata);
return g_strdup ("-");
}
ExifShort
get_exif_tag_short (const char *filename,
ExifTag etag)
{
ExifData *edata;
unsigned int i, j;
filename = get_file_path_from_uri (filename);
if (filename == NULL)
return 0;
edata = exif_data_new_from_file (filename);
if (edata == NULL)
return 0;
for (i = 0; i < EXIF_IFD_COUNT; i++) {
ExifContent *content = edata->ifd[i];
if (! edata->ifd[i] || ! edata->ifd[i]->count)
continue;
for (j = 0; j < content->count; j++) {
ExifEntry *e = content->entries[j];
if (! content->entries[j])
continue;
if (e->tag == etag) {
ExifByteOrder o;
ExifShort retval = 0;
o = exif_data_get_byte_order (e->parent->parent);
if (e->data != NULL)
retval = exif_get_short (e->data, o);
exif_data_unref (edata);
return retval;
}
}
}
exif_data_unref (edata);
return 0;
}
time_t
get_exif_time (const char *filename)
{
ExifData *edata;
unsigned int i, j;
time_t time = 0;
struct tm tm = { 0, };
filename = get_file_path_from_uri (filename);
if (filename == NULL)
return (time_t)0;
edata = exif_data_new_from_file (filename);
if (edata == NULL)
return (time_t)0;
for (i = 0; i < EXIF_IFD_COUNT; i++) {
ExifContent *content = edata->ifd[i];
if (! edata->ifd[i] || ! edata->ifd[i]->count)
continue;
for (j = 0; j < content->count; j++) {
ExifEntry *e = content->entries[j];
char *data;
if (! content->entries[j])
continue;
if ((e->tag != EXIF_TAG_DATE_TIME) &&
(e->tag != EXIF_TAG_DATE_TIME_ORIGINAL) &&
(e->tag != EXIF_TAG_DATE_TIME_DIGITIZED))
continue;
if (e->data == NULL)
continue;
if (strlen ((char*)e->data) < 10)
continue;
data = g_strdup ((char*)e->data);
data[4] = data[7] = data[10] = '\0';
tm.tm_year = atoi (data) - 1900;
tm.tm_mon = atoi (data + 5) - 1;
tm.tm_mday = atoi (data + 8);
tm.tm_hour = 0;
tm.tm_min = 0;
tm.tm_sec = 0;
tm.tm_isdst = -1;
if (strlen ((char*)e->data) > 10) {
data[13] = data[16] = '\0';
tm.tm_hour = atoi (data + 11);
tm.tm_min = atoi (data + 14);
tm.tm_sec = atoi (data + 17);
}
time = mktime (&tm);
g_free (data);
break;
}
}
exif_data_unref (edata);
return time;
}
char *