Create new configuration object

This commit is contained in:
Gergely Polonkai 2016-06-22 18:12:29 +02:00
parent 73b7c3db39
commit bdf518f37f
2 changed files with 74 additions and 0 deletions

41
wmud/wmud-configuration.c Normal file
View File

@ -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)
{}

33
wmud/wmud-configuration.h Normal file
View File

@ -0,0 +1,33 @@
#ifndef __WMUD_CONFIGURATION_H__
#define __WMUD_CONFIGURATION_H__
#include <glib-object.h>
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__ */