Moved config current only implementation to subdirectory
authorThadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Tue, 6 Jan 2009 23:47:19 +0000 (21:47 -0200)
committerThadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Tue, 6 Jan 2009 23:47:19 +0000 (21:47 -0200)
To allow multiple config backend implementations, move the gkeyfile
implementation to its own subdirectory.

atom/Makefile.am
config/Makefile.am
config/gkeyfile.c [deleted file]
config/gkeyfile/Makefile.am [new file with mode: 0644]
config/gkeyfile/gkeyfile.c [new file with mode: 0644]

index 166e8fc..c929f60 100644 (file)
@@ -9,5 +9,5 @@ libatom_la_LIBADD += -L$(top_builddir)/backend/files -lgiochannel
 libatom_la_LIBADD += -L$(top_builddir)/backend/gio -lgio
 libatom_la_LIBADD += -L$(top_builddir)/backend/soup -lsoup
 libatom_la_LIBADD += -L$(top_builddir)/frontend/cgi -lcgi
-libatom_la_LIBADD += -L$(top_builddir)/config -lgkeyfile
+libatom_la_LIBADD += -L$(top_builddir)/config/gkeyfile -lgkeyfile
 libatom_la_LIBADD += -L$(top_builddir)/iri -liri
index f778d19..b92f8f5 100644 (file)
@@ -1,3 +1 @@
-noinst_LTLIBRARIES = libgkeyfile.la
-libgkeyfile_la_SOURCES = gkeyfile.c
-libgkeyfile_la_CFLAGS = -I$(top_srcdir)/include $(GLIB_CFLAGS)
+SUBDIRS = gkeyfile
diff --git a/config/gkeyfile.c b/config/gkeyfile.c
deleted file mode 100644 (file)
index 358354d..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- *  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
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License along
- *  with this program; if not, write to the Free Software Foundation, Inc.,
- *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-
-#include <atompub/atom.h>
-#include <glib.h>
-
-static gchar *
-gkeyfile_atom_config_get_str (AtomCtx *ctx, gchar *group, gchar * key)
-{
-  GKeyFile *keyfile;
-  gchar *value;
-  GError *error = NULL;
-  keyfile = atom_config_data (atom_config (ctx));
-  value = g_key_file_get_string (keyfile, group, key, &error);
-  if (value == NULL)
-    {
-      AtomError *aerr = atom_error_new ();
-      atom_error_code_set (aerr, 500);
-      atom_error_message_set (aerr, error->message);
-      atom_error_set (ctx, aerr);
-      g_error_free (error);
-    }
-  return value;
-}
-
-AtomConfig *
-gkeyfile_atom_config_init (AtomCtx *ctx, char *name)
-{
-  AtomConfig *config;
-  GKeyFile *keyfile;
-  GError *error = NULL;
-  keyfile = g_key_file_new ();
-  if (!g_key_file_load_from_file (keyfile, name,
-                                 G_KEY_FILE_NONE, &error))
-    {
-      AtomError *aerr = atom_error_new ();
-      atom_error_code_set (aerr, 500);
-      atom_error_message_set (aerr, error->message);
-      atom_error_set (ctx, aerr);
-      g_error_free (error);
-      return;
-    }
-  config = atom_config_new ();
-  atom_config_get_str_set (config, gkeyfile_atom_config_get_str);
-  atom_config_data_set (config, keyfile);
-}
diff --git a/config/gkeyfile/Makefile.am b/config/gkeyfile/Makefile.am
new file mode 100644 (file)
index 0000000..f778d19
--- /dev/null
@@ -0,0 +1,3 @@
+noinst_LTLIBRARIES = libgkeyfile.la
+libgkeyfile_la_SOURCES = gkeyfile.c
+libgkeyfile_la_CFLAGS = -I$(top_srcdir)/include $(GLIB_CFLAGS)
diff --git a/config/gkeyfile/gkeyfile.c b/config/gkeyfile/gkeyfile.c
new file mode 100644 (file)
index 0000000..358354d
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ *  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
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License along
+ *  with this program; if not, write to the Free Software Foundation, Inc.,
+ *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+
+#include <atompub/atom.h>
+#include <glib.h>
+
+static gchar *
+gkeyfile_atom_config_get_str (AtomCtx *ctx, gchar *group, gchar * key)
+{
+  GKeyFile *keyfile;
+  gchar *value;
+  GError *error = NULL;
+  keyfile = atom_config_data (atom_config (ctx));
+  value = g_key_file_get_string (keyfile, group, key, &error);
+  if (value == NULL)
+    {
+      AtomError *aerr = atom_error_new ();
+      atom_error_code_set (aerr, 500);
+      atom_error_message_set (aerr, error->message);
+      atom_error_set (ctx, aerr);
+      g_error_free (error);
+    }
+  return value;
+}
+
+AtomConfig *
+gkeyfile_atom_config_init (AtomCtx *ctx, char *name)
+{
+  AtomConfig *config;
+  GKeyFile *keyfile;
+  GError *error = NULL;
+  keyfile = g_key_file_new ();
+  if (!g_key_file_load_from_file (keyfile, name,
+                                 G_KEY_FILE_NONE, &error))
+    {
+      AtomError *aerr = atom_error_new ();
+      atom_error_code_set (aerr, 500);
+      atom_error_message_set (aerr, error->message);
+      atom_error_set (ctx, aerr);
+      g_error_free (error);
+      return;
+    }
+  config = atom_config_new ();
+  atom_config_get_str_set (config, gkeyfile_atom_config_get_str);
+  atom_config_data_set (config, keyfile);
+}