2 * Copyright (C) 2007 Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #include <atompub/atom.h>
29 AtomFrontend *frontend;
37 ctx = g_slice_new (AtomCtx);
39 ctx->config_data = NULL;
42 ctx->bemap = g_hash_table_new_full (g_str_hash, g_str_equal,
48 atom_ctx_delete (AtomCtx *ctx)
51 atom_error_delete (ctx->error);
53 atom_backend_delete (ctx->backend);
55 atom_frontend_delete (ctx->frontend);
57 g_hash_table_destroy (ctx->bemap);
58 g_slice_free (AtomCtx, ctx);
62 atom_error_set (AtomCtx *ctx, AtomError *error)
65 atom_error_delete (ctx->error);
70 atom_error_get (AtomCtx *ctx)
76 atom_config_data (AtomCtx *ctx)
78 return ctx->config_data;
82 atom_config_data_set (AtomCtx *ctx, void *data)
84 ctx->config_data = data;
88 atom_backend (AtomCtx *ctx)
94 atom_backend_set (AtomCtx *ctx, AtomBackend *backend)
96 ctx->backend = backend;
100 atom_frontend (AtomCtx *ctx)
102 return ctx->frontend;
106 atom_frontend_set (AtomCtx *ctx, AtomFrontend *frontend)
108 ctx->frontend = frontend;
112 atom_map_backend_requests (AtomCtx *ctx, char **reqs,
113 AtomEntry **entries, size_t len)
116 for (i = 0; i < len; i++)
118 char *key = g_strdup (atom_entry_id (entries[i]));
119 char *val = g_strdup (reqs[i]);
120 g_hash_table_replace (ctx->bemap, key, val);