From bdf518f37fcf9b9ecc48aa9c4c490cd359627206 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Wed, 22 Jun 2016 18:12:29 +0200 Subject: [PATCH] Create new configuration object --- wmud/wmud-configuration.c | 41 +++++++++++++++++++++++++++++++++++++++ wmud/wmud-configuration.h | 33 +++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 wmud/wmud-configuration.c create mode 100644 wmud/wmud-configuration.h diff --git a/wmud/wmud-configuration.c b/wmud/wmud-configuration.c new file mode 100644 index 0000000..3cc497b --- /dev/null +++ b/wmud/wmud-configuration.c @@ -0,0 +1,41 @@ +#include "wmud-configuration.h" + +typedef struct _WmudConfigurationPrivate { + gchar *file_name; + guint port; + gchar *database_dsn; + gchar *admin_email; + gchar *smtp_server; + gboolean smtp_tls; + gchar *smtp_username; + gchar *smtp_password; + gchar *smtp_sender; +} WmudConfigurationPrivate; + +G_DEFINE_TYPE_WITH_PRIVATE(WmudConfiguration, + wmud_configuration, + G_TYPE_KEY_FILE); + +static void +wmud_configuration_finalize(GObject *gobject) +{ + g_signal_handlers_destroy(gobject); + G_OBJECT_CLASS(wmud_configuration_parent_class)->finalize(gobject); +} + +static void +wmud_configuration_class_init(WmudConfigurationClass *klass) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS(klass); + + gobject_class->finalize = wmud_configuration_finalize; +} + +static void +wmud_configuration_init(WmudConfiguration *configuration) +{ +} + +WmudConfiguration * +wmud_configuration_new(gchar *filename) +{} diff --git a/wmud/wmud-configuration.h b/wmud/wmud-configuration.h new file mode 100644 index 0000000..9e9bd33 --- /dev/null +++ b/wmud/wmud-configuration.h @@ -0,0 +1,33 @@ +#ifndef __WMUD_CONFIGURATION_H__ +#define __WMUD_CONFIGURATION_H__ + +#include + +G_BEGIN_DECLS + +#define WMUD_TYPE_CONFIGURATION (wmud_configuration_get_type()) +#define WMUD_CONFIGURATION(o) (G_TYPE_CHECK_INSTANCE_CAST((o), WMUD_TYPE_CONFIGURATION, WmudConfiguration)) +#define WMUD_CONFIGURATION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), WMUD_TYPE_CONFIGURATION, WmudConfigurationClass)) +#define WMUD_IS_CONFIGURATION(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), WMUD_TYPE_CONFIGURATION)) +#define WMUD_IS_CONFIGURATION_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), WMUD_TYPE_CONFIGURATION)) +#define WMUD_CONFIGURATION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), WMUD_TYPE_CONFIGURATION, WmudConfigurationClass)) + +typedef struct _WmudConfiguration WmudConfiguration; +typedef struct _WmudConfigurationClass WmudConfigurationClass; + +struct _WmudConfiguration { + /* Parent instance structure */ + GKeyFile parent_instance; + + /* Instance members */ +}; + +struct _WmudConfigurationClass { + GKeyFileClass parent_class; +}; + +GType wmud_configuration_get_type(void) G_GNUC_CONST; + +G_END_DECLS + +#endif /* __WMUD_CONFIGURATION_H__ */