[gcr/main: 21/27] gcr-import-interaction: Use G_DECLARE_INTERFACE to define the interface




commit 82d7c6c0cea931e7ed73658053011a74dfe4512a
Author: Corentin Noël <corentin noel collabora com>
Date:   Fri Dec 10 09:10:40 2021 +0100

    gcr-import-interaction: Use G_DECLARE_INTERFACE to define the interface
    
    This means that GcrImportInteractionIface becomes GcrImportInteractionInterface
    and GCR_IMPORT_INTERACTION_GET_INTERFACE becomes
    GCR_IMPORT_INTERACTION_GET_IFACE.
    
    Signed-off-by: Corentin Noël <corentin noel collabora com>

 gcr/gcr-import-interaction.c | 27 ++++++++++-----------------
 gcr/gcr-import-interaction.h | 13 +++----------
 2 files changed, 13 insertions(+), 27 deletions(-)
---
diff --git a/gcr/gcr-import-interaction.c b/gcr/gcr-import-interaction.c
index b8da073..edf0675 100644
--- a/gcr/gcr-import-interaction.c
+++ b/gcr/gcr-import-interaction.c
@@ -33,7 +33,7 @@
  */
 
 /**
- * GcrImportInteractionIface:
+ * GcrImportInteractionInterface:
  * @parent: parent interface
  * @supplement_prep: method which prepares for supplementing the given attributes before import
  * @supplement: method which synchronously supplements attributes before import
@@ -43,18 +43,11 @@
  * Interface implemented by implementations of [iface@ImportInteraction].
  */
 
-typedef GcrImportInteractionIface GcrImportInteractionInterface;
-
 G_DEFINE_INTERFACE (GcrImportInteraction, gcr_import_interaction, G_TYPE_TLS_INTERACTION);
 
 static void
-gcr_import_interaction_default_init (GcrImportInteractionIface *iface)
+gcr_import_interaction_default_init (GcrImportInteractionInterface *iface)
 {
-       static size_t initialized = 0;
-
-       if (g_once_init_enter (&initialized)) {
-               g_once_init_leave (&initialized, 1);
-       }
 }
 
 /**
@@ -74,12 +67,12 @@ void
 gcr_import_interaction_supplement_prep (GcrImportInteraction *interaction,
                                         GckBuilder *builder)
 {
-       GcrImportInteractionIface *iface;
+       GcrImportInteractionInterface *iface;
 
        g_return_if_fail (GCR_IS_IMPORT_INTERACTION (interaction));
        g_return_if_fail (builder != NULL);
 
-       iface = GCR_IMPORT_INTERACTION_GET_INTERFACE (interaction);
+       iface = GCR_IMPORT_INTERACTION_GET_IFACE (interaction);
        if (iface->supplement != NULL)
                (iface->supplement_prep) (interaction, builder);
 }
@@ -106,14 +99,14 @@ gcr_import_interaction_supplement (GcrImportInteraction *interaction,
                                    GCancellable *cancellable,
                                    GError **error)
 {
-       GcrImportInteractionIface *iface;
+       GcrImportInteractionInterface *iface;
 
        g_return_val_if_fail (GCR_IS_IMPORT_INTERACTION (interaction), G_TLS_INTERACTION_UNHANDLED);
        g_return_val_if_fail (builder != NULL, G_TLS_INTERACTION_UNHANDLED);
        g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), 
G_TLS_INTERACTION_UNHANDLED);
        g_return_val_if_fail (error == NULL || *error == NULL, G_TLS_INTERACTION_UNHANDLED);
 
-       iface = GCR_IMPORT_INTERACTION_GET_INTERFACE (interaction);
+       iface = GCR_IMPORT_INTERACTION_GET_IFACE (interaction);
        g_return_val_if_fail (iface->supplement != NULL, G_TLS_INTERACTION_UNHANDLED);
 
        return (iface->supplement) (interaction, builder, cancellable, error);
@@ -141,13 +134,13 @@ gcr_import_interaction_supplement_async (GcrImportInteraction *interaction,
                                          GAsyncReadyCallback callback,
                                          gpointer user_data)
 {
-       GcrImportInteractionIface *iface;
+       GcrImportInteractionInterface *iface;
 
        g_return_if_fail (GCR_IS_IMPORT_INTERACTION (interaction));
        g_return_if_fail (builder != NULL);
        g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
 
-       iface = GCR_IMPORT_INTERACTION_GET_INTERFACE (interaction);
+       iface = GCR_IMPORT_INTERACTION_GET_IFACE (interaction);
        g_return_if_fail (iface->supplement != NULL);
 
        (iface->supplement_async) (interaction, builder, cancellable, callback, user_data);
@@ -171,13 +164,13 @@ gcr_import_interaction_supplement_finish (GcrImportInteraction *interaction,
                                           GAsyncResult *result,
                                           GError **error)
 {
-       GcrImportInteractionIface *iface;
+       GcrImportInteractionInterface *iface;
 
        g_return_val_if_fail (GCR_IS_IMPORT_INTERACTION (interaction), G_TLS_INTERACTION_UNHANDLED);
        g_return_val_if_fail (G_IS_ASYNC_RESULT (result), G_TLS_INTERACTION_UNHANDLED);
        g_return_val_if_fail (error == NULL || *error == NULL, G_TLS_INTERACTION_UNHANDLED);
 
-       iface = GCR_IMPORT_INTERACTION_GET_INTERFACE (interaction);
+       iface = GCR_IMPORT_INTERACTION_GET_IFACE (interaction);
        g_return_val_if_fail (iface->supplement != NULL, G_TLS_INTERACTION_UNHANDLED);
 
        return (iface->supplement_finish) (interaction, result, error);
diff --git a/gcr/gcr-import-interaction.h b/gcr/gcr-import-interaction.h
index 79d615b..a0af10e 100644
--- a/gcr/gcr-import-interaction.h
+++ b/gcr/gcr-import-interaction.h
@@ -34,15 +34,10 @@
 
 G_BEGIN_DECLS
 
-#define GCR_TYPE_IMPORT_INTERACTION                 (gcr_import_interaction_get_type ())
-#define GCR_IMPORT_INTERACTION(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
GCR_TYPE_IMPORT_INTERACTION, GcrImportInteraction))
-#define GCR_IS_IMPORT_INTERACTION(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
GCR_TYPE_IMPORT_INTERACTION))
-#define GCR_IMPORT_INTERACTION_GET_INTERFACE(inst)  (G_TYPE_INSTANCE_GET_INTERFACE ((inst), 
GCR_TYPE_IMPORT_INTERACTION, GcrImportInteractionIface))
+#define GCR_TYPE_IMPORT_INTERACTION gcr_import_interaction_get_type ()
+G_DECLARE_INTERFACE(GcrImportInteraction, gcr_import_interaction, GCR, IMPORT_INTERACTION, GTlsInteraction)
 
-typedef struct _GcrImportInteraction GcrImportInteraction;
-typedef struct _GcrImportInteractionIface GcrImportInteractionIface;
-
-struct _GcrImportInteractionIface {
+struct _GcrImportInteractionInterface {
        GTypeInterface parent;
 
        void                    (*supplement_prep)   (GcrImportInteraction *interaction,
@@ -67,8 +62,6 @@ struct _GcrImportInteractionIface {
        gpointer reserved[6];
 };
 
-GType                  gcr_import_interaction_get_type             (void);
-
 void                   gcr_import_interaction_supplement_prep      (GcrImportInteraction *interaction,
                                                                     GckBuilder *builder);
 


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