Merge branch 'master' into dev
[irreco.git] / irreco / src / webdb / irreco_webdb_client.h
blobb3839e4fd01195f233bf8d722d744ee5ddbb9028
1 /*
2 * irreco - Ir Remote Control
3 * Copyright (C) 2007 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 IrrecoWebdbClient
22 * @{
25 /**
26 * @file
27 * Header file of @ref IrrecoWebdbClient.
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_CLIENT_TYPEDEF__
41 #define __IRRECO_WEBDB_CLIENT_TYPEDEF__
42 typedef struct _IrrecoWebdbClient IrrecoWebdbClient;
43 #endif /* __IRRECO_WEBDB_CLIENT_TYPEDEF__ */
47 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
48 /* Include */
49 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
50 #ifndef __IRRECO_WEBDB_CLIENT__
51 #define __IRRECO_WEBDB_CLIENT__
52 #include "irreco_webdb.h"
54 #include <stdlib.h>
55 #include <stdio.h>
56 #include "irreco_webdb_conf.h"
57 #include "irreco_webdb_theme.h"
58 #include <libsoup/soup.h>
59 #include <libsoup/soup-xmlrpc-message.h>
60 #include "irreco_sha1.h"
62 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
63 /* Datatypes */
64 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
66 struct _IrrecoWebdbClient
68 GString *error_msg;
73 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
74 /* Macro */
75 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
79 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
80 /* Prototypes */
81 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
82 IrrecoWebdbClient *irreco_webdb_client_new();
83 void irreco_webdb_client_free(IrrecoWebdbClient *self);
84 void irreco_webdb_client_get_error_msg(IrrecoWebdbClient *self, GString *msg);
85 gboolean irreco_webdb_client_add_user(IrrecoWebdbClient *self,
86 const gchar *name,
87 const gchar *email,
88 const gchar *passwd);
89 gboolean irreco_webdb_client_add_uber(IrrecoWebdbClient *self,
90 const gchar *name,
91 const gchar *email,
92 const gchar *passwd);
93 gboolean irreco_webdb_client_upload_configuration(IrrecoWebdbClient *self,
94 const gchar *backend,
95 const gchar *category,
96 const gchar *file_hash,
97 const gchar *file_name,
98 const gchar *manufacturer,
99 const gchar *model,
100 const gchar *password,
101 const gchar *user,
102 const gchar *data);
104 gboolean irreco_webdb_client_sum(IrrecoWebdbClient *self,
105 gint num_a,
106 gint num_b,
107 gint *sum);
108 gboolean irreco_webdb_client_get_categories(IrrecoWebdbClient *self,
109 IrrecoStringTable **category_list);
111 gboolean irreco_webdb_client_get_all_categories(IrrecoWebdbClient *self,
112 IrrecoStringTable **category_list);
114 gboolean irreco_webdb_client_get_manufacturers(IrrecoWebdbClient *self,
115 const gchar *category,
116 IrrecoStringTable **manufacturer_list);
118 gboolean irreco_webdb_client_get_all_manufacturers(IrrecoWebdbClient *self,
119 IrrecoStringTable **manufacturer_list);
121 gboolean irreco_webdb_client_get_models(IrrecoWebdbClient *self,
122 const gchar *category,
123 const gchar *manufacturer,
124 IrrecoStringTable **model_list);
126 gboolean irreco_webdb_client_get_configs(IrrecoWebdbClient *self,
127 const gchar *category,
128 const gchar *manufacturer,
129 const gchar *model,
130 IrrecoStringTable **config_list);
132 gboolean irreco_webdb_client_get_configuration(IrrecoWebdbClient *self,
133 gint id,
134 IrrecoWebdbConf **configuration);
136 gboolean irreco_webdb_client_get_file(IrrecoWebdbClient *self,
137 const gchar *file_hash,
138 const gchar *file_name,
139 GString **file_data);
141 gboolean irreco_webdb_client_get_user_exists(IrrecoWebdbClient *self,
142 const gchar *name, gboolean *user_exists);
144 gint irreco_webdb_client_get_max_image_size(IrrecoWebdbClient *self);
146 gint irreco_webdb_client_create_theme(IrrecoWebdbClient *self,
147 const gchar *name,
148 const gchar *comment,
149 const gchar *preview_button,
150 const gchar *folder,
151 const gchar *user,
152 const gchar *password);
154 gboolean irreco_webdb_client_set_theme_downloadable(IrrecoWebdbClient *self,
155 gint id,
156 gboolean downloadable,
157 const gchar *user,
158 const gchar *password);
160 gboolean irreco_webdb_client_get_themes(IrrecoWebdbClient *self,
161 IrrecoStringTable **theme_list);
163 gboolean irreco_webdb_client_get_theme_by_id(IrrecoWebdbClient *self,
164 gint theme_id,
165 IrrecoWebdbTheme **theme);
167 gboolean irreco_webdb_client_get_theme_versions_by_name(IrrecoWebdbClient *self,
168 const char *name,
169 IrrecoStringTable **theme_list);
171 gchar *irreco_webdb_client_get_theme_date_by_id(IrrecoWebdbClient *self,
172 gint theme_id);
174 gint irreco_webdb_client_add_bg_to_theme(IrrecoWebdbClient *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);
185 gboolean irreco_webdb_client_get_backgrounds(IrrecoWebdbClient *self,
186 gint theme_id,
187 IrrecoStringTable **bg_list);
189 gboolean irreco_webdb_client_get_bg_by_id(IrrecoWebdbClient *self,
190 gint bg_id,
191 const char *theme_bg_dir);
193 gint irreco_webdb_client_add_button_to_theme(IrrecoWebdbClient *self,
194 const gchar *name,
195 gboolean allow_text,
196 const gchar *text_format_up,
197 const gchar *text_format_down,
198 gint text_padding,
199 gfloat text_h_align,
200 gfloat text_v_align,
201 const gchar *image_up_hash,
202 const gchar *image_up_name,
203 const guchar *image_up,
204 gint image_up_len,
205 const gchar *image_down_hash,
206 const gchar *image_down_name,
207 const guchar *image_down,
208 gint image_down_len,
209 const gchar *folder,
210 gint theme_id,
211 const gchar *user,
212 const gchar *password);
214 gboolean irreco_webdb_client_get_buttons(IrrecoWebdbClient *self,
215 gint theme_id,
216 IrrecoStringTable **button_list);
218 gboolean irreco_webdb_client_get_button_by_id(IrrecoWebdbClient *self,
219 gint button_id,
220 const char *theme_button_dir);
222 gboolean irreco_webdb_client_get_preview_button(IrrecoWebdbClient *self,
223 gint theme_id,
224 GdkPixbuf **preview_button);
226 gboolean irreco_webdb_client_login(IrrecoWebdbClient *self,
227 const gchar *user,
228 const gchar *password);
230 #endif /* __IRRECO_WEBDB_CLIENT__ */
232 /** @} */