[gcr/main: 16/30] gcr-importer: Use G_DECLARE_INTERFACE to define the interface
- From: Corentin Noël <corentinnoel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gcr/main: 16/30] gcr-importer: Use G_DECLARE_INTERFACE to define the interface
- Date: Sun, 27 Mar 2022 08:40:10 +0000 (UTC)
commit c00f771687792bcfb71822da95313607a54e0d97
Author: Corentin Noël <corentin noel collabora com>
Date: Fri Dec 10 09:15:13 2021 +0100
gcr-importer: Use G_DECLARE_INTERFACE to define the interface
This means that GcrImporterIface becomes GcrImporterInterface and
GCR_IMPORTER_GET_INTERFACE becomes GCR_IMPORTER_GET_IFACE.
Signed-off-by: Corentin Noël <corentin noel collabora com>
gcr/gcr-gnupg-importer.c | 4 ++--
gcr/gcr-importer.c | 24 +++++++++++-------------
gcr/gcr-importer.h | 13 +++----------
gcr/gcr-pkcs11-importer.c | 4 ++--
4 files changed, 18 insertions(+), 27 deletions(-)
---
diff --git a/gcr/gcr-gnupg-importer.c b/gcr/gcr-gnupg-importer.c
index 79fa043d..63b7b587 100644
--- a/gcr/gcr-gnupg-importer.c
+++ b/gcr/gcr-gnupg-importer.c
@@ -45,7 +45,7 @@ struct _GcrGnupgImporterPrivate {
GArray *imported;
};
-static void gcr_gnupg_importer_iface (GcrImporterIface *iface);
+static void gcr_gnupg_importer_iface (GcrImporterInterface *iface);
G_DEFINE_TYPE_WITH_CODE (GcrGnupgImporter, _gcr_gnupg_importer, G_TYPE_OBJECT,
G_ADD_PRIVATE (GcrGnupgImporter);
@@ -348,7 +348,7 @@ _gcr_gnupg_importer_import_finish (GcrImporter *importer,
}
static void
-gcr_gnupg_importer_iface (GcrImporterIface *iface)
+gcr_gnupg_importer_iface (GcrImporterInterface *iface)
{
iface->create_for_parsed = _gcr_gnupg_importer_create_for_parsed;
iface->queue_for_parsed = _gcr_gnupg_importer_queue_for_parsed;
diff --git a/gcr/gcr-importer.c b/gcr/gcr-importer.c
index 516e97a1..5e41ab3d 100644
--- a/gcr/gcr-importer.c
+++ b/gcr/gcr-importer.c
@@ -52,7 +52,7 @@
*/
/**
- * GcrImporterIface:
+ * GcrImporterInterface:
* @parent: parent interface
* @create_for_parsed: implementation of gcr_importer_create_for_parsed(), required
* @queue_for_parsed: implementation of gcr_importer_queue_for_parsed(), required
@@ -63,8 +63,6 @@
* Interface implemented for a #GcrImporter.
*/
-typedef GcrImporterIface GcrImporterInterface;
-
G_DEFINE_INTERFACE (GcrImporter, gcr_importer, G_TYPE_OBJECT);
typedef struct _GcrRegistered {
@@ -76,7 +74,7 @@ static GArray *registered_importers = NULL;
static gboolean registered_sorted = FALSE;
static void
-gcr_importer_default_init (GcrImporterIface *iface)
+gcr_importer_default_init (GcrImporterInterface *iface)
{
static size_t initialized = 0;
@@ -196,7 +194,7 @@ GList *
gcr_importer_create_for_parsed (GcrParsed *parsed)
{
GcrRegistered *registered;
- GcrImporterIface *iface;
+ GcrImporterInterface *iface;
gpointer instance_class;
GckAttributes *attrs;
gboolean matched;
@@ -285,12 +283,12 @@ gboolean
gcr_importer_queue_for_parsed (GcrImporter *importer,
GcrParsed *parsed)
{
- GcrImporterIface *iface;
+ GcrImporterInterface *iface;
g_return_val_if_fail (GCR_IS_IMPORTER (importer), FALSE);
g_return_val_if_fail (parsed != NULL, FALSE);
- iface = GCR_IMPORTER_GET_INTERFACE (importer);
+ iface = GCR_IMPORTER_GET_IFACE (importer);
g_return_val_if_fail (iface != NULL, FALSE);
g_return_val_if_fail (iface->queue_for_parsed != NULL, FALSE);
@@ -377,13 +375,13 @@ gcr_importer_import (GcrImporter *importer,
{
gboolean result;
ImportClosure *closure;
- GcrImporterIface *iface;
+ GcrImporterInterface *iface;
g_return_val_if_fail (GCR_IS_IMPORTER (importer), FALSE);
g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
- iface = GCR_IMPORTER_GET_INTERFACE (importer);
+ iface = GCR_IMPORTER_GET_IFACE (importer);
if (iface->import_sync)
return (iface->import_sync) (importer, cancellable, error);
@@ -454,12 +452,12 @@ gcr_importer_import_async (GcrImporter *importer,
GAsyncReadyCallback callback,
gpointer user_data)
{
- GcrImporterIface *iface;
+ GcrImporterInterface *iface;
g_return_if_fail (GCR_IS_IMPORTER (importer));
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
- iface = GCR_IMPORTER_GET_INTERFACE (importer);
+ iface = GCR_IMPORTER_GET_IFACE (importer);
g_return_if_fail (iface != NULL);
g_return_if_fail (iface->import_async != NULL);
@@ -481,13 +479,13 @@ gcr_importer_import_finish (GcrImporter *importer,
GAsyncResult *result,
GError **error)
{
- GcrImporterIface *iface;
+ GcrImporterInterface *iface;
g_return_val_if_fail (GCR_IS_IMPORTER (importer), FALSE);
g_return_val_if_fail (G_IS_ASYNC_RESULT (result), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
- iface = GCR_IMPORTER_GET_INTERFACE (importer);
+ iface = GCR_IMPORTER_GET_IFACE (importer);
g_return_val_if_fail (iface != NULL, FALSE);
g_return_val_if_fail (iface->import_finish != NULL, FALSE);
diff --git a/gcr/gcr-importer.h b/gcr/gcr-importer.h
index 7a1bcc1f..721b2144 100644
--- a/gcr/gcr-importer.h
+++ b/gcr/gcr-importer.h
@@ -34,15 +34,10 @@
G_BEGIN_DECLS
-#define GCR_TYPE_IMPORTER (gcr_importer_get_type ())
-#define GCR_IMPORTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCR_TYPE_IMPORTER,
GcrImporter))
-#define GCR_IS_IMPORTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCR_TYPE_IMPORTER))
-#define GCR_IMPORTER_GET_INTERFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GCR_TYPE_IMPORTER,
GcrImporterIface))
+#define GCR_TYPE_IMPORTER gcr_importer_get_type ()
+G_DECLARE_INTERFACE (GcrImporter, gcr_importer, GCR, IMPORTER, GObject)
-typedef struct _GcrImporter GcrImporter;
-typedef struct _GcrImporterIface GcrImporterIface;
-
-struct _GcrImporterIface {
+struct _GcrImporterInterface {
GTypeInterface parent;
GList * (*create_for_parsed) (GcrParsed *parsed);
@@ -67,8 +62,6 @@ struct _GcrImporterIface {
gpointer reserved[14];
};
-GType gcr_importer_get_type (void);
-
GList * gcr_importer_create_for_parsed (GcrParsed *parsed);
gboolean gcr_importer_queue_for_parsed (GcrImporter *importer,
diff --git a/gcr/gcr-pkcs11-importer.c b/gcr/gcr-pkcs11-importer.c
index 302eb727..b2aa9aef 100644
--- a/gcr/gcr-pkcs11-importer.c
+++ b/gcr/gcr-pkcs11-importer.c
@@ -72,7 +72,7 @@ static void state_cancelled (GTask *task,
gboolean async);
static void state_create_object (GTask *task,
gboolean async);
-static void _gcr_pkcs11_importer_init_iface (GcrImporterIface *iface);
+static void _gcr_pkcs11_importer_init_iface (GcrImporterInterface *iface);
G_DEFINE_TYPE_WITH_CODE (GcrPkcs11Importer, _gcr_pkcs11_importer, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (GCR_TYPE_IMPORTER, _gcr_pkcs11_importer_init_iface);
@@ -851,7 +851,7 @@ _gcr_pkcs11_importer_import_finish (GcrImporter *importer,
}
static void
-_gcr_pkcs11_importer_init_iface (GcrImporterIface *iface)
+_gcr_pkcs11_importer_init_iface (GcrImporterInterface *iface)
{
iface->create_for_parsed = _gcr_pkcs11_importer_create_for_parsed;
iface->queue_for_parsed = _gcr_pkcs11_importer_queue_for_parsed;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]