Functions to create new backend and usage of it in existing backends
[cascardo/atompub.git] / backend / files / giochannel.c
index f4e876a..e8a4bb7 100644 (file)
@@ -20,7 +20,8 @@
 #include <glib.h>
 #include <atompub/atom.h>
 
-gchar *giochannel_iri_to_filename (AtomCtx *ctx, IRI *iri)
+static gchar *
+giochannel_iri_to_filename (AtomCtx *ctx, IRI *iri)
 {
   gchar *root = atom_config_get_str (ctx, "giochannel", "root");
   gchar *path = iri_get_path (iri);
@@ -29,7 +30,8 @@ gchar *giochannel_iri_to_filename (AtomCtx *ctx, IRI *iri)
   return filename;
 }
 
-Atom * giochannel_atom_retrieve_resource (AtomCtx *ctx, IRI *iri)
+static Atom *
+giochannel_atom_retrieve_resource (AtomCtx *ctx, IRI *iri)
 {
   gchar *filename;
   GIOChannel *channel;
@@ -58,3 +60,13 @@ Atom * giochannel_atom_retrieve_resource (AtomCtx *ctx, IRI *iri)
   g_free (data);
   return atom;
 }
+
+AtomBackend *
+giochannel_backend (void)
+{
+  AtomBackend *backend;
+  backend = atom_backend_new ();
+  atom_backend_retrieve_resource_set (backend,
+                                     giochannel_atom_retrieve_resource);
+  return backend;
+}