Mostly minor fixes up until version 0.8.10.
[irreco.git] / irreco / src / webdb / irreco_webdb_cache.h
blob95590b6c15159f65b143c151f9b3028800fb3594
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"
58 #include "irreco_webdb_client.h"
60 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
61 /* Datatypes */
62 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
64 struct _IrrecoWebdbCache
66 gpointer private;
67 gboolean test_ok;
68 IrrecoRetryLoop *loop;
69 IrrecoStringTable *categories;
70 IrrecoStringTable *remote_categories;
71 GString *error_msg;
72 GHashTable *conf_hash;
73 GHashTable *theme_id_hash;
74 GHashTable *remote_id_hash;
78 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
79 /* Macro */
80 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
84 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
85 /* Prototypes */
86 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
87 IrrecoWebdbCache *irreco_webdb_cache_new();
88 void irreco_webdb_cache_free(IrrecoWebdbCache *self);
89 const gchar *irreco_webdb_cache_get_error(IrrecoWebdbCache *self);
90 gboolean irreco_webdb_cache_add_user(IrrecoWebdbCache *self,
91 const gchar *name,
92 const gchar *email,
93 const gchar *passwd);
95 gboolean irreco_webdb_cache_upload_configuration(IrrecoWebdbCache *self,
96 const gchar *backend,
97 const gchar *category,
98 const gchar *file_hash,
99 const gchar *file_name,
100 const gchar *manufacturer,
101 const gchar *model,
102 const gchar *password,
103 const gchar *user,
104 const gchar *data);
106 gboolean irreco_webdb_cache_get_categories(IrrecoWebdbCache *self,
107 IrrecoStringTable **categories);
109 gboolean irreco_webdb_cache_get_all_categories(IrrecoWebdbCache *self,
110 IrrecoStringTable **categories);
112 gboolean irreco_webdb_cache_get_manufacturers(IrrecoWebdbCache *self,
113 const gchar *category,
114 IrrecoStringTable **manufacturers);
116 gboolean irreco_webdb_cache_get_all_manufacturers(IrrecoWebdbCache *self,
117 IrrecoStringTable **manufacturers);
119 gboolean irreco_webdb_cache_get_models(IrrecoWebdbCache *self,
120 const gchar *category,
121 const gchar *manufacturer,
122 IrrecoStringTable **models);
124 gboolean irreco_webdb_cache_get_configs(IrrecoWebdbCache *self,
125 const gchar *category,
126 const gchar *manufacturer,
127 const gchar *model,
128 IrrecoStringTable **configs);
130 gboolean irreco_webdb_cache_get_configuration(IrrecoWebdbCache *self,
131 gint id,
132 IrrecoWebdbConf **config);
134 gint irreco_webdb_cache_get_config_id(IrrecoWebdbCache *self,
135 const gchar *file_hash,
136 const gchar *file_name);
138 gboolean irreco_webdb_cache_get_file(IrrecoWebdbCache *self,
139 const gchar *file_hash,
140 const gchar *file_name,
141 GString **file_data);
143 gboolean irreco_webdb_cache_get_user_exists(IrrecoWebdbCache *self,
144 const gchar *name,
145 gboolean *user_exists);
147 gint irreco_webdb_cache_get_max_image_size(IrrecoWebdbCache *self);
148 gint irreco_webdb_cache_create_theme(IrrecoWebdbCache *self,
149 const gchar *name,
150 const gchar *comment,
151 const gchar *preview_button,
152 const gchar *folder,
153 const gchar *user,
154 const gchar *password);
155 gboolean irreco_webdb_cache_set_theme_downloadable(IrrecoWebdbCache *self,
156 gint id,
157 gboolean downloadable,
158 const gchar *user,
159 const gchar *password);
160 gboolean irreco_webdb_cache_login(IrrecoWebdbCache *self,
161 const gchar *user,
162 const gchar *password);
163 gboolean irreco_webdb_cache_get_themes(IrrecoWebdbCache *self,
164 IrrecoStringTable **theme);
165 gboolean irreco_webdb_cache_get_theme_by_id(IrrecoWebdbCache *self,
166 gint theme_id,
167 IrrecoWebdbTheme **theme);
168 gint irreco_webdb_cache_get_theme_id_by_name_and_date(IrrecoWebdbCache *self,
169 const gchar *name,
170 const gchar *date);
171 gboolean irreco_webdb_cache_get_preview_button(IrrecoWebdbCache *self,
172 gint theme_id,
173 IrrecoWebdbTheme **theme);
174 gint irreco_webdb_cache_add_bg_to_theme(IrrecoWebdbCache *self,
175 const gchar *name,
176 const gchar *image_hash,
177 const gchar *image_name,
178 const guchar *image,
179 gint image_len,
180 const gchar *folder,
181 gint theme_id,
182 const gchar *user,
183 const gchar *password);
184 gboolean irreco_webdb_cache_get_backgrounds(IrrecoWebdbCache *self,
185 gint theme_id,
186 IrrecoStringTable **bg_list);
187 gboolean irreco_webdb_cache_get_bg_by_id(IrrecoWebdbCache *self,
188 gint bg_id,
189 const char *theme_bg_dir);
190 gint irreco_webdb_cache_add_button_to_theme(IrrecoWebdbCache *self,
191 const gchar *name,
192 gboolean allow_text,
193 const gchar *text_format_up,
194 const gchar *text_format_down,
195 gint text_padding,
196 gfloat text_h_align,
197 gfloat text_v_align,
198 const gchar *image_up_hash,
199 const gchar *image_up_name,
200 const guchar *image_up,
201 gint image_up_len,
202 const gchar *image_down_hash,
203 const gchar *image_down_name,
204 const guchar *image_down,
205 gint image_down_len,
206 const gchar *folder,
207 gint theme_id,
208 const gchar *user,
209 const gchar *password);
210 gboolean irreco_webdb_cache_get_buttons(IrrecoWebdbCache *self,
211 gint theme_id,
212 IrrecoStringTable **button_list);
213 gboolean irreco_webdb_cache_get_button_by_id(IrrecoWebdbCache *self,
214 gint button_id,
215 const char *theme_button_dir);
216 gint irreco_webdb_cache_create_new_remote(IrrecoWebdbCache *self,
217 const gchar *comment,
218 const gchar *category,
219 const gchar *manufacturer,
220 const gchar *model,
221 const gchar *file_name,
222 const gchar *file_data,
223 const gchar *user,
224 const gchar *password);
225 gboolean irreco_webdb_cache_set_remote_downloadable(IrrecoWebdbCache *self,
226 gint id,
227 gboolean downloadable,
228 const gchar *user,
229 const gchar *password);
230 gboolean irreco_webdb_cache_add_configuration_to_remote(IrrecoWebdbCache *self,
231 gint remote_id,
232 gint configuration_id,
233 const gchar *user,
234 const gchar *password);
235 gboolean irreco_webdb_cache_add_theme_to_remote(IrrecoWebdbCache *self,
236 gint remote_id,
237 gint theme_id,
238 const gchar *user,
239 const gchar *password);
240 gboolean irreco_webdb_cache_get_remote_categories(IrrecoWebdbCache *self,
241 IrrecoStringTable **categories);
242 gboolean irreco_webdb_cache_get_remote_manufacturers(IrrecoWebdbCache *self,
243 const gchar *category,
244 IrrecoStringTable **manufacturers);
245 gboolean irreco_webdb_cache_get_remote_models(IrrecoWebdbCache *self,
246 const gchar *category,
247 const gchar *manufacturer,
248 IrrecoStringTable **models);
249 gboolean irreco_webdb_cache_get_remote_creators(IrrecoWebdbCache *self,
250 const gchar *category,
251 const gchar *manufacturer,
252 const gchar *model,
253 IrrecoStringTable **creators);
254 gboolean irreco_webdb_cache_get_remotes(IrrecoWebdbCache *self,
255 const gchar *category,
256 const gchar *manufacturer,
257 const gchar *model,
258 const gchar *creator,
259 GList **remote_list);
260 gboolean irreco_webdb_cache_get_remote_by_id(IrrecoWebdbCache *self,
261 gint id,
262 IrrecoWebdbRemote **remote);
263 gboolean irreco_webdb_cache_get_configurations_of_remote(IrrecoWebdbCache *self,
264 gint remote_id,
265 GList **configs);
266 gboolean irreco_webdb_cache_get_themes_of_remote(IrrecoWebdbCache *self,
267 gint remote_id,
268 GList **themes);
269 gboolean irreco_webdb_cache_get_remote_data(IrrecoWebdbCache *self,
270 gint remote_id,
271 gchar **file_data);
272 gboolean irreco_webdb_cache_get_lirc_dirs(IrrecoWebdbCache *self,
273 IrrecoStringTable **dir_list);
274 gboolean irreco_webdb_cache_get_lirc_manufacturers(IrrecoWebdbCache *self,
275 const gchar *range,
276 IrrecoStringTable **manufacturer_list);
277 gboolean irreco_webdb_cache_get_lirc_models(IrrecoWebdbCache *self,
278 const gchar *manufacturer,
279 IrrecoStringTable **model_list);
280 gboolean irreco_webdb_cache_get_lirc_file(IrrecoWebdbCache *self,
281 const gchar *model,
282 IrrecoStringTable **file);
284 #endif /* __IRRECO_WEBDB_CACHE_H__ */
286 /** @} */