Debian Codegraph @

wifi/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 #include <string.h>
21 #include <cairo-dock.h>
22
23 #include "applet-struct.h"
24 #include "applet-config.h"
25
26
27 CD_APPLET_GET_CONFIG_BEGIN
28 //\_________________ On recupere toutes les valeurs de notre fichier de conf.
29 myConfig.defaultTitle = CD_CONFIG_GET_STRING ("Icon", "name");
30 myConfig.iCheckInterval = CD_CONFIG_GET_INTEGER_WITH_DEFAULT ("Configuration", "delay", 10);
31 myConfig.fSmoothFactor = CD_CONFIG_GET_DOUBLE ("Configuration", "smooth");
32
33 myConfig.cUserCommand = CD_CONFIG_GET_STRING ("Configuration", "command");
34
35 myConfig.quickInfoType = CD_CONFIG_GET_INTEGER_WITH_DEFAULT ("Configuration", "signal_type", WIFI_INFO_SIGNAL_STRENGTH_LEVEL);
36
37 myConfig.iDisplayType = CD_CONFIG_GET_INTEGER_WITH_DEFAULT ("Configuration", "renderer", 0);
38
39 myConfig.cGThemePath = CD_CONFIG_GET_GAUGE_THEME ("Configuration", "theme");
40
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
46 if (! g_key_file_has_key (CD_APPLET_MY_KEY_FILE, "Configuration", "default_icon", NULL)) // new option -> get the previous "excellent" user icon
47 {
48 myConfig.cDefaultIcon = CD_CONFIG_GET_STRING ("Configuration", "icon_5");
49 g_key_file_set_string (CD_APPLET_MY_KEY_FILE, "Configuration", "default_icon", myConfig.cDefaultIcon?myConfig.cDefaultIcon:"");
50 myConfig.cNoSignalIcon = CD_CONFIG_GET_STRING ("Configuration", "icon_0");
51 g_key_file_set_string (CD_APPLET_MY_KEY_FILE, "Configuration", "no_signal_icon", myConfig.cDefaultIcon?myConfig.cDefaultIcon:"");
52 }
53 else
54 {
55 myConfig.cDefaultIcon = CD_CONFIG_GET_STRING ("Configuration", "default_icon");
56 myConfig.cNoSignalIcon = CD_CONFIG_GET_STRING ("Configuration", "no_signal_icon");
57 }
58 CD_APPLET_GET_CONFIG_END
59
60
61 CD_APPLET_RESET_CONFIG_BEGIN
62 g_free (myConfig.cGThemePath);
63 g_free (myConfig.defaultTitle);
64 g_free (myConfig.cUserCommand);
65
66 CD_APPLET_RESET_CONFIG_END
67
68
69 CD_APPLET_RESET_DATA_BEGIN
70 gldi_task_free (myData.pTask);
71
72 CD_APPLET_REMOVE_MY_DATA_RENDERER;
73
74 g_free (myData.cESSID);
75 g_free (myData.cInterface);
76 g_free (myData.cAccessPoint);
77 g_free (myData.cIWConfigPath);
78
79 CD_APPLET_RESET_DATA_END