Merge branch 'master' into dev
[irreco.git] / irreco / src / webdb / irreco_webdb_cache.h
blob2f3bfd0deee4e98c20cdf641b983783e3a4973ee
1 /*
2 * irreco - Ir Remote Control
3 * Copyright (C) 2007,2008 Arto Karppinen (arto.karppinen@iki.fi)
4 *
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.
9 *
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"
58 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
59 /* Datatypes */
60 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
62 struct _IrrecoWebdbCache
64 gpointer private;
65 gboolean test_ok;
66 IrrecoRetryLoop *loop;
67 IrrecoStringTable *categories;
68 IrrecoStringTable *manufacturers;
69 GString *error_msg;
70 GHashTable *conf_hash;
71 GHashTable *theme_id_hash;
75 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
76 /* Macro */
77 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
81 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
82 /* Prototypes */
83 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
84 IrrecoWebdbCache *irreco_webdb_cache_new();
85 void irreco_webdb_cache_free(IrrecoWebdbCache *self);
86 const gchar *irreco_webdb_cache_get_error(IrrecoWebdbCache *self);
87 gboolean irreco_webdb_cache_add_user(IrrecoWebdbCache *self,
88 const gchar *name,
89 const gchar *email,
90 const gchar *passwd);
92 gboolean irreco_webdb_cache_upload_configuration(IrrecoWebdbCache *self,
93 const gchar *backend,
94 const gchar *category,
95 const gchar *file_hash,
96 const gchar *file_name,
97 const gchar *manufacturer,
98 const gchar *model,
99 const gchar *password,
100 const gchar *user,
101 const gchar *data);
103 gboolean irreco_webdb_cache_get_categories(IrrecoWebdbCache *self,
104 IrrecoStringTable **categories);
106 gboolean irreco_webdb_cache_get_all_categories(IrrecoWebdbCache *self,
107 IrrecoStringTable **categories);
109 gboolean irreco_webdb_cache_get_manufacturers(IrrecoWebdbCache *self,
110 const gchar *category,
111 IrrecoStringTable **manufacturers);
113 gboolean irreco_webdb_cache_get_all_manufacturers(IrrecoWebdbCache *self,
114 IrrecoStringTable **manufacturers);
116 gboolean irreco_webdb_cache_get_models(IrrecoWebdbCache *self,
117 const gchar *category,
118 const gchar *manufacturer,
119 IrrecoStringTable **models);
121 gboolean irreco_webdb_cache_get_configs(IrrecoWebdbCache *self,
122 const gchar *category,
123 const gchar *manufacturer,
124 const gchar *model,
125 IrrecoStringTable **configs);
127 gboolean irreco_webdb_cache_get_configuration(IrrecoWebdbCache *self,
128 gint id,
129 IrrecoWebdbConf **config);
131 gboolean irreco_webdb_cache_get_file(IrrecoWebdbCache *self,
132 const gchar *file_hash,
133 const gchar *file_name,
134 GString **file_data);
136 gboolean irreco_webdb_cache_get_user_exists(IrrecoWebdbCache *self,
137 const gchar *name,
138 gboolean *user_exists);
140 gboolean irreco_webdb_cache_login(IrrecoWebdbCache *self,
141 const gchar *user,
142 const gchar *password);
143 gboolean irreco_webdb_cache_get_themes(IrrecoWebdbCache *self,
144 IrrecoStringTable **theme);
145 gboolean irreco_webdb_cache_get_theme_by_id(IrrecoWebdbCache *self,
146 gint theme_id,
147 IrrecoWebdbTheme **theme);
148 gboolean irreco_webdb_cache_get_preview_button(IrrecoWebdbCache *self,
149 gint theme_id,
150 IrrecoWebdbTheme **theme);
151 gboolean irreco_webdb_cache_get_backgrounds(IrrecoWebdbCache *self,
152 gint theme_id,
153 IrrecoStringTable **bg_list);
154 gboolean irreco_webdb_cache_get_bg_by_id(IrrecoWebdbCache *self,
155 gint bg_id,
156 const char *theme_bg_dir);
157 gboolean irreco_webdb_cache_get_buttons(IrrecoWebdbCache *self,
158 gint theme_id,
159 IrrecoStringTable **button_list);
160 gboolean irreco_webdb_cache_get_button_by_id(IrrecoWebdbCache *self,
161 gint button_id,
162 const char *theme_button_dir);
164 #endif /* __IRRECO_WEBDB_CACHE_H__ */
166 /** @} */