[balsa] Declare LibBalsaSmtpServer final
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa] Declare LibBalsaSmtpServer final
- Date: Sat, 8 Jun 2019 15:34:35 +0000 (UTC)
commit cf459eb19b7a93967aafa0c1ce27d09bfc8b273e
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Sat Jun 8 11:33:46 2019 -0400
Declare LibBalsaSmtpServer final
Use G_DECLARE_FINAL_TYPE to declare LibBalsaSmtpServer
The object was already private.
* libbalsa/smtp-server.c (libbalsa_smtp_server_finalize),
(libbalsa_smtp_server_class_init), (libbalsa_smtp_server_init):
* libbalsa/smtp-server.h:
ChangeLog | 10 ++++++++++
libbalsa/smtp-server.c | 49 +++++--------------------------------------------
libbalsa/smtp-server.h | 21 +++++++--------------
3 files changed, 22 insertions(+), 58 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index bdfaab762..411403ec6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2019-06-08 Peter Bloomfield <pbloomfield bellsouth net>
+
+ Use G_DECLARE_FINAL_TYPE to declare LibBalsaSmtpServer
+
+ The object was already private.
+
+ * libbalsa/smtp-server.c (libbalsa_smtp_server_finalize),
+ (libbalsa_smtp_server_class_init), (libbalsa_smtp_server_init):
+ * libbalsa/smtp-server.h:
+
2019-06-08 Peter Bloomfield <pbloomfield bellsouth net>
Use G_DECLARE_FINAL_TYPE to declare LibBalsaImapServer
diff --git a/libbalsa/smtp-server.c b/libbalsa/smtp-server.c
index 9ee78d124..94ecb85c1 100644
--- a/libbalsa/smtp-server.c
+++ b/libbalsa/smtp-server.c
@@ -24,24 +24,17 @@
/*
* LibBalsaSmtpServer is a subclass of LibBalsaServer.
*/
-#include "server.h"
+#include "smtp-server.h"
-#include <string.h>
+#include <glib/gi18n.h>
-#include "libbalsa.h"
-#include "smtp-server.h"
#include "libbalsa-conf.h"
-#include "misc.h"
-#include <glib/gi18n.h>
-#include "net-client.h"
#include "server-config.h"
#if HAVE_MACOSX_DESKTOP
# include "macosx-helpers.h"
#endif
-static LibBalsaServerClass *parent_class = NULL;
-
struct _LibBalsaSmtpServer {
LibBalsaServer server;
@@ -50,11 +43,9 @@ struct _LibBalsaSmtpServer {
gint lock_state; /* 0 means unlocked; access via atomic operations */
};
-typedef struct _LibBalsaSmtpServerClass {
- LibBalsaServerClass parent_class;
-} LibBalsaSmtpServerClass;
+/* Class boilerplate */
-/* Server class methods */
+G_DEFINE_TYPE(LibBalsaSmtpServer, libbalsa_smtp_server, LIBBALSA_TYPE_SERVER)
/* Object class method */
@@ -69,7 +60,7 @@ libbalsa_smtp_server_finalize(GObject * object)
g_free(smtp_server->name);
- G_OBJECT_CLASS(parent_class)->finalize(object);
+ G_OBJECT_CLASS(libbalsa_smtp_server_parent_class)->finalize(object);
}
static void
@@ -79,8 +70,6 @@ libbalsa_smtp_server_class_init(LibBalsaSmtpServerClass * klass)
object_class = G_OBJECT_CLASS(klass);
- parent_class = g_type_class_peek_parent(klass);
-
object_class->finalize = libbalsa_smtp_server_finalize;
}
@@ -90,34 +79,6 @@ libbalsa_smtp_server_init(LibBalsaSmtpServer * smtp_server)
libbalsa_server_set_protocol(LIBBALSA_SERVER(smtp_server), "smtp");
}
-/* Class boilerplate */
-
-GType
-libbalsa_smtp_server_get_type(void)
-{
- static GType server_type = 0;
-
- if (!server_type) {
- static const GTypeInfo server_info = {
- sizeof(LibBalsaSmtpServerClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) libbalsa_smtp_server_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof(LibBalsaSmtpServer),
- 0, /* n_preallocs */
- (GInstanceInitFunc) libbalsa_smtp_server_init
- };
-
- server_type =
- g_type_register_static(LIBBALSA_TYPE_SERVER,
- "LibBalsaSmtpServer", &server_info, 0);
- }
-
- return server_type;
-}
-
/* Public methods */
/**
diff --git a/libbalsa/smtp-server.h b/libbalsa/smtp-server.h
index f037d1187..6245bc4d8 100644
--- a/libbalsa/smtp-server.h
+++ b/libbalsa/smtp-server.h
@@ -21,22 +21,15 @@
#define __SMTP_SERVER_H__
#include <gtk/gtk.h>
-#include "libbalsa.h"
+#include "server.h"
-#define LIBBALSA_TYPE_SMTP_SERVER \
- (libbalsa_smtp_server_get_type())
-#define LIBBALSA_SMTP_SERVER(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST(obj, LIBBALSA_TYPE_SMTP_SERVER, \
- LibBalsaSmtpServer))
-#define LIBBALSA_SMTP_SERVER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST(klass, LIBBALSA_TYPE_SMTP_SERVER, \
- LibBalsaSmtpServerClass))
-#define LIBBALSA_IS_SMTP_SERVER(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE(obj, LIBBALSA_TYPE_SMTP_SERVER))
-#define LIBBALSA_IS_SMTP_SERVER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE(klass, LIBBALSA_TYPE_SMTP_SERVER))
+#define LIBBALSA_TYPE_SMTP_SERVER (libbalsa_smtp_server_get_type())
-GType libbalsa_smtp_server_get_type(void);
+G_DECLARE_FINAL_TYPE(LibBalsaSmtpServer,
+ libbalsa_smtp_server,
+ LIBBALSA,
+ SMTP_SERVER,
+ LibBalsaServer)
LibBalsaSmtpServer *libbalsa_smtp_server_new(void);
LibBalsaSmtpServer *libbalsa_smtp_server_new_from_config(const gchar *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]