Added support for initialization of configuration, opening GKeyFile.
authorThadeu Lima de Souza Cascardo <cascardo@minaslivre.org>
Sat, 26 Jan 2008 23:32:45 +0000 (21:32 -0200)
committerThadeu Lima de Souza Cascardo <cascardo@minaslivre.org>
Sat, 26 Jan 2008 23:32:45 +0000 (21:32 -0200)
config/gkeyfile.c
include/atompub/ctx.h
src/ctx.c

index 34c6c58..9023d83 100644 (file)
@@ -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);
+}
index 21758ff..338110e 100644 (file)
@@ -23,5 +23,6 @@
 typedef struct _atom_ctx AtomCtx;
 
 void * atom_config_data (AtomCtx *);
+void atom_config_data_set (AtomCtx *, void *);
 
 #endif
index e8e5868..8d219f3 100644 (file)
--- 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;
+}