diff options
author | infirit <[email protected]> | 2014-07-25 17:26:26 +0200 |
---|---|---|
committer | infirit <[email protected]> | 2014-07-25 22:45:27 +0200 |
commit | b8e7359d93f7f68f410391b39dde37eb1067a92a (patch) | |
tree | 54bed0f6139406c835974bf61b291004bd7ccefe /src | |
parent | 14a6c9ccd6088184e27a239e7b6a091b0c232e6e (diff) | |
download | eom-b8e7359d93f7f68f410391b39dde37eb1067a92a.tar.bz2 eom-b8e7359d93f7f68f410391b39dde37eb1067a92a.tar.xz |
Wrap ExifData in a EogExifData boxed type
This is for better interaction with bindings
Based on eog commit b88d3713fe45a4bab1bd24ac8ff60551c5c31d49
From Claudio Saavedra <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/eom-exif-util.c | 30 | ||||
-rw-r--r-- | src/eom-exif-util.h | 10 | ||||
-rw-r--r-- | src/eom-image.c | 4 | ||||
-rw-r--r-- | src/eom-image.h | 3 | ||||
-rw-r--r-- | src/eom-metadata-reader.c | 4 | ||||
-rw-r--r-- | src/eom-metadata-reader.h | 4 | ||||
-rw-r--r-- | src/eom-properties-dialog.c | 4 | ||||
-rw-r--r-- | src/eom-thumb-view.c | 2 |
8 files changed, 48 insertions, 13 deletions
diff --git a/src/eom-exif-util.c b/src/eom-exif-util.c index fedefcd..7fa0e99 100644 --- a/src/eom-exif-util.c +++ b/src/eom-exif-util.c @@ -185,7 +185,7 @@ eom_exif_util_format_date (const gchar *date) } /** - * eom_exif_util_get_value: + * eom_exif_data_get_value: * @exif_data: pointer to an <structname>ExifData</structname> struct * @tag_id: the requested tag's id. See <filename>exif-tag.h</filename> * from the libexif package for possible values (e.g. %EXIF_TAG_EXPOSURE_MODE). @@ -199,7 +199,7 @@ eom_exif_util_format_date (const gchar *date) * Returns: a pointer to @buffer. */ const gchar * -eom_exif_util_get_value (ExifData *exif_data, gint tag_id, gchar *buffer, guint buf_size) +eom_exif_data_get_value (EomExifData *exif_data, gint tag_id, gchar *buffer, guint buf_size) { ExifEntry *exif_entry; const gchar *exif_value; @@ -212,3 +212,29 @@ eom_exif_util_get_value (ExifData *exif_data, gint tag_id, gchar *buffer, guint return exif_value; } + +EomExifData * +eom_exif_data_copy (EomExifData *data) +{ + exif_data_ref (data); + + return data; +} + +void +eom_exif_data_free (EomExifData *data) +{ + exif_data_unref (data); +} + +GType +eom_exif_data_get_type (void) +{ + static GType our_type = 0; + + if (our_type == 0) + our_type = g_boxed_type_register_static ("EomExifData", + (GBoxedCopyFunc) eom_exif_data_copy, + (GBoxedFreeFunc) eom_exif_data_free); + return our_type; +} diff --git a/src/eom-exif-util.h b/src/eom-exif-util.h index 451924b..5a34be9 100644 --- a/src/eom-exif-util.h +++ b/src/eom-exif-util.h @@ -28,13 +28,21 @@ #define __EOM_EXIF_UTIL_H__ #include <glib.h> +#include <glib-object.h> #include <libexif/exif-data.h> G_BEGIN_DECLS +typedef ExifData EomExifData; + gchar* eom_exif_util_format_date (const gchar *date); -const gchar *eom_exif_util_get_value (ExifData *exif_data, gint tag_id, gchar *buffer, guint buf_size); +const gchar *eom_exif_data_get_value (EomExifData *exif_data, gint tag_id, gchar *buffer, guint buf_size); + +GType eom_exif_data_get_type (void) G_GNUC_CONST; + +EomExifData * eom_exif_data_copy (EomExifData *data); +void eom_exif_data_free (EomExifData *data); G_END_DECLS diff --git a/src/eom-image.c b/src/eom-image.c index 1b38978..26df136 100644 --- a/src/eom-image.c +++ b/src/eom-image.c @@ -1884,11 +1884,11 @@ eom_image_cancel_load (EomImage *img) g_mutex_unlock (&priv->status_mutex); } -gpointer +EomExifData * eom_image_get_exif_info (EomImage *img) { EomImagePrivate *priv; - gpointer data = NULL; + EomExifData *data = NULL; g_return_val_if_fail (EOM_IS_IMAGE (img), NULL); diff --git a/src/eom-image.h b/src/eom-image.h index f93c8ac..f88623c 100644 --- a/src/eom-image.h +++ b/src/eom-image.h @@ -27,6 +27,7 @@ #include "eom-transform.h" #include "eom-image-save-info.h" #include "eom-enums.h" +#include "eom-exif-util.h" #include <glib.h> #include <glib-object.h> @@ -168,7 +169,7 @@ const gchar* eom_image_get_caption (EomImage *img); const gchar *eom_image_get_collate_key (EomImage *img); -gpointer eom_image_get_exif_info (EomImage *img); +EomExifData* eom_image_get_exif_info (EomImage *img); gpointer eom_image_get_xmp_info (EomImage *img); diff --git a/src/eom-metadata-reader.c b/src/eom-metadata-reader.c index c77ef2e..13e025c 100644 --- a/src/eom-metadata-reader.c +++ b/src/eom-metadata-reader.c @@ -102,7 +102,7 @@ eom_metadata_reader_get_exif_chunk (EomMetadataReader *emr, guchar **data, guint } #ifdef HAVE_EXIF -ExifData* +EomExifData* eom_metadata_reader_get_exif_data (EomMetadataReader *emr) { gpointer exif_data = NULL; @@ -113,7 +113,7 @@ eom_metadata_reader_get_exif_data (EomMetadataReader *emr) if (iface->get_exif_data) exif_data = iface->get_exif_data (emr); - return exif_data; + return (EomExifData *)exif_data; } #endif diff --git a/src/eom-metadata-reader.h b/src/eom-metadata-reader.h index ce5dc0c..a217a7c 100644 --- a/src/eom-metadata-reader.h +++ b/src/eom-metadata-reader.h @@ -24,7 +24,7 @@ #include <glib-object.h> #if HAVE_EXIF -#include <libexif/exif-data.h> +#include "eom-exif-util.h" #endif #if HAVE_EXEMPI #include <exempi/xmp.h> @@ -89,7 +89,7 @@ void eom_metadata_reader_get_exif_chunk (EomMetadataReader *emr, #ifdef HAVE_EXIF G_GNUC_INTERNAL -ExifData* eom_metadata_reader_get_exif_data (EomMetadataReader *emr); +EomExifData* eom_metadata_reader_get_exif_data (EomMetadataReader *emr); #endif #ifdef HAVE_EXEMPI diff --git a/src/eom-properties-dialog.c b/src/eom-properties-dialog.c index 1dc6715..6d21a5c 100644 --- a/src/eom-properties-dialog.c +++ b/src/eom-properties-dialog.c @@ -178,14 +178,14 @@ pd_update_general_tab (EomPropertiesDialog *prop_dlg, #if HAVE_EXIF static void -eom_exif_set_label (GtkWidget *w, ExifData *exif_data, gint tag_id) +eom_exif_set_label (GtkWidget *w, EomExifData *exif_data, gint tag_id) { gchar exif_buffer[512]; const gchar *buf_ptr; gchar *label_text = NULL; if (exif_data) { - buf_ptr = eom_exif_util_get_value (exif_data, tag_id, + buf_ptr = eom_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/eom-thumb-view.c b/src/eom-thumb-view.c index 6302867..eac2922 100644 --- a/src/eom-thumb-view.c +++ b/src/eom-thumb-view.c @@ -422,7 +422,7 @@ thumbview_get_tooltip_string (EomImage *image) gchar time_buffer[32]; date = eom_exif_util_format_date ( - eom_exif_util_get_value (exif_data, EXIF_TAG_DATE_TIME_ORIGINAL, time_buffer, 32)); + eom_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); |