return atom;
}
+static void
+gio_atom_to_file (AtomCtx *ctx, AtomEntry *entry, GFile *file)
+{
+ GError *error = NULL;
+ gchar *data = NULL;
+ gsize len = 0;
+ atom_entry_string (entry, &data, &len);
+ if (!g_file_replace_contents (file, data, len, NULL, FALSE, 0, NULL,
+ NULL, &error))
+ {
+ AtomError *aerr = atom_error_new_from_gerror (error);
+ atom_error_set (ctx, aerr);
+ g_error_free (error);
+ return NULL;
+ }
+ g_free (data);
+}
+
static AtomEntry *
gio_atom_retrieve_entry (AtomCtx *ctx, char *req)
{
return atom;
}
+static void
+gio_atom_publish_entry (AtomCtx *ctx, char *req, AtomEntry *entry)
+{
+ GFile *file;
+ /* TODO: Create a function to map from an Entry ID to a new filename */
+ if (req == NULL)
+ req = atom_entry_id (entry);
+ file = gio_req_to_file (ctx, req);
+ gio_atom_to_file (ctx, entry, file);
+ g_object_unref (file);
+}
+
static void
gio_enumerate_entries (AtomCtx *ctx, char ***reqs, AtomEntry ***entries,
size_t *len)
backend = atom_backend_new ();
atom_backend_retrieve_entry_set (backend, gio_atom_retrieve_entry);
atom_backend_enumerate_entries_set (backend, gio_enumerate_entries);
+ atom_backend_publish_entry_set (backend, gio_atom_publish_entry);
return backend;
}