From: Thadeu Lima de Souza Cascardo Date: Sat, 26 Jan 2008 23:32:45 +0000 (-0200) Subject: Added support for initialization of configuration, opening GKeyFile. X-Git-Url: http://git.cascardo.eti.br/?p=cascardo%2Fatompub.git;a=commitdiff_plain;h=5461412f181fc6c13631db6da6bc2dbdbeadfa68 Added support for initialization of configuration, opening GKeyFile. --- diff --git a/config/gkeyfile.c b/config/gkeyfile.c index 34c6c58..9023d83 100644 --- a/config/gkeyfile.c +++ b/config/gkeyfile.c @@ -34,3 +34,18 @@ gkeyfile_atom_config_get_str (AtomCtx *ctx, gchar * key) } return value; } + +void +gkeyfile_atom_config_init (AtomCtx *ctx) +{ + GKeyFile *keyfile; + GError *error = NULL; + keyfile = g_key_file_new (); + if (!g_key_file_load_from_file (keyfile, "atompub.conf", + G_KEY_FILE_NONE, &error)) + { + atom_error_set (ctx, error); + return; + } + atom_config_data_set (ctx, keyfile); +} diff --git a/include/atompub/ctx.h b/include/atompub/ctx.h index 21758ff..338110e 100644 --- a/include/atompub/ctx.h +++ b/include/atompub/ctx.h @@ -23,5 +23,6 @@ typedef struct _atom_ctx AtomCtx; void * atom_config_data (AtomCtx *); +void atom_config_data_set (AtomCtx *, void *); #endif diff --git a/src/ctx.c b/src/ctx.c index e8e5868..8d219f3 100644 --- a/src/ctx.c +++ b/src/ctx.c @@ -38,3 +38,9 @@ atom_config_data (AtomCtx *ctx) { return ctx->config_data; } + +void +atom_config_data_set (AtomCtx *ctx, void *data) +{ + ctx->config_data = data; +}