Functions to create new backend and usage of it in existing backends
[cascardo/atompub.git] / backend / gio / gio.c
index 1157753..9a7244a 100644 (file)
@@ -21,7 +21,8 @@
 #include <gio/gio.h>
 #include <atompub/atom.h>
 
-GFile *gio_iri_to_file (AtomCtx *ctx, IRI *iri)
+static GFile *
+gio_iri_to_file (AtomCtx *ctx, IRI *iri)
 {
   gchar *root = atom_config_get_str (ctx, "gio", "root");
   gchar *path = iri_get_path (iri);
@@ -32,7 +33,8 @@ GFile *gio_iri_to_file (AtomCtx *ctx, IRI *iri)
   return file;
 }
 
-Atom * gio_atom_retrieve_resource (AtomCtx *ctx, IRI *iri)
+static Atom *
+gio_atom_retrieve_resource (AtomCtx *ctx, IRI *iri)
 {
   GFile *file;
   GError *error = NULL;
@@ -52,3 +54,12 @@ Atom * gio_atom_retrieve_resource (AtomCtx *ctx, IRI *iri)
   g_free (data);
   return atom;
 }
+
+AtomBackend *
+gio_backend (void)
+{
+  AtomBackend *backend;
+  backend = atom_backend_new ();
+  atom_backend_retrieve_resource_set (backend, gio_atom_retrieve_resource);
+  return backend;
+}