[eog/friemann/krifa75-declare-iface: 3/3] EogMetadataReader: Use G_DECLARE_INTERFACE
- From: Felix Riemann <friemann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [eog/friemann/krifa75-declare-iface: 3/3] EogMetadataReader: Use G_DECLARE_INTERFACE
- Date: Sat, 9 Jul 2022 17:14:41 +0000 (UTC)
commit b3f7059efd5ce1fbc543cb0d1a26f4f1226bd7d4
Author: Krifa75 <yahiaoui fakhri gmail com>
Date: Sat Mar 19 21:51:58 2022 +0100
EogMetadataReader: Use G_DECLARE_INTERFACE
src/eog-metadata-reader.c | 40 ++++++++++++++++++++--------------------
src/eog-metadata-reader.h | 34 +++++++++++++---------------------
2 files changed, 33 insertions(+), 41 deletions(-)
---
diff --git a/src/eog-metadata-reader.c b/src/eog-metadata-reader.c
index 244fb951..9243e1ca 100644
--- a/src/eog-metadata-reader.c
+++ b/src/eog-metadata-reader.c
@@ -33,77 +33,77 @@ G_DEFINE_INTERFACE (EogMetadataReader, eog_metadata_reader, G_TYPE_INVALID)
EogMetadataReader*
eog_metadata_reader_new (EogMetadataFileType type)
{
- EogMetadataReader *emr;
+ EogMetadataReader *self;
switch (type) {
case EOG_METADATA_JPEG:
- emr = EOG_METADATA_READER (g_object_new (EOG_TYPE_METADATA_READER_JPG, NULL));
+ self = EOG_METADATA_READER (g_object_new (EOG_TYPE_METADATA_READER_JPG, NULL));
break;
case EOG_METADATA_PNG:
- emr = EOG_METADATA_READER (g_object_new (EOG_TYPE_METADATA_READER_PNG, NULL));
+ self = EOG_METADATA_READER (g_object_new (EOG_TYPE_METADATA_READER_PNG, NULL));
break;
default:
- emr = NULL;
+ self = NULL;
break;
}
- return emr;
+ return self;
}
gboolean
-eog_metadata_reader_finished (EogMetadataReader *emr)
+eog_metadata_reader_finished (EogMetadataReader *self)
{
- g_return_val_if_fail (EOG_IS_METADATA_READER (emr), TRUE);
+ g_return_val_if_fail (EOG_IS_METADATA_READER (self), TRUE);
- return EOG_METADATA_READER_GET_INTERFACE (emr)->finished (emr);
+ return EOG_METADATA_READER_GET_IFACE (self)->finished (self);
}
void
-eog_metadata_reader_consume (EogMetadataReader *emr, const guchar *buf, guint len)
+eog_metadata_reader_consume (EogMetadataReader *self, const guchar *buf, guint len)
{
- EOG_METADATA_READER_GET_INTERFACE (emr)->consume (emr, buf, len);
+ EOG_METADATA_READER_GET_IFACE (self)->consume (self, buf, len);
}
/* Returns the raw exif data. NOTE: The caller of this function becomes
* the new owner of this piece of memory and is responsible for freeing it!
*/
void
-eog_metadata_reader_get_exif_chunk (EogMetadataReader *emr, guchar **data, guint *len)
+eog_metadata_reader_get_exif_chunk (EogMetadataReader *self, guchar **data, guint *len)
{
g_return_if_fail (data != NULL && len != NULL);
- EOG_METADATA_READER_GET_INTERFACE (emr)->get_raw_exif (emr, data, len);
+ EOG_METADATA_READER_GET_IFACE (self)->get_raw_exif (self, data, len);
}
#ifdef HAVE_EXIF
ExifData*
-eog_metadata_reader_get_exif_data (EogMetadataReader *emr)
+eog_metadata_reader_get_exif_data (EogMetadataReader *self)
{
- return EOG_METADATA_READER_GET_INTERFACE (emr)->get_exif_data (emr);
+ return EOG_METADATA_READER_GET_IFACE (self)->get_exif_data (self);
}
#endif
#ifdef HAVE_EXEMPI
XmpPtr
-eog_metadata_reader_get_xmp_data (EogMetadataReader *emr)
+eog_metadata_reader_get_xmp_data (EogMetadataReader *self)
{
- return EOG_METADATA_READER_GET_INTERFACE (emr)->get_xmp_ptr (emr);
+ return EOG_METADATA_READER_GET_IFACE (self)->get_xmp_ptr (self);
}
#endif
#ifdef HAVE_LCMS
cmsHPROFILE
-eog_metadata_reader_get_icc_profile (EogMetadataReader *emr)
+eog_metadata_reader_get_icc_profile (EogMetadataReader *self)
{
- return EOG_METADATA_READER_GET_INTERFACE (emr)->get_icc_profile (emr);
+ return EOG_METADATA_READER_GET_IFACE (self)->get_icc_profile (self);
}
#endif
/* Default vfunc that simply clears the output if not overridden by the
implementing class. This mimics the old behaviour of get_exif_chunk(). */
static void
-_eog_metadata_reader_default_get_raw_exif (EogMetadataReader *emr,
+_eog_metadata_reader_default_get_raw_exif (EogMetadataReader *self,
guchar **data, guint *length)
{
g_return_if_fail (data != NULL && length != NULL);
@@ -115,7 +115,7 @@ _eog_metadata_reader_default_get_raw_exif (EogMetadataReader *emr,
/* Default vfunc that simply returns NULL if not overridden by the implementing
class. Mimics the old fallback behaviour of the getter functions. */
static gpointer
-_eog_metadata_reader_default_get_null (EogMetadataReader *emr)
+_eog_metadata_reader_default_get_null (EogMetadataReader *self)
{
return NULL;
}
diff --git a/src/eog-metadata-reader.h b/src/eog-metadata-reader.h
index 05b12007..3b82f544 100644
--- a/src/eog-metadata-reader.h
+++ b/src/eog-metadata-reader.h
@@ -36,12 +36,7 @@
G_BEGIN_DECLS
#define EOG_TYPE_METADATA_READER (eog_metadata_reader_get_type ())
-#define EOG_METADATA_READER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EOG_TYPE_METADATA_READER,
EogMetadataReader))
-#define EOG_IS_METADATA_READER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EOG_TYPE_METADATA_READER))
-#define EOG_METADATA_READER_GET_INTERFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), EOG_TYPE_METADATA_READER,
EogMetadataReaderInterface))
-
-typedef struct _EogMetadataReader EogMetadataReader;
-typedef struct _EogMetadataReaderInterface EogMetadataReaderInterface;
+G_DECLARE_INTERFACE (EogMetadataReader, eog_metadata_reader, EOG, METADATA_READER, GObject);
struct _EogMetadataReaderInterface {
GTypeInterface parent;
@@ -68,43 +63,40 @@ typedef enum {
EOG_METADATA_PNG
} EogMetadataFileType;
-G_GNUC_INTERNAL
-GType eog_metadata_reader_get_type (void) G_GNUC_CONST;
-
G_GNUC_INTERNAL
EogMetadataReader* eog_metadata_reader_new (EogMetadataFileType type);
G_GNUC_INTERNAL
-void eog_metadata_reader_consume (EogMetadataReader *emr,
- const guchar *buf,
- guint len);
+void eog_metadata_reader_consume (EogMetadataReader *self,
+ const guchar *buf,
+ guint len);
G_GNUC_INTERNAL
-gboolean eog_metadata_reader_finished (EogMetadataReader *emr);
+gboolean eog_metadata_reader_finished (EogMetadataReader *self);
G_GNUC_INTERNAL
-void eog_metadata_reader_get_exif_chunk (EogMetadataReader *emr,
- guchar **data,
- guint *len);
+void eog_metadata_reader_get_exif_chunk (EogMetadataReader *self,
+ guchar **data,
+ guint *len);
#ifdef HAVE_EXIF
G_GNUC_INTERNAL
-ExifData* eog_metadata_reader_get_exif_data (EogMetadataReader *emr);
+ExifData* eog_metadata_reader_get_exif_data (EogMetadataReader *self);
#endif
#ifdef HAVE_EXEMPI
G_GNUC_INTERNAL
-XmpPtr eog_metadata_reader_get_xmp_data (EogMetadataReader *emr);
+XmpPtr eog_metadata_reader_get_xmp_data (EogMetadataReader *self);
#endif
#if 0
-gpointer eog_metadata_reader_get_iptc_chunk (EogMetadataReader *emr);
-IptcData* eog_metadata_reader_get_iptc_data (EogMetadataReader *emr);
+gpointer eog_metadata_reader_get_iptc_chunk (EogMetadataReader *self);
+IptcData* eog_metadata_reader_get_iptc_data (EogMetadataReader *self);
#endif
#ifdef HAVE_LCMS
G_GNUC_INTERNAL
-cmsHPROFILE eog_metadata_reader_get_icc_profile (EogMetadataReader *emr);
+cmsHPROFILE eog_metadata_reader_get_icc_profile (EogMetadataReader *self);
#endif
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]