projects
/
cascardo
/
atompub.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Let configuration mechanism be extensible
[cascardo/atompub.git]
/
config
/
gkeyfile.c
diff --git
a/config/gkeyfile.c
b/config/gkeyfile.c
index
891f4b5
..
358354d
100644
(file)
--- a/
config/gkeyfile.c
+++ b/
config/gkeyfile.c
@@
-1,5
+1,6
@@
/*
/*
- * Copyright (C) 2007 Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
+ * Copyright (C) 2007-2008 Thadeu Lima de Souza Cascardo
+ * <cascardo@holoscopio.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@
-20,13
+21,13
@@
#include <atompub/atom.h>
#include <glib.h>
#include <atompub/atom.h>
#include <glib.h>
-gchar *
+
static
gchar *
gkeyfile_atom_config_get_str (AtomCtx *ctx, gchar *group, gchar * key)
{
GKeyFile *keyfile;
gchar *value;
GError *error = NULL;
gkeyfile_atom_config_get_str (AtomCtx *ctx, gchar *group, gchar * key)
{
GKeyFile *keyfile;
gchar *value;
GError *error = NULL;
- keyfile = atom_config_data (
ctx
);
+ keyfile = atom_config_data (
atom_config (ctx)
);
value = g_key_file_get_string (keyfile, group, key, &error);
if (value == NULL)
{
value = g_key_file_get_string (keyfile, group, key, &error);
if (value == NULL)
{
@@
-39,13
+40,14
@@
gkeyfile_atom_config_get_str (AtomCtx *ctx, gchar *group, gchar * key)
return value;
}
return value;
}
-void
-gkeyfile_atom_config_init (AtomCtx *ctx)
+AtomConfig *
+gkeyfile_atom_config_init (AtomCtx *ctx
, char *name
)
{
{
+ AtomConfig *config;
GKeyFile *keyfile;
GError *error = NULL;
keyfile = g_key_file_new ();
GKeyFile *keyfile;
GError *error = NULL;
keyfile = g_key_file_new ();
- if (!g_key_file_load_from_file (keyfile,
"atompub.conf"
,
+ if (!g_key_file_load_from_file (keyfile,
name
,
G_KEY_FILE_NONE, &error))
{
AtomError *aerr = atom_error_new ();
G_KEY_FILE_NONE, &error))
{
AtomError *aerr = atom_error_new ();
@@
-55,5
+57,7
@@
gkeyfile_atom_config_init (AtomCtx *ctx)
g_error_free (error);
return;
}
g_error_free (error);
return;
}
- atom_config_data_set (ctx, keyfile);
+ config = atom_config_new ();
+ atom_config_get_str_set (config, gkeyfile_atom_config_get_str);
+ atom_config_data_set (config, keyfile);
}
}