Debian Codegraph @

Cairo-Penguin/src/applet-config.c

raw symbols SCIP
1 /**
2 * This file is a part of the Cairo-Dock project
3 *
4 * Copyright : (C) see the 'copyright' file.
5 * E-mail : see the 'copyright' file.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 3
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #include <string.h>
21
22 #include "applet-struct.h"
23 #include "applet-config.h"
24
25
26 CD_APPLET_GET_CONFIG_BEGIN
27 //\_________________ On recupere toutes les valeurs de notre fichier de conf.
28 myConfig.cThemePath = CD_CONFIG_GET_THEME_PATH ("Configuration", "theme", "themes", "Classic");
29
30 myConfig.iDelayBetweenChanges = MAX (2, CD_CONFIG_GET_INTEGER ("Configuration", "change delay"));
31
32 myConfig.fAlpha = CD_CONFIG_GET_DOUBLE ("Configuration", "alpha");
33
34 myConfig.bFree = CD_CONFIG_GET_BOOLEAN ("Configuration", "free");
35
36 myConfig.iGroundOffset = CD_CONFIG_GET_INTEGER ("Configuration", "ground");
37 CD_APPLET_GET_CONFIG_END
38
39
40 CD_APPLET_RESET_CONFIG_BEGIN
41 g_free (myConfig.cThemePath);
42 CD_APPLET_RESET_CONFIG_END
43
44
45 static void _penguin_reset_one_animation (PenguinAnimation *pAnimation)
46 {
47 if (pAnimation->pSurfaces != NULL)
48 {
49 int i, j;
50 for (i = 0; i < pAnimation->iNbDirections; i ++)
51 {
52 for (j = 0; j < pAnimation->iNbFrames; j ++)
53 {
54 cairo_surface_destroy (pAnimation->pSurfaces[i][j]);
55 }
56 g_free (pAnimation->pSurfaces[i]);
57 pAnimation->pSurfaces[i] = NULL;
58 }
59 g_free (pAnimation->pSurfaces);
60 pAnimation->pSurfaces = NULL;
61 }
62 if (pAnimation->iTexture != 0)
63 {
64 _cairo_dock_delete_texture (pAnimation->iTexture);
65 pAnimation->iTexture = 0;
66 }
67 }
68
69 void cd_penguin_reset_data (GldiModuleInstance *myApplet)
70 {
71 int i;
72 for (i = 0; i < myData.iNbAnimations; i++)
73 {
74 _penguin_reset_one_animation (&myData.pAnimations[i]);
75 }
76
77 g_free (myData.pAnimations);
78 myData.pAnimations = NULL;
79 g_free (myData.pBeginningAnimations);
80 myData.pBeginningAnimations = NULL;
81 g_free (myData.pEndingAnimations);
82 myData.pEndingAnimations = NULL;
83 g_free (myData.pGoUpAnimations);
84 myData.pGoUpAnimations = NULL;
85 g_free (myData.pMovmentAnimations);
86 myData.pMovmentAnimations = NULL;
87 g_free (myData.pRestAnimations);
88 myData.pRestAnimations = NULL;
89 }
90
91 CD_APPLET_RESET_DATA_BEGIN
92 cd_penguin_reset_data (myApplet);
93 CD_APPLET_RESET_DATA_END