Debian Codegraph @

Disks/src/applet-config.c

raw
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
21 #include <string.h>
22 #include <cairo-dock.h>
23
24 #include "applet-struct.h"
25 #include "applet-config.h"
26 #include "applet-disks.h"
27
28
29 CD_APPLET_GET_CONFIG_BEGIN
30 ///\_________________ General
31 myConfig.defaultTitle = CD_CONFIG_GET_STRING ("Icon", "name");
32
33 ///\_________________ Renderer
34 myConfig.iDisplayType = CD_CONFIG_GET_INTEGER ("Configuration", "renderer");
35
36 ///\_________________ Gauge
37 myConfig.cGThemePath = CD_CONFIG_GET_GAUGE_THEME ("Configuration", "theme");
38 myConfig.iRotateTheme = CD_CONFIG_GET_INTEGER ("Configuration", "rotate theme");
39
40 ///\_________________ Graph
41 myConfig.iGraphType = CD_CONFIG_GET_INTEGER ("Configuration", "graphic type");
42 CD_CONFIG_GET_COLOR_RGB ("Configuration", "low color", myConfig.fLowColor);
43 CD_CONFIG_GET_COLOR_RGB ("Configuration", "high color", myConfig.fHigholor);
44 CD_CONFIG_GET_COLOR_RGBA ("Configuration", "bg color", myConfig.fBgColor);
45 myConfig.bMixGraph = CD_CONFIG_GET_BOOLEAN ("Configuration", "mix graph");
46
47 ///\_________________ Display
48 myConfig.iCheckInterval = CD_CONFIG_GET_INTEGER ("Configuration", "delay");
49 myConfig.fSmoothFactor = CD_CONFIG_GET_DOUBLE ("Configuration", "smooth");
50 myConfig.iInfoDisplay = CD_CONFIG_GET_INTEGER ("Configuration", "info display");
51
52 ///\_________________ Parameters
53 myConfig.cDisks = CD_CONFIG_GET_STRING_LIST ("Configuration", "disks", &myConfig.iNumberDisks);
54 myConfig.cParts = CD_CONFIG_GET_STRING_LIST ("Configuration", "partitions", &myConfig.iNumberParts);
55 myConfig.cSystemMonitorCommand = CD_CONFIG_GET_STRING ("Configuration", "sys monitor");
56 CD_APPLET_GET_CONFIG_END
57
58
59 CD_APPLET_RESET_CONFIG_BEGIN
60 g_free (myConfig.cGThemePath);
61 g_free (myConfig.defaultTitle);
62 g_strfreev (myConfig.cDisks);
63 g_free (myConfig.cWatermarkImagePath);
64 g_free (myConfig.cSystemMonitorCommand);
65 CD_APPLET_RESET_CONFIG_END
66
67
68 CD_APPLET_RESET_DATA_BEGIN
69 gldi_task_free (myData.pPeriodicTask);
70
71 if (myData.dbus_proxy_nm != NULL)
72 g_object_unref (myData.dbus_proxy_nm);
73
74 CD_APPLET_REMOVE_MY_DATA_RENDERER;
75
76 g_timer_destroy (myData.pClock);
77
78 cd_disks_reset_parts_list (myApplet);
79 cd_disks_reset_disks_list (myApplet);
80 CD_APPLET_RESET_DATA_END