1 /* EasyTAG - Tag editor for audio files
2 * Copyright (C) 2014 David King <amigadave@amigadave.com>
3 * Copyright (C) 2000-2003 Jerome Couderc <easytag@gmail.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (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.
14 *
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
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19
20 #include "et_core.h"
21
22 #include "file.h"
23 #include "file_list.h"
24
25 ET_Core *ETCore = NULL;
26
27 /*
28 * Colors Used
29 */
30 GdkRGBA RED = {1.0, 0.0, 0.0, 1.0 };
31
32 void
ET_Core_Create(void)33 ET_Core_Create (void)
34 {
35 /* Allocate. */
36 if (ETCore == NULL)
37 {
38 ETCore = g_slice_new0 (ET_Core);
39 }
40 }
41
42 void
ET_Core_Free(void)43 ET_Core_Free (void)
44 {
45 g_return_if_fail (ETCore != NULL);
46
47 /* First frees lists. */
48 if (ETCore->ETFileList)
49 {
50 et_file_list_free (ETCore->ETFileList);
51 ETCore->ETFileList = NULL;
52 }
53
54 if (ETCore->ETFileDisplayedList)
55 {
56 et_displayed_file_list_free (ETCore->ETFileDisplayedList);
57 ETCore->ETFileDisplayedList = NULL;
58 }
59
60 if (ETCore->ETHistoryFileList)
61 {
62 et_history_file_list_free (ETCore->ETHistoryFileList);
63 ETCore->ETHistoryFileList = NULL;
64 }
65
66 if (ETCore->ETArtistAlbumFileList)
67 {
68 et_artist_album_file_list_free (ETCore->ETArtistAlbumFileList);
69 ETCore->ETArtistAlbumFileList = NULL;
70 }
71
72 if (ETCore)
73 {
74 g_slice_free (ET_Core, ETCore);
75 ETCore = NULL;
76 }
77 }
78