added irreco_webdb_cache_get_themes function
[irreco.git] / irreco / trunk / src / webdb / irreco_webdb_cache.h
blob4ec9606ac2df87da3debead997330c9a85fa119c
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.
21 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
22 /* Typedef */
23 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
25 * Make sure that typedefs are available before we include anything elese.
27 * This makes sure that whatever other structures that depend on structures
28 * defined in this file will compile OK recardles of header inclusion order.
30 #ifndef __IRRECO_WEBDB_CACHE_H_TYPEDEF__
31 #define __IRRECO_WEBDB_CACHE_H_TYPEDEF__
32 typedef struct _IrrecoWebdbCache IrrecoWebdbCache;
33 #endif /* __IRRECO_WEBDB_CACHE_H_TYPEDEF__ */
38 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
39 /* Include */
40 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
41 #ifndef __IRRECO_WEBDB_CACHE_H__
42 #define __IRRECO_WEBDB_CACHE_H__
43 #include "irreco_webdb.h"
44 #include <irreco_retry_loop.h>
45 #include "irreco_webdb_conf.h"
46 #include "irreco_webdb_theme.h"
48 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
49 /* Datatypes */
50 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
52 struct _IrrecoWebdbCache
54 gpointer private;
55 gboolean test_ok;
56 IrrecoRetryLoop *loop;
57 IrrecoStringTable *categories;
58 IrrecoStringTable *manufacturers;
59 GString *error_msg;
60 GHashTable *conf_hash;
61 IrrecoStringTable *themes;
65 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
66 /* Macro */
67 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
71 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
72 /* Prototypes */
73 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
74 IrrecoWebdbCache *irreco_webdb_cache_new();
75 void irreco_webdb_cache_free(IrrecoWebdbCache *self);
76 const gchar *irreco_webdb_cache_get_error(IrrecoWebdbCache *self);
77 gboolean irreco_webdb_cache_add_user(IrrecoWebdbCache *self,
78 const gchar *name,
79 const gchar *email,
80 const gchar *passwd);
82 gboolean irreco_webdb_cache_upload_configuration(IrrecoWebdbCache *self,
83 const gchar *backend,
84 const gchar *category,
85 const gchar *file_hash,
86 const gchar *file_name,
87 const gchar *manufacturer,
88 const gchar *model,
89 const gchar *password,
90 const gchar *user,
91 const gchar *data);
93 gboolean irreco_webdb_cache_get_categories(IrrecoWebdbCache *self,
94 IrrecoStringTable **categories);
96 gboolean irreco_webdb_cache_get_all_categories(IrrecoWebdbCache *self,
97 IrrecoStringTable **categories);
99 gboolean irreco_webdb_cache_get_manufacturers(IrrecoWebdbCache *self,
100 const gchar *category,
101 IrrecoStringTable **manufacturers);
103 gboolean irreco_webdb_cache_get_all_manufacturers(IrrecoWebdbCache *self,
104 IrrecoStringTable **manufacturers);
106 gboolean irreco_webdb_cache_get_models(IrrecoWebdbCache *self,
107 const gchar *category,
108 const gchar *manufacturer,
109 IrrecoStringTable **models);
111 gboolean irreco_webdb_cache_get_configs(IrrecoWebdbCache *self,
112 const gchar *category,
113 const gchar *manufacturer,
114 const gchar *model,
115 IrrecoStringTable **configs);
117 gboolean irreco_webdb_cache_get_configuration(IrrecoWebdbCache *self,
118 gint id,
119 IrrecoWebdbConf **config);
121 gboolean irreco_webdb_cache_get_file(IrrecoWebdbCache *self,
122 const gchar *file_hash,
123 const gchar *file_name,
124 GString **file_data);
126 gboolean irreco_webdb_cache_get_user_exists(IrrecoWebdbCache *self,
127 const gchar *name,
128 gboolean *user_exists);
130 gboolean irreco_webdb_cache_login(IrrecoWebdbCache *self,
131 const gchar *user,
132 const gchar *password);
133 gboolean irreco_webdb_cache_get_themes(IrrecoWebdbCache *self,
134 IrrecoStringTable **theme);
135 gboolean irreco_webdb_cache_get_theme_by_id(IrrecoWebdbCache *self,
136 gint theme_id,
137 IrrecoWebdbTheme **theme);
139 #endif /* __IRRECO_WEBDB_CACHE_H__ */