[balsa/wip/gtk4: 227/351] libblsa-vfs: declare it final
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa/wip/gtk4: 227/351] libblsa-vfs: declare it final
- Date: Wed, 23 May 2018 21:36:03 +0000 (UTC)
commit 82f82e6039803b56fd1371a8aa290adf6923bbcb
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Thu Mar 15 21:09:09 2018 -0400
libblsa-vfs: declare it final
Use DECLARE_FINAL_TYPE for LibBalsaVfs. It is already opaque.
libbalsa/libbalsa-vfs.c | 47 ++++++++++++-----------------------------------
libbalsa/libbalsa-vfs.h | 24 ++++++------------------
2 files changed, 18 insertions(+), 53 deletions(-)
---
diff --git a/libbalsa/libbalsa-vfs.c b/libbalsa/libbalsa-vfs.c
index 7275c1b..b5b6d0d 100644
--- a/libbalsa/libbalsa-vfs.c
+++ b/libbalsa/libbalsa-vfs.c
@@ -61,9 +61,6 @@ struct _LibbalsaVfsPriv {
};
-static GObjectClass *libbalsa_vfs_parent_class = NULL;
-
-
static void libbalsa_vfs_class_init(LibbalsaVfsClass * klass);
static void libbalsa_vfs_init(LibbalsaVfs * self);
static void libbalsa_vfs_dispose(LibbalsaVfs * self);
@@ -76,45 +73,25 @@ libbalsa_vfs_local_only(void)
return FALSE;
}
+struct _LibbalsaVfs {
+ GObject parent;
-GType
-libbalsa_vfs_get_type(void)
-{
- static GType libbalsa_vfs_type = 0;
-
- if (!libbalsa_vfs_type) {
- static const GTypeInfo libbalsa_vfs_type_info = {
- sizeof(LibbalsaVfsClass), /* class_size */
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) libbalsa_vfs_class_init, /* class_init */
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof(LibbalsaVfs), /* instance_size */
- 0, /* n_preallocs */
- (GInstanceInitFunc) libbalsa_vfs_init, /* instance_init */
- /* no value_table */
- };
-
- libbalsa_vfs_type =
- g_type_register_static(G_TYPE_OBJECT, "LibbalsaVfs",
- &libbalsa_vfs_type_info, 0);
- }
+ struct _LibbalsaVfsPriv * priv;
+};
- return libbalsa_vfs_type;
-}
+struct _LibbalsaVfsClass {
+ GObjectClass parent;
+};
+G_DEFINE_TYPE(LibbalsaVfs, libbalsa_vfs, G_TYPE_OBJECT)
static void
libbalsa_vfs_class_init(LibbalsaVfsClass * klass)
{
GObjectClass *gobject_klass = G_OBJECT_CLASS(klass);
- libbalsa_vfs_parent_class = g_type_class_peek(G_TYPE_OBJECT);
- gobject_klass->dispose =
- (GObjectFinalizeFunc) libbalsa_vfs_dispose;
- gobject_klass->finalize =
- (GObjectFinalizeFunc) libbalsa_vfs_finalize;
+ gobject_klass->dispose = (GObjectFinalizeFunc) libbalsa_vfs_dispose;
+ gobject_klass->finalize = (GObjectFinalizeFunc) libbalsa_vfs_finalize;
}
@@ -138,7 +115,7 @@ libbalsa_vfs_dispose(LibbalsaVfs * self)
g_clear_object(&priv->info);
}
- libbalsa_vfs_parent_class->dispose(G_OBJECT(self));
+ G_OBJECT_CLASS(libbalsa_vfs_parent_class)->dispose(G_OBJECT(self));
}
@@ -159,7 +136,7 @@ libbalsa_vfs_finalize(LibbalsaVfs * self)
g_free(priv);
}
- libbalsa_vfs_parent_class->finalize(G_OBJECT(self));
+ G_OBJECT_CLASS(libbalsa_vfs_parent_class)->finalize(G_OBJECT(self));
}
diff --git a/libbalsa/libbalsa-vfs.h b/libbalsa/libbalsa-vfs.h
index 1ccbde4..c1e37dc 100644
--- a/libbalsa/libbalsa-vfs.h
+++ b/libbalsa/libbalsa-vfs.h
@@ -33,25 +33,13 @@ G_BEGIN_DECLS
/* a vfs file description as GObject */
-#define LIBBALSA_TYPE_VFS (libbalsa_vfs_get_type())
-#define LIBBALSA_VFS(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LIBBALSA_TYPE_VFS, LibbalsaVfs))
-#define LIBBALSA_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LIBBALSA_TYPE_VFS, LibbalsaVfsClass))
-#define LIBBALSA_IS_VFS(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LIBBALSA_TYPE_VFS))
-#define LIBBALSA_IS_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), LIBBALSA_TYPE_VFS))
-#define LIBBALSA_VFS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), LIBBALSA_TYPE_VFS, LibbalsaVfsClass))
+#define LIBBALSA_TYPE_VFS libbalsa_vfs_get_type()
-typedef struct _LibbalsaVfsClass LibbalsaVfsClass;
-
-
-struct _LibbalsaVfs {
- GObject parent;
-
- struct _LibbalsaVfsPriv * priv;
-};
-
-struct _LibbalsaVfsClass {
- GObjectClass parent;
-};
+G_DECLARE_FINAL_TYPE(LibbalsaVfs,
+ libbalsa_vfs,
+ LIBBALSA,
+ VFS,
+ GObject)
gboolean libbalsa_vfs_local_only(void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]