[balsa/wip/gtk4: 307/351] balsa-print-object-header: declare it final
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa/wip/gtk4: 307/351] balsa-print-object-header: declare it final
- Date: Wed, 23 May 2018 21:42:47 +0000 (UTC)
commit 57d3689c9c4b0b7310b4cfe32b97b99ba81c0e64
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Sun Apr 29 11:43:47 2018 -0400
balsa-print-object-header: declare it final
The object is already private.
src/balsa-print-object-header.c | 52 ++++++--------------------------------
src/balsa-print-object-header.h | 23 ++++------------
2 files changed, 15 insertions(+), 60 deletions(-)
---
diff --git a/src/balsa-print-object-header.c b/src/balsa-print-object-header.c
index 9669a87..29c6664 100644
--- a/src/balsa-print-object-header.c
+++ b/src/balsa-print-object-header.c
@@ -30,9 +30,6 @@
/* object related functions */
-static void balsa_print_object_header_class_init(BalsaPrintObjectHeaderClass *klass);
-static void balsa_print_object_header_init(GTypeInstance *instance,
- gpointer g_class);
static void balsa_print_object_header_finalize(GObject *self);
static void balsa_print_object_header_draw(BalsaPrintObject *self,
@@ -55,53 +52,22 @@ static void header_add_list(PangoLayout *layout,
gboolean print_all_headers);
-static BalsaPrintObjectClass *parent_class = NULL;
-
-
-GType
-balsa_print_object_header_get_type()
-{
- static GType balsa_print_object_header_type = 0;
-
- if (!balsa_print_object_header_type) {
- static const GTypeInfo balsa_print_object_header_info = {
- sizeof(BalsaPrintObjectHeaderClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) balsa_print_object_header_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof(BalsaPrintObjectHeader),
- 0, /* n_preallocs */
- (GInstanceInitFunc) balsa_print_object_header_init
- };
-
- balsa_print_object_header_type =
- g_type_register_static(BALSA_TYPE_PRINT_OBJECT,
- "BalsaPrintObjectHeader",
- &balsa_print_object_header_info, 0);
- }
-
- return balsa_print_object_header_type;
-}
+G_DEFINE_TYPE(BalsaPrintObjectHeader,
+ balsa_print_object_header,
+ BALSA_TYPE_PRINT_OBJECT)
static void
balsa_print_object_header_class_init(BalsaPrintObjectHeaderClass *klass)
{
- parent_class = g_type_class_ref(BALSA_TYPE_PRINT_OBJECT);
- BALSA_PRINT_OBJECT_CLASS(klass)->draw =
- balsa_print_object_header_draw;
+ BALSA_PRINT_OBJECT_CLASS(klass)->draw = balsa_print_object_header_draw;
G_OBJECT_CLASS(klass)->finalize = balsa_print_object_header_finalize;
}
static void
-balsa_print_object_header_init(GTypeInstance *instance,
- gpointer g_class)
+balsa_print_object_header_init(BalsaPrintObjectHeader *poh)
{
- BalsaPrintObjectHeader *poh = BALSA_PRINT_OBJECT_HEADER(instance);
-
poh->headers = NULL;
}
@@ -109,12 +75,12 @@ balsa_print_object_header_init(GTypeInstance *instance,
static void
balsa_print_object_header_finalize(GObject *self)
{
- BalsaPrintObjectHeader *po = BALSA_PRINT_OBJECT_HEADER(self);
+ BalsaPrintObjectHeader *poh = BALSA_PRINT_OBJECT_HEADER(self);
- g_free(po->headers);
- g_clear_object(&po->face);
+ g_free(poh->headers);
+ g_clear_object(&poh->face);
- G_OBJECT_CLASS(parent_class)->finalize(self);
+ G_OBJECT_CLASS(balsa_print_object_header_parent_class)->finalize(self);
}
diff --git a/src/balsa-print-object-header.h b/src/balsa-print-object-header.h
index af47dca..38ce83e 100644
--- a/src/balsa-print-object-header.h
+++ b/src/balsa-print-object-header.h
@@ -28,18 +28,13 @@
G_BEGIN_DECLS
-#define BALSA_TYPE_PRINT_OBJECT_HEADER \
- (balsa_print_object_header_get_type())
-#define BALSA_PRINT_OBJECT_HEADER(obj) \
- G_TYPE_CHECK_INSTANCE_CAST(obj, BALSA_TYPE_PRINT_OBJECT_HEADER, BalsaPrintObjectHeader)
-#define BALSA_PRINT_OBJECT_HEADER_CLASS(klass) \
- G_TYPE_CHECK_CLASS_CAST(klass, BALSA_TYPE_PRINT_OBJECT_HEADER, BalsaPrintObjectHeaderClass)
-#define BALSA_IS_PRINT_OBJECT_HEADER(obj) \
- G_TYPE_CHECK_INSTANCE_TYPE(obj, BALSA_TYPE_PRINT_OBJECT_HEADER)
+#define BALSA_TYPE_PRINT_OBJECT_HEADER balsa_print_object_header_get_type()
-
-typedef struct _BalsaPrintObjectHeaderClass BalsaPrintObjectHeaderClass;
-typedef struct _BalsaPrintObjectHeader BalsaPrintObjectHeader;
+G_DECLARE_FINAL_TYPE(BalsaPrintObjectHeader,
+ balsa_print_object_header,
+ BALSA,
+ PRINT_OBJECT_HEADER,
+ BalsaPrintObject)
struct _BalsaPrintObjectHeader {
@@ -52,12 +47,6 @@ struct _BalsaPrintObjectHeader {
};
-struct _BalsaPrintObjectHeaderClass {
- BalsaPrintObjectClass parent;
-};
-
-
-GType balsa_print_object_header_get_type(void);
GList *balsa_print_object_header_from_message(GList *list,
GtkPrintContext *context,
LibBalsaMessage *message,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]