2 * irreco - Ir Remote Control
3 * Copyright (C) 2008 Joni Kokko (t5kojo01@students.oamk.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 #include "irreco_webdb_conf.h"
23 * @addtogroup IrrecoWebdbConf
24 * @ingroup IrrecoWebdb
26 * @todo PURPOCE OF CLASS
33 * Source file of @ref IrrecoWebdbConf.
36 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
38 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
41 * @name Construction & Destruction
45 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
46 /* Construction & Destruction */
47 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
48 IrrecoWebdbConf
*irreco_webdb_conf_new()
50 IrrecoWebdbConf
*self
;
53 self
= g_slice_new0(IrrecoWebdbConf
);
56 self
->user
= g_string_new("");
57 self
->backend
= g_string_new("");
58 self
->category
= g_string_new("");
59 self
->manufacturer
= g_string_new("");
60 self
->model
= g_string_new("");
61 self
->file_hash
= g_string_new("");
62 self
->file_name
= g_string_new("");
63 self
->file_uploaded
= g_string_new("");
64 self
->file_download_count
= g_string_new("");
66 IRRECO_RETURN_PTR(self
);
69 void irreco_webdb_conf_free(IrrecoWebdbConf
*self
)
73 g_assert(self
!= NULL
);
75 g_string_free(self
->user
, TRUE
);
78 g_string_free(self
->backend
, TRUE
);
81 g_string_free(self
->category
, TRUE
);
82 self
->category
= NULL
;
84 g_string_free(self
->manufacturer
, TRUE
);
85 self
->manufacturer
= NULL
;
87 g_string_free(self
->model
, TRUE
);
90 g_string_free(self
->file_hash
, TRUE
);
91 self
->file_hash
= NULL
;
93 g_string_free(self
->file_name
, TRUE
);
94 self
->file_name
= NULL
;
96 g_string_free(self
->file_uploaded
, TRUE
);
97 self
->file_uploaded
= NULL
;
99 g_string_free(self
->file_download_count
, TRUE
);
100 self
->file_download_count
= NULL
;
102 g_slice_free(IrrecoWebdbConf
, self
);
110 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
111 /* Private Functions */
112 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
115 * @name Public Functions
120 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
122 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
124 void irreco_webdb_conf_set(IrrecoWebdbConf
*self
,
128 const char *category
,
129 const char *manufacturer
,
131 const char *file_hash
,
132 const char *file_name
,
133 const char *file_uploaded
,
134 const char *file_download_count
)
139 g_string_printf(self
->user
,"%s",user
);
140 g_string_printf(self
->backend
,"%s",backend
);
141 g_string_printf(self
->category
,"%s",category
);
142 g_string_printf(self
->manufacturer
,"%s",manufacturer
);
143 g_string_printf(self
->model
,"%s",model
);
144 g_string_printf(self
->file_hash
,"%s",file_hash
);
145 g_string_printf(self
->file_name
,"%s",file_name
);
146 g_string_printf(self
->file_uploaded
,"%s",file_uploaded
);
147 g_string_printf(self
->file_download_count
,"%s",file_download_count
);
152 void irreco_webdb_conf_print(IrrecoWebdbConf
*self
)
154 IRRECO_PRINTF("Configuration: %d %s %s %s %s %s %s %s %s %s\n",
155 self
->id
, self
->user
->str
, self
->backend
->str
,
156 self
->category
->str
, self
->manufacturer
->str
,
157 self
->model
->str
, self
->file_hash
->str
,
158 self
->file_name
->str
, self
->file_uploaded
->str
,
159 self
->file_download_count
->str
);
164 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
165 /* Events and Callbacks */
166 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/