Created getReamoteData-function.
[irreco.git] / irreco / src / webdb / irreco_webdb_cache.h
blobfff030e76e6f92d5c23fcbbeccf40953f26d7eaf
1 /*
2 * irreco - Ir Remote Control
3 * Copyright (C) 2007,2008 Arto Karppinen (arto.karppinen@iki.fi)
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 /**
21 * @addtogroup IrrecoWebdbCache
22 * @{
25 /**
26 * @file
27 * Header file of @ref IrrecoWebdbCache.
31 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
32 /* Typedef */
33 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
35 * Make sure that typedefs are available before we include anything elese.
37 * This makes sure that whatever other structures that depend on structures
38 * defined in this file will compile OK recardles of header inclusion order.
40 #ifndef __IRRECO_WEBDB_CACHE_H_TYPEDEF__
41 #define __IRRECO_WEBDB_CACHE_H_TYPEDEF__
42 typedef struct _IrrecoWebdbCache IrrecoWebdbCache;
43 #endif /* __IRRECO_WEBDB_CACHE_H_TYPEDEF__ */
48 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
49 /* Include */
50 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
51 #ifndef __IRRECO_WEBDB_CACHE_H__
52 #define __IRRECO_WEBDB_CACHE_H__
53 #include "irreco_webdb.h"
54 #include <irreco_retry_loop.h>
55 #include "irreco_webdb_conf.h"
56 #include "irreco_webdb_theme.h"
57 #include "irreco_webdb_remote.h"
59 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
60 /* Datatypes */
61 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
63 struct _IrrecoWebdbCache
65 gpointer private;
66 gboolean test_ok;
67 IrrecoRetryLoop *loop;
68 IrrecoStringTable *categories;
69 IrrecoStringTable *remote_categories;
70 GString *error_msg;
71 GHashTable *conf_hash;
72 GHashTable *theme_id_hash;
73 GHashTable *remote_id_hash;
77 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
78 /* Macro */
79 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
83 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
84 /* Prototypes */
85 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
86 IrrecoWebdbCache *irreco_webdb_cache_new();
87 void irreco_webdb_cache_free(IrrecoWebdbCache *self);
88 const gchar *irreco_webdb_cache_get_error(IrrecoWebdbCache *self);
89 gboolean irreco_webdb_cache_add_user(IrrecoWebdbCache *self,
90 const gchar *name,
91 const gchar *email,
92 const gchar *passwd);
94 gboolean irreco_webdb_cache_upload_configuration(IrrecoWebdbCache *self,
95 const gchar *backend,
96 const gchar *category,
97 const gchar *file_hash,
98 const gchar *file_name,
99 const gchar *manufacturer,
100 const gchar *model,
101 const gchar *password,
102 const gchar *user,
103 const gchar *data);
105 gboolean irreco_webdb_cache_get_categories(IrrecoWebdbCache *self,
106 IrrecoStringTable **categories);
108 gboolean irreco_webdb_cache_get_all_categories(IrrecoWebdbCache *self,
109 IrrecoStringTable **categories);
111 gboolean irreco_webdb_cache_get_manufacturers(IrrecoWebdbCache *self,
112 const gchar *category,
113 IrrecoStringTable **manufacturers);
115 gboolean irreco_webdb_cache_get_all_manufacturers(IrrecoWebdbCache *self,
116 IrrecoStringTable **manufacturers);
118 gboolean irreco_webdb_cache_get_models(IrrecoWebdbCache *self,
119 const gchar *category,
120 const gchar *manufacturer,
121 IrrecoStringTable **models);
123 gboolean irreco_webdb_cache_get_configs(IrrecoWebdbCache *self,
124 const gchar *category,
125 const gchar *manufacturer,
126 const gchar *model,
127 IrrecoStringTable **configs);
129 gboolean irreco_webdb_cache_get_configuration(IrrecoWebdbCache *self,
130 gint id,
131 IrrecoWebdbConf **config);
133 gint irreco_webdb_cache_get_config_id(IrrecoWebdbCache *self,
134 const gchar *file_hash,
135 const gchar *file_name);
137 gboolean irreco_webdb_cache_get_file(IrrecoWebdbCache *self,
138 const gchar *file_hash,
139 const gchar *file_name,
140 GString **file_data);
142 gboolean irreco_webdb_cache_get_user_exists(IrrecoWebdbCache *self,
143 const gchar *name,
144 gboolean *user_exists);
146 gint irreco_webdb_cache_get_max_image_size(IrrecoWebdbCache *self);
147 gint irreco_webdb_cache_create_theme(IrrecoWebdbCache *self,
148 const gchar *name,
149 const gchar *comment,
150 const gchar *preview_button,
151 const gchar *folder,
152 const gchar *user,
153 const gchar *password);
154 gboolean irreco_webdb_cache_set_theme_downloadable(IrrecoWebdbCache *self,
155 gint id,
156 gboolean downloadable,
157 const gchar *user,
158 const gchar *password);
159 gboolean irreco_webdb_cache_login(IrrecoWebdbCache *self,
160 const gchar *user,
161 const gchar *password);
162 gboolean irreco_webdb_cache_get_themes(IrrecoWebdbCache *self,
163 IrrecoStringTable **theme);
164 gboolean irreco_webdb_cache_get_theme_by_id(IrrecoWebdbCache *self,
165 gint theme_id,
166 IrrecoWebdbTheme **theme);
167 gint irreco_webdb_cache_get_theme_id_by_name_and_date(IrrecoWebdbCache *self,
168 const gchar *name,
169 const gchar *date);
170 gboolean irreco_webdb_cache_get_preview_button(IrrecoWebdbCache *self,
171 gint theme_id,
172 IrrecoWebdbTheme **theme);
173 gint irreco_webdb_cache_add_bg_to_theme(IrrecoWebdbCache *self,
174 const gchar *name,
175 const gchar *image_hash,
176 const gchar *image_name,
177 const guchar *image,
178 gint image_len,
179 const gchar *folder,
180 gint theme_id,
181 const gchar *user,
182 const gchar *password);
183 gboolean irreco_webdb_cache_get_backgrounds(IrrecoWebdbCache *self,
184 gint theme_id,
185 IrrecoStringTable **bg_list);
186 gboolean irreco_webdb_cache_get_bg_by_id(IrrecoWebdbCache *self,
187 gint bg_id,
188 const char *theme_bg_dir);
189 gint irreco_webdb_cache_add_button_to_theme(IrrecoWebdbCache *self,
190 const gchar *name,
191 gboolean allow_text,
192 const gchar *text_format_up,
193 const gchar *text_format_down,
194 gint text_padding,
195 gfloat text_h_align,
196 gfloat text_v_align,
197 const gchar *image_up_hash,
198 const gchar *image_up_name,
199 const guchar *image_up,
200 gint image_up_len,
201 const gchar *image_down_hash,
202 const gchar *image_down_name,
203 const guchar *image_down,
204 gint image_down_len,
205 const gchar *folder,
206 gint theme_id,
207 const gchar *user,
208 const gchar *password);
209 gboolean irreco_webdb_cache_get_buttons(IrrecoWebdbCache *self,
210 gint theme_id,
211 IrrecoStringTable **button_list);
212 gboolean irreco_webdb_cache_get_button_by_id(IrrecoWebdbCache *self,
213 gint button_id,
214 const char *theme_button_dir);
215 gint irreco_webdb_cache_create_new_remote(IrrecoWebdbCache *self,
216 const gchar *comment,
217 const gchar *category,
218 const gchar *manufacturer,
219 const gchar *model,
220 const gchar *file_name,
221 const gchar *file_data,
222 const gchar *user,
223 const gchar *password);
224 gboolean irreco_webdb_cache_set_remote_downloadable(IrrecoWebdbCache *self,
225 gint id,
226 gboolean downloadable,
227 const gchar *user,
228 const gchar *password);
229 gboolean irreco_webdb_cache_add_configuration_to_remote(IrrecoWebdbCache *self,
230 gint remote_id,
231 gint configuration_id,
232 const gchar *user,
233 const gchar *password);
234 gboolean irreco_webdb_cache_add_theme_to_remote(IrrecoWebdbCache *self,
235 gint remote_id,
236 gint theme_id,
237 const gchar *user,
238 const gchar *password);
239 gboolean irreco_webdb_cache_get_remote_categories(IrrecoWebdbCache *self,
240 IrrecoStringTable **categories);
241 gboolean irreco_webdb_cache_get_remote_manufacturers(IrrecoWebdbCache *self,
242 const gchar *category,
243 IrrecoStringTable **manufacturers);
244 gboolean irreco_webdb_cache_get_remote_models(IrrecoWebdbCache *self,
245 const gchar *category,
246 const gchar *manufacturer,
247 IrrecoStringTable **models);
248 gboolean irreco_webdb_cache_get_remote_creators(IrrecoWebdbCache *self,
249 const gchar *category,
250 const gchar *manufacturer,
251 const gchar *model,
252 IrrecoStringTable **creators);
253 gboolean irreco_webdb_cache_get_remotes(IrrecoWebdbCache *self,
254 const gchar *category,
255 const gchar *manufacturer,
256 const gchar *model,
257 const gchar *creator,
258 GList **remote_list);
259 gboolean irreco_webdb_cache_get_remote_by_id(IrrecoWebdbCache *self,
260 gint id,
261 IrrecoWebdbRemote **remote);
262 gboolean irreco_webdb_cache_get_configurations_of_remote(IrrecoWebdbCache *self,
263 gint remote_id,
264 GList **configs);
265 gboolean irreco_webdb_cache_get_themes_of_remote(IrrecoWebdbCache *self,
266 gint remote_id,
267 GList **themes);
268 gboolean irreco_webdb_cache_get_remote_data(IrrecoWebdbCache *self,
269 gint remote_id,
270 gchar **file_data);
272 #endif /* __IRRECO_WEBDB_CACHE_H__ */
274 /** @} */