eog r4295 - in trunk: . src
- From: friemann svn gnome org
- To: svn-commits-list gnome org
- Subject: eog r4295 - in trunk: . src
- Date: Sun, 6 Jan 2008 22:21:09 +0000 (GMT)
Author: friemann
Date: Sun Jan 6 22:21:08 2008
New Revision: 4295
URL: http://svn.gnome.org/viewvc/eog?rev=4295&view=rev
Log:
2008-01-06 Felix Riemann <friemann svn gnome org>
* src/eog-exif-util.c: (eog_exif_util_get_value):
* src/eog-exif-util.h:
* src/eog-thumb-view.c: (tb_on_query_tooltip_cb):
Make the buffer for the EXIF data to be provided by the calling
function. That way we don't have to play strange games on the stack.
Fixes warnings in Valgrind.
* src/eog-properties-dialog.c: (eog_exif_set_label),
(pd_update_metadata_tab):
Stop leaking the metadata labels' text.
Clear them if we cannot provide the required data for them, so they
won't possibly show "invalid" data. Add a new convenience function to
handle all this.
Modified:
trunk/ChangeLog
trunk/src/eog-exif-util.c
trunk/src/eog-exif-util.h
trunk/src/eog-properties-dialog.c
trunk/src/eog-thumb-view.c
Modified: trunk/ChangeLog
==============================================================================
--- trunk/ChangeLog (original)
+++ trunk/ChangeLog Sun Jan 6 22:21:08 2008
@@ -1,3 +1,18 @@
+2008-01-06 Felix Riemann <friemann svn gnome org>
+
+ * src/eog-exif-util.c: (eog_exif_util_get_value):
+ * src/eog-exif-util.h:
+ * src/eog-thumb-view.c: (tb_on_query_tooltip_cb):
+ Make the buffer for the EXIF data to be provided by the calling
+ function. That way we don't have to play strange games on the stack.
+ Fixes warnings in Valgrind.
+ * src/eog-properties-dialog.c: (eog_exif_set_label),
+ (pd_update_metadata_tab):
+ Stop leaking the metadata labels' text.
+ Clear them if we cannot provide the required data for them, so they
+ won't possibly show "invalid" data. Add a new convenience function to
+ handle all this.
+
2008-01-05 Claudio Saavedra <csaavedra alumnos utalca cl>
* src/eog-window.c: (add_uri_to_recent_files),
Modified: trunk/src/eog-exif-util.c
==============================================================================
--- trunk/src/eog-exif-util.c (original)
+++ trunk/src/eog-exif-util.c Sun Jan 6 22:21:08 2008
@@ -114,17 +114,16 @@
}
const gchar *
-eog_exif_util_get_value (ExifData *exif_data, gint tag_id)
+eog_exif_util_get_value (ExifData *exif_data, gint tag_id, gchar *buffer, guint buf_size)
{
ExifEntry *exif_entry;
const gchar *exif_value;
- gchar buffer[1024];
exif_entry = exif_data_get_entry (exif_data, tag_id);
buffer[0] = 0;
- exif_value = exif_entry_get_value (exif_entry, buffer, sizeof (buffer));
+ exif_value = exif_entry_get_value (exif_entry, buffer, buf_size);
return exif_value;
}
Modified: trunk/src/eog-exif-util.h
==============================================================================
--- trunk/src/eog-exif-util.h (original)
+++ trunk/src/eog-exif-util.h Sun Jan 6 22:21:08 2008
@@ -34,7 +34,7 @@
gchar* eog_exif_util_format_date (const gchar *date);
-const gchar *eog_exif_util_get_value (ExifData *exif_data, gint tag_id);
+const gchar *eog_exif_util_get_value (ExifData *exif_data, gint tag_id, gchar *buffer, guint buf_size);
G_END_DECLS
Modified: trunk/src/eog-properties-dialog.c
==============================================================================
--- trunk/src/eog-properties-dialog.c (original)
+++ trunk/src/eog-properties-dialog.c Sun Jan 6 22:21:08 2008
@@ -46,7 +46,6 @@
#include <exempi/xmp.h>
#include <exempi/xmpconsts.h>
#endif
-
#if HAVE_EXIF || HAVE_EXEMPI
#define HAVE_METADATA 1
#endif
@@ -160,6 +159,29 @@
g_free (dir_str);
}
+#if HAVE_EXIF
+static void
+eog_exif_set_label (GtkWidget *w, ExifData *exif_data, gint tag_id)
+{
+ gchar exif_buffer[512];
+ const gchar *buf_ptr;
+ gchar *label_text = NULL;
+
+ if (exif_data) {
+ buf_ptr = eog_exif_util_get_value (exif_data, tag_id,
+ exif_buffer, 512);
+
+ if (tag_id == EXIF_TAG_DATE_TIME && buf_ptr)
+ label_text = eog_exif_util_format_date (buf_ptr);
+ else
+ label_text = eog_util_make_valid_utf8 (buf_ptr);
+ }
+
+ gtk_label_set_text (GTK_LABEL (w), label_text);
+ g_free (label_text);
+}
+#endif
+
#if HAVE_EXEMPI
static void
eog_xmp_set_label (XmpPtr xmp,
@@ -223,7 +245,6 @@
GtkNotebook *notebook;
#if HAVE_EXIF
ExifData *exif_data;
- const gchar *exif_value = NULL;
#endif
#if HAVE_EXEMPI
XmpPtr xmp_data;
@@ -256,52 +277,39 @@
#if HAVE_EXIF
exif_data = (ExifData *) eog_image_get_exif_info (image);
- if (exif_data) {
- exif_value = eog_exif_util_get_value (exif_data,
- EXIF_TAG_FNUMBER);
- gtk_label_set_text (GTK_LABEL (priv->exif_aperture_label),
- eog_util_make_valid_utf8 (exif_value));
-
- exif_value = eog_exif_util_get_value (exif_data,
- EXIF_TAG_EXPOSURE_TIME);
- gtk_label_set_text (GTK_LABEL (priv->exif_exposure_label),
- eog_util_make_valid_utf8 (exif_value));
-
- exif_value = eog_exif_util_get_value (exif_data,
- EXIF_TAG_FOCAL_LENGTH);
- gtk_label_set_text (GTK_LABEL (priv->exif_focal_label),
- eog_util_make_valid_utf8 (exif_value));
-
- exif_value = eog_exif_util_get_value (exif_data,
- EXIF_TAG_FLASH);
- gtk_label_set_text (GTK_LABEL (priv->exif_flash_label),
- eog_util_make_valid_utf8 (exif_value));
-
- exif_value = eog_exif_util_get_value (exif_data,
- EXIF_TAG_ISO_SPEED_RATINGS);
- gtk_label_set_text (GTK_LABEL (priv->exif_iso_label),
- eog_util_make_valid_utf8 (exif_value));
-
- exif_value = eog_exif_util_get_value (exif_data,
- EXIF_TAG_METERING_MODE);
- gtk_label_set_text (GTK_LABEL (priv->exif_metering_label),
- eog_util_make_valid_utf8 (exif_value));
-
- exif_value = eog_exif_util_get_value (exif_data,
- EXIF_TAG_MODEL);
- gtk_label_set_text (GTK_LABEL (priv->exif_model_label),
- eog_util_make_valid_utf8 (exif_value));
-
- exif_value = eog_exif_util_get_value (exif_data,
- EXIF_TAG_DATE_TIME);
- gtk_label_set_text (GTK_LABEL (priv->exif_date_label),
- eog_exif_util_format_date (exif_value));
+ eog_exif_set_label (priv->exif_aperture_label,
+ exif_data, EXIF_TAG_FNUMBER);
- eog_exif_details_update (EOG_EXIF_DETAILS (priv->exif_details),
- exif_data);
+ eog_exif_set_label (priv->exif_exposure_label,
+ exif_data, EXIF_TAG_EXPOSURE_TIME);
- exif_data_unref(exif_data);
- }
+ eog_exif_set_label (priv->exif_focal_label,
+ exif_data, EXIF_TAG_FOCAL_LENGTH);
+
+ eog_exif_set_label (priv->exif_focal_label,
+ exif_data, EXIF_TAG_FOCAL_LENGTH);
+
+ eog_exif_set_label (priv->exif_flash_label,
+ exif_data, EXIF_TAG_FLASH);
+
+ eog_exif_set_label (priv->exif_iso_label,
+ exif_data, EXIF_TAG_ISO_SPEED_RATINGS);
+
+
+ eog_exif_set_label (priv->exif_metering_label,
+ exif_data, EXIF_TAG_METERING_MODE);
+
+ eog_exif_set_label (priv->exif_model_label,
+ exif_data, EXIF_TAG_MODEL);
+
+ eog_exif_set_label (priv->exif_date_label,
+ exif_data, EXIF_TAG_DATE_TIME);
+
+ eog_exif_details_update (EOG_EXIF_DETAILS (priv->exif_details),
+ exif_data);
+
+ /* exif_data_unref can handle NULL-values */
+ exif_data_unref(exif_data);
#endif
#if HAVE_EXEMPI
Modified: trunk/src/eog-thumb-view.c
==============================================================================
--- trunk/src/eog-thumb-view.c (original)
+++ trunk/src/eog-thumb-view.c Sun Jan 6 22:21:08 2008
@@ -445,9 +445,12 @@
#ifdef HAVE_EXIF
if (exif_data) {
gchar *extra_info, *tmp, *date;
+ /* The EXIF standard says that the DATE_TIME tag is
+ * 20 bytes long. A 32-byte buffer should be large enough. */
+ gchar time_buffer[32];
date = eog_exif_util_format_date (
- eog_exif_util_get_value (exif_data, EXIF_TAG_DATE_TIME));
+ eog_exif_util_get_value (exif_data, EXIF_TAG_DATE_TIME, time_buffer, 32));
extra_info = g_strdup_printf ("\n%s %s", _("Taken on"), date);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]