[balsa/wip/gtk4: 305/351] balsa-print-object-decor: declare it final
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa/wip/gtk4: 305/351] balsa-print-object-decor: declare it final
- Date: Wed, 23 May 2018 21:42:37 +0000 (UTC)
commit da83a0422435144b9e747e59928549403e8c022c
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Sat Apr 28 22:27:20 2018 -0400
balsa-print-object-decor: declare it final
src/balsa-print-object-decor.c | 45 +++++----------------------------------
src/balsa-print-object-decor.h | 22 +++++--------------
2 files changed, 12 insertions(+), 55 deletions(-)
---
diff --git a/src/balsa-print-object-decor.c b/src/balsa-print-object-decor.c
index d43e0e1..2da774c 100644
--- a/src/balsa-print-object-decor.c
+++ b/src/balsa-print-object-decor.c
@@ -27,8 +27,6 @@
/* object related functions */
static void balsa_print_object_decor_class_init(BalsaPrintObjectDecorClass *klass);
-static void balsa_print_object_decor_init(GTypeInstance *instance,
- gpointer g_class);
static void balsa_print_object_decor_finalize(GObject *self);
static void balsa_print_object_decor_draw(BalsaPrintObject *self,
@@ -36,53 +34,22 @@ static void balsa_print_object_decor_draw(BalsaPrintObject *self,
cairo_t *cairo_ctx);
-static BalsaPrintObjectClass *parent_class = NULL;
-
-
-GType
-balsa_print_object_decor_get_type()
-{
- static GType balsa_print_object_decor_type = 0;
-
- if (!balsa_print_object_decor_type) {
- static const GTypeInfo balsa_print_object_decor_info = {
- sizeof(BalsaPrintObjectDecorClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) balsa_print_object_decor_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof(BalsaPrintObjectDecor),
- 0, /* n_preallocs */
- (GInstanceInitFunc) balsa_print_object_decor_init
- };
-
- balsa_print_object_decor_type =
- g_type_register_static(BALSA_TYPE_PRINT_OBJECT,
- "BalsaPrintObjectDecor",
- &balsa_print_object_decor_info, 0);
- }
-
- return balsa_print_object_decor_type;
-}
+G_DEFINE_TYPE(BalsaPrintObjectDecor,
+ balsa_print_object_decor,
+ BALSA_TYPE_PRINT_OBJECT)
static void
balsa_print_object_decor_class_init(BalsaPrintObjectDecorClass *klass)
{
- parent_class = g_type_class_ref(BALSA_TYPE_PRINT_OBJECT);
- BALSA_PRINT_OBJECT_CLASS(klass)->draw =
- balsa_print_object_decor_draw;
+ BALSA_PRINT_OBJECT_CLASS(klass)->draw = balsa_print_object_decor_draw;
G_OBJECT_CLASS(klass)->finalize = balsa_print_object_decor_finalize;
}
static void
-balsa_print_object_decor_init(GTypeInstance *instance,
- gpointer g_class)
+balsa_print_object_decor_init(BalsaPrintObjectDecor *pod)
{
- BalsaPrintObjectDecor *pod = BALSA_PRINT_OBJECT_DECOR(instance);
-
pod->label = NULL;
}
@@ -94,7 +61,7 @@ balsa_print_object_decor_finalize(GObject *self)
g_free(pod->label);
- G_OBJECT_CLASS(parent_class)->finalize(self);
+ G_OBJECT_CLASS(balsa_print_object_decor_parent_class)->finalize(self);
}
diff --git a/src/balsa-print-object-decor.h b/src/balsa-print-object-decor.h
index d7f105c..514076c 100644
--- a/src/balsa-print-object-decor.h
+++ b/src/balsa-print-object-decor.h
@@ -24,17 +24,13 @@
G_BEGIN_DECLS
-#define BALSA_TYPE_PRINT_OBJECT_DECOR \
- (balsa_print_object_decor_get_type())
-#define BALSA_PRINT_OBJECT_DECOR(obj) \
- G_TYPE_CHECK_INSTANCE_CAST(obj, BALSA_TYPE_PRINT_OBJECT_DECOR, BalsaPrintObjectDecor)
-#define BALSA_PRINT_OBJECT_DECOR_CLASS(klass) \
- G_TYPE_CHECK_CLASS_CAST(klass, BALSA_TYPE_PRINT_OBJECT_DECOR, BalsaPrintObjectDecorClass)
-#define BALSA_IS_PRINT_OBJECT_DECOR(obj) \
- G_TYPE_CHECK_INSTANCE_TYPE(obj, BALSA_TYPE_PRINT_OBJECT_DECOR)
+#define BALSA_TYPE_PRINT_OBJECT_DECOR balsa_print_object_decor_get_type()
-typedef struct _BalsaPrintObjectDecorClass BalsaPrintObjectDecorClass;
-typedef struct _BalsaPrintObjectDecor BalsaPrintObjectDecor;
+G_DECLARE_FINAL_TYPE(BalsaPrintObjectDecor,
+ balsa_print_object_decor,
+ BALSA,
+ PRINT_OBJECT_DECOR,
+ BalsaPrintObject)
typedef enum {
BALSA_PRINT_DECOR_FRAME_BEGIN,
@@ -50,12 +46,6 @@ struct _BalsaPrintObjectDecor {
};
-struct _BalsaPrintObjectDecorClass {
- BalsaPrintObjectClass parent;
-};
-
-
-GType balsa_print_object_decor_get_type(void);
GList *balsa_print_object_separator(GList *list,
BalsaPrintSetup *psetup);
GList *balsa_print_object_frame_begin(GList *list,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]