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_theme.h"
23 * @addtogroup IrrecoWebdbTheme
24 * @ingroup IrrecoWebdb
26 * Contains information of theme.
33 * Source file of @ref IrrecoWebdbTheme.
36 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
38 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
41 * @name Construction & Destruction
45 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
46 /* Construction & Destruction */
47 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
48 IrrecoWebdbTheme
*irreco_webdb_theme_new()
50 IrrecoWebdbTheme
*self
;
53 self
= g_slice_new0(IrrecoWebdbTheme
);
56 self
->name
= g_string_new("");
57 self
->creator
= g_string_new("");
58 self
->comment
= g_string_new("");
59 self
->preview_button_name
= g_string_new("");
60 self
->preview_button
= NULL
;
61 self
->folder
= g_string_new("");
62 self
->uploaded
= g_string_new("");
63 self
->modified
= g_string_new("");
64 self
->downloaded
= g_string_new("");
65 self
->download_count
= 0;
66 self
->versions
= NULL
;
68 IRRECO_RETURN_PTR(self
);
71 void irreco_webdb_theme_free(IrrecoWebdbTheme
*self
)
75 g_assert(self
!= NULL
);
77 g_string_free(self
->name
, TRUE
);
80 g_string_free(self
->creator
, TRUE
);
83 g_string_free(self
->comment
, TRUE
);
86 g_string_free(self
->preview_button_name
, TRUE
);
87 self
->preview_button_name
= NULL
;
89 if (self
->preview_button
!= NULL
) {
90 g_object_unref(G_OBJECT(self
->preview_button
));
91 self
->preview_button
= NULL
;
94 g_string_free(self
->folder
, TRUE
);
97 g_string_free(self
->uploaded
, TRUE
);
98 self
->uploaded
= NULL
;
100 g_string_free(self
->modified
, TRUE
);
101 self
->modified
= NULL
;
103 g_string_free(self
->downloaded
, TRUE
);
104 self
->downloaded
= NULL
;
106 if (self
->versions
!= NULL
) {
107 irreco_string_table_free(self
->versions
);
110 g_slice_free(IrrecoWebdbTheme
, self
);
118 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
119 /* Private Functions */
120 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
123 * @name Public Functions
128 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
130 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
132 void irreco_webdb_theme_set(IrrecoWebdbTheme
*self
,
137 const char *preview_button_name
,
138 GdkPixbuf
*preview_button
,
140 const char *uploaded
,
141 const char *modified
,
142 const char *downloaded
,
148 g_string_printf(self
->name
, "%s", name
);
149 g_string_printf(self
->creator
, "%s", creator
);
150 g_string_printf(self
->comment
, "%s", comment
);
151 g_string_printf(self
->preview_button_name
, "%s", preview_button_name
);
153 if (preview_button
!= NULL
) {
154 if (self
->preview_button
!= NULL
) {
155 g_object_unref(G_OBJECT(self
->preview_button
));
157 self
->preview_button
= preview_button
;
159 g_string_printf(self
->folder
, "%s", folder
);
160 g_string_printf(self
->uploaded
, "%s", uploaded
);
161 g_string_printf(self
->modified
, "%s", modified
);
162 g_string_printf(self
->downloaded
, "%s", downloaded
);
163 self
->download_count
= download_count
;
168 void irreco_webdb_theme_print(IrrecoWebdbTheme
*self
)
171 IRRECO_PRINTF("ID: %d\n", self
->id
);
172 IRRECO_PRINTF("Name: %s\n", self
->name
->str
);
173 IRRECO_PRINTF("Creator: %s\n", self
->creator
->str
);
174 IRRECO_PRINTF("Comment: %s\n", self
->comment
->str
);
175 IRRECO_PRINTF("Preview-button: %s\n", self
->preview_button_name
->str
);
176 IRRECO_PRINTF("Folder: %s\n", self
->folder
->str
);
177 IRRECO_PRINTF("Uploaded: %s\n", self
->uploaded
->str
);
178 IRRECO_PRINTF("Modified: %s\n", self
->modified
->str
);
179 IRRECO_PRINTF("Downloaded: %s\n", self
->downloaded
->str
);
180 IRRECO_PRINTF("Download_count: %d\n", self
->download_count
);
184 void irreco_webdb_theme_set_preview_button(IrrecoWebdbTheme
*self
,
185 GdkPixbuf
*preview_button
)
189 if (self
->preview_button
!= NULL
) {
190 g_object_unref(G_OBJECT(self
->preview_button
));
193 self
->preview_button
= preview_button
;
200 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
201 /* Events and Callbacks */
202 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/