2 * irreco - Ir Remote Control
3 * Copyright (C) 2007 Arto Karppinen (arto.karppinen@iki.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_data.h"
21 #include "irreco_button.h"
22 #include "irreco_button_dlg.h"
23 #include <irreco_string_table.h>
24 #include "irreco_backend_lib.h"
25 #include "irreco_backend_instance.h"
28 * @addtogroup IrrecoData
30 * Main irreco data structure.
32 * IrrecoData should contain pointers to every piece of memory irreco has
33 * allocated. Either directry, or via other structures.
35 * Also destroying IrrecoData should free pretty much everything elese the
36 * program has allocated.
43 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
44 /* Construction & Destruction */
45 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
48 * @name Construction & Destruction
52 IrrecoData
*irreco_data_new()
57 self
= g_slice_new0(IrrecoData
);
58 self
->button_style_array
= irreco_string_table_new(
59 G_DESTROYNOTIFY(irreco_button_style_destroy
), NULL
);
60 self
->irreco_layout_array
= irreco_string_table_new(
61 G_DESTROYNOTIFY(irreco_button_layout_destroy
),
62 IRRECO_KEY_SET_NOTIFY(irreco_button_layout_set_name
));
63 self
->irreco_backend_manager
=
64 irreco_backend_manager_create(self
);
65 self
->new_button_dlg
= irreco_button_dlg_create(self
);
67 irreco_button_dlg_set(self
->new_button_dlg
, NULL
, NULL
, NULL
);
69 self
->window_manager
= irreco_window_manager_create(self
);
70 self
->cmd_chain_manager
= irreco_cmd_chain_manager_new();
71 self
->theme_manager
= irreco_theme_manager_new(self
);
72 IRRECO_RETURN_PTR(self
);
75 void irreco_data_free(IrrecoData
*self
)
78 if (self
->webdb_cache
) irreco_webdb_cache_free(self
->webdb_cache
);
79 irreco_window_manager_destroy(self
->window_manager
);
80 irreco_string_table_free(self
->irreco_layout_array
);
81 irreco_string_table_free(self
->button_style_array
);
82 irreco_cmd_chain_manager_free(self
->cmd_chain_manager
);
83 irreco_backend_manager_destroy(self
->irreco_backend_manager
);
84 irreco_button_dlg_destroy(self
->new_button_dlg
);
85 irreco_theme_manager_free(self
->theme_manager
);
86 g_slice_free(IrrecoData
, self
);
94 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
96 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
98 * @name Public Functions
103 * Get IrrecoWebdbCache object.
105 * @param reset If TRUE, the old IrrecoWebdbCache object will be freed,
106 * and a new one will be created. This has the effect of releasing
109 IrrecoWebdbCache
*irreco_data_get_webdb_cache(IrrecoData
*self
,
114 if (reset
== TRUE
&& self
->webdb_cache
!= NULL
) {
115 irreco_webdb_cache_free(self
->webdb_cache
);
116 self
->webdb_cache
= NULL
;
118 if (self
->webdb_cache
== NULL
) {
119 self
->webdb_cache
= irreco_webdb_cache_new();
122 IRRECO_RETURN_PTR(self
->webdb_cache
);