[eog] Wrap ExifData in a EogExifData boxed type
- From: Felix Riemann <friemann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [eog] Wrap ExifData in a EogExifData boxed type
- Date: Sat, 18 Dec 2010 13:20:56 +0000 (UTC)
commit b88d3713fe45a4bab1bd24ac8ff60551c5c31d49
Author: Claudio Saavedra <csaavedra igalia com>
Date: Mon Aug 9 00:51:06 2010 +0300
Wrap ExifData in a EogExifData boxed type
This is for better interaction with bindings
https://bugzilla.gnome.org/show_bug.cgi?id=626257
plugins/statusbar-date/eog-statusbar-date-plugin.c | 10 +++----
src/eog-exif-util.c | 28 +++++++++++++++++++-
src/eog-exif-util.h | 10 ++++++-
src/eog-image.c | 4 +-
src/eog-image.h | 3 +-
src/eog-metadata-reader.c | 4 +-
src/eog-metadata-reader.h | 4 +-
src/eog-properties-dialog.c | 4 +-
src/eog-thumb-view.c | 2 +-
9 files changed, 51 insertions(+), 18 deletions(-)
---
diff --git a/plugins/statusbar-date/eog-statusbar-date-plugin.c b/plugins/statusbar-date/eog-statusbar-date-plugin.c
index cc4e3af..17aab94 100644
--- a/plugins/statusbar-date/eog-statusbar-date-plugin.c
+++ b/plugins/statusbar-date/eog-statusbar-date-plugin.c
@@ -28,8 +28,6 @@
#include <gmodule.h>
#include <glib/gi18n-lib.h>
-#include <libexif/exif-data.h>
-
#include <eog-debug.h>
#include <eog-scroll-view.h>
#include <eog-image.h>
@@ -63,7 +61,7 @@ statusbar_set_date (GtkStatusbar *statusbar, EogThumbView *view)
EogImage *image;
gchar *date = NULL;
gchar time_buffer[32];
- ExifData *exif_data;
+ EogExifData *exif_data;
if (eog_thumb_view_get_n_selected (view) == 0)
return;
@@ -78,11 +76,11 @@ statusbar_set_date (GtkStatusbar *statusbar, EogThumbView *view)
}
}
- exif_data = (ExifData *) eog_image_get_exif_info (image);
+ exif_data = eog_image_get_exif_info (image);
if (exif_data) {
date = eog_exif_util_format_date (
- eog_exif_util_get_value (exif_data, EXIF_TAG_DATE_TIME_ORIGINAL, time_buffer, 32));
- exif_data_unref (exif_data);
+ eog_exif_data_get_value (exif_data, EXIF_TAG_DATE_TIME_ORIGINAL, time_buffer, 32));
+ eog_exif_data_free (exif_data);
}
if (date) {
diff --git a/src/eog-exif-util.c b/src/eog-exif-util.c
index d8cf772..26e9a72 100644
--- a/src/eog-exif-util.c
+++ b/src/eog-exif-util.c
@@ -199,7 +199,7 @@ eog_exif_util_format_date (const gchar *date)
* Returns: a pointer to @buffer.
*/
const gchar *
-eog_exif_util_get_value (ExifData *exif_data, gint tag_id, gchar *buffer, guint buf_size)
+eog_exif_data_get_value (EogExifData *exif_data, gint tag_id, gchar *buffer, guint buf_size)
{
ExifEntry *exif_entry;
const gchar *exif_value;
@@ -212,3 +212,29 @@ eog_exif_util_get_value (ExifData *exif_data, gint tag_id, gchar *buffer, guint
return exif_value;
}
+
+EogExifData *
+eog_exif_data_copy (EogExifData *data)
+{
+ exif_data_ref (data);
+
+ return data;
+}
+
+void
+eog_exif_data_free (EogExifData *data)
+{
+ exif_data_unref (data);
+}
+
+GType
+eog_exif_data_get_type (void)
+{
+ static GType our_type = 0;
+
+ if (our_type == 0)
+ our_type = g_boxed_type_register_static ("EogExifData",
+ (GBoxedCopyFunc) eog_exif_data_copy,
+ (GBoxedFreeFunc) eog_exif_data_free);
+ return our_type;
+}
diff --git a/src/eog-exif-util.h b/src/eog-exif-util.h
index a99823e..9cf9abc 100644
--- a/src/eog-exif-util.h
+++ b/src/eog-exif-util.h
@@ -28,13 +28,21 @@
#define __EOG_EXIF_UTIL_H__
#include <glib.h>
+#include <glib-object.h>
#include <libexif/exif-data.h>
G_BEGIN_DECLS
+typedef ExifData EogExifData;
+
gchar* eog_exif_util_format_date (const gchar *date);
-const gchar *eog_exif_util_get_value (ExifData *exif_data, gint tag_id, gchar *buffer, guint buf_size);
+const gchar *eog_exif_data_get_value (EogExifData *exif_data, gint tag_id, gchar *buffer, guint buf_size);
+
+GType eog_exif_data_get_type (void) G_GNUC_CONST;
+
+EogExifData * eog_exif_data_copy (EogExifData *data);
+void eog_exif_data_free (EogExifData *data);
G_END_DECLS
diff --git a/src/eog-image.c b/src/eog-image.c
index 8a95b38..78b78a2 100644
--- a/src/eog-image.c
+++ b/src/eog-image.c
@@ -1887,11 +1887,11 @@ eog_image_cancel_load (EogImage *img)
g_mutex_unlock (priv->status_mutex);
}
-gpointer
+EogExifData *
eog_image_get_exif_info (EogImage *img)
{
EogImagePrivate *priv;
- gpointer data = NULL;
+ EogExifData *data = NULL;
g_return_val_if_fail (EOG_IS_IMAGE (img), NULL);
diff --git a/src/eog-image.h b/src/eog-image.h
index 72122c0..4688657 100644
--- a/src/eog-image.h
+++ b/src/eog-image.h
@@ -27,6 +27,7 @@
#include "eog-transform.h"
#include "eog-image-save-info.h"
#include "eog-enums.h"
+#include "eog-exif-util.h"
#include <glib.h>
#include <glib-object.h>
@@ -168,7 +169,7 @@ const gchar* eog_image_get_caption (EogImage *img);
const gchar *eog_image_get_collate_key (EogImage *img);
-gpointer eog_image_get_exif_info (EogImage *img);
+EogExifData* eog_image_get_exif_info (EogImage *img);
gpointer eog_image_get_xmp_info (EogImage *img);
diff --git a/src/eog-metadata-reader.c b/src/eog-metadata-reader.c
index 54d0563..03233c3 100644
--- a/src/eog-metadata-reader.c
+++ b/src/eog-metadata-reader.c
@@ -102,7 +102,7 @@ eog_metadata_reader_get_exif_chunk (EogMetadataReader *emr, guchar **data, guint
}
#ifdef HAVE_EXIF
-ExifData*
+EogExifData*
eog_metadata_reader_get_exif_data (EogMetadataReader *emr)
{
gpointer exif_data = NULL;
@@ -113,7 +113,7 @@ eog_metadata_reader_get_exif_data (EogMetadataReader *emr)
if (iface->get_exif_data)
exif_data = iface->get_exif_data (emr);
- return exif_data;
+ return (EogExifData *)exif_data;
}
#endif
diff --git a/src/eog-metadata-reader.h b/src/eog-metadata-reader.h
index 4f49fc9..39b572e 100644
--- a/src/eog-metadata-reader.h
+++ b/src/eog-metadata-reader.h
@@ -24,7 +24,7 @@
#include <glib-object.h>
#if HAVE_EXIF
-#include <libexif/exif-data.h>
+#include "eog-exif-util.h"
#endif
#if HAVE_EXEMPI
#include <exempi/xmp.h>
@@ -89,7 +89,7 @@ void eog_metadata_reader_get_exif_chunk (EogMetadataReader *emr,
#ifdef HAVE_EXIF
G_GNUC_INTERNAL
-ExifData* eog_metadata_reader_get_exif_data (EogMetadataReader *emr);
+EogExifData* eog_metadata_reader_get_exif_data (EogMetadataReader *emr);
#endif
#ifdef HAVE_EXEMPI
diff --git a/src/eog-properties-dialog.c b/src/eog-properties-dialog.c
index 90f656f..6c8d89a 100644
--- a/src/eog-properties-dialog.c
+++ b/src/eog-properties-dialog.c
@@ -178,14 +178,14 @@ pd_update_general_tab (EogPropertiesDialog *prop_dlg,
#if HAVE_EXIF
static void
-eog_exif_set_label (GtkWidget *w, ExifData *exif_data, gint tag_id)
+eog_exif_set_label (GtkWidget *w, EogExifData *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,
+ buf_ptr = eog_exif_data_get_value (exif_data, tag_id,
exif_buffer, 512);
if (tag_id == EXIF_TAG_DATE_TIME_ORIGINAL && buf_ptr)
diff --git a/src/eog-thumb-view.c b/src/eog-thumb-view.c
index c942809..e5c184d 100644
--- a/src/eog-thumb-view.c
+++ b/src/eog-thumb-view.c
@@ -402,7 +402,7 @@ thumbview_get_tooltip_string (EogImage *image)
gchar time_buffer[32];
date = eog_exif_util_format_date (
- eog_exif_util_get_value (exif_data, EXIF_TAG_DATE_TIME_ORIGINAL, time_buffer, 32));
+ eog_exif_data_get_value (exif_data, EXIF_TAG_DATE_TIME_ORIGINAL, time_buffer, 32));
if (date) {
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]