[gcr/main] gcr-comparable: Use G_DECLARE_INTERFACE to define the interface



commit 64394f01f1f53075bc42288f07e8f97f3a0a3a00
Author: Corentin Noël <corentin noel collabora com>
Date:   Thu Dec 9 12:08:33 2021 +0100

    gcr-comparable: Use G_DECLARE_INTERFACE to define the interface
    
    This means that GcrComparableIface becomes GcrComparableInterface and
    GCR_COMPARABLE_GET_INTERFACE becomes GCR_COMPARABLE_GET_IFACE.
    
    Signed-off-by: Corentin Noël <corentin noel collabora com>

 gcr/gcr-certificate.c |  2 +-
 gcr/gcr-certificate.h |  2 +-
 gcr/gcr-comparable.c  |  9 ++++-----
 gcr/gcr-comparable.h  | 13 +++----------
 4 files changed, 9 insertions(+), 17 deletions(-)
---
diff --git a/gcr/gcr-certificate.c b/gcr/gcr-certificate.c
index dd2b666..eb1b10a 100644
--- a/gcr/gcr-certificate.c
+++ b/gcr/gcr-certificate.c
@@ -1081,7 +1081,7 @@ gcr_certificate_mixin_emit_notify (GcrCertificate *self)
  * macro instead of this function.
  */
 void
-gcr_certificate_mixin_comparable_init (GcrComparableIface *iface)
+gcr_certificate_mixin_comparable_init (GcrComparableInterface *iface)
 {
        iface->compare = gcr_certificate_compare;
 }
diff --git a/gcr/gcr-certificate.h b/gcr/gcr-certificate.h
index b414325..3cd2c18 100644
--- a/gcr/gcr-certificate.h
+++ b/gcr/gcr-certificate.h
@@ -137,7 +137,7 @@ gboolean            gcr_certificate_get_basic_constraints  (GcrCertificate *self
 
 void                gcr_certificate_mixin_emit_notify      (GcrCertificate *self);
 
-void                gcr_certificate_mixin_comparable_init  (GcrComparableIface *iface);
+void                gcr_certificate_mixin_comparable_init  (GcrComparableInterface *iface);
 
 void                gcr_certificate_mixin_class_init       (GObjectClass *object_class);
 
diff --git a/gcr/gcr-comparable.c b/gcr/gcr-comparable.c
index 91d54e9..4572dd1 100644
--- a/gcr/gcr-comparable.c
+++ b/gcr/gcr-comparable.c
@@ -30,18 +30,17 @@
  */
 
 /**
- * GcrComparableIface:
+ * GcrComparableInterface:
  * @parent: type interface
  * @compare: Compare whether tow objects represent the same thing.
  *
  * The interface to implement for [iface@Comparable]
  */
 
-typedef GcrComparableIface GcrComparableInterface;
 G_DEFINE_INTERFACE (GcrComparable, gcr_comparable, G_TYPE_OBJECT);
 
 static void
-gcr_comparable_default_init (GcrComparableIface *iface)
+gcr_comparable_default_init (GcrComparableInterface *iface)
 {
 
 }
@@ -61,9 +60,9 @@ gint
 gcr_comparable_compare (GcrComparable *self, GcrComparable *other)
 {
        g_return_val_if_fail (GCR_IS_COMPARABLE (self), -1);
-       g_return_val_if_fail (GCR_COMPARABLE_GET_INTERFACE (self)->compare, -1);
+       g_return_val_if_fail (GCR_COMPARABLE_GET_IFACE (self)->compare, -1);
        g_return_val_if_fail (G_IS_OBJECT (self), -1);
-       return GCR_COMPARABLE_GET_INTERFACE (self)->compare (self, other);
+       return GCR_COMPARABLE_GET_IFACE (self)->compare (self, other);
 }
 
 /**
diff --git a/gcr/gcr-comparable.h b/gcr/gcr-comparable.h
index 5a8e28f..8d2208e 100644
--- a/gcr/gcr-comparable.h
+++ b/gcr/gcr-comparable.h
@@ -24,21 +24,14 @@
 
 G_BEGIN_DECLS
 
-#define GCR_TYPE_COMPARABLE                 (gcr_comparable_get_type())
-#define GCR_COMPARABLE(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCR_TYPE_COMPARABLE, 
GcrComparable))
-#define GCR_IS_COMPARABLE(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCR_TYPE_COMPARABLE))
-#define GCR_COMPARABLE_GET_INTERFACE(inst)  (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GCR_TYPE_COMPARABLE, 
GcrComparableIface))
+#define GCR_TYPE_COMPARABLE gcr_comparable_get_type ()
+G_DECLARE_INTERFACE (GcrComparable, gcr_comparable, GCR, COMPARABLE, GObject)
 
-typedef struct _GcrComparable      GcrComparable;
-typedef struct _GcrComparableIface GcrComparableIface;
-
-struct _GcrComparableIface {
+struct _GcrComparableInterface {
        GTypeInterface parent;
        gint (*compare) (GcrComparable *self, GcrComparable *other);
 };
 
-GType               gcr_comparable_get_type               (void);
-
 gint                gcr_comparable_compare                (GcrComparable *self,
                                                            GcrComparable *other);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]