Debian Codegraph @

shortcuts/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-disk-usage.h"
25 #include "applet-config.h"
26
27
28 CD_APPLET_GET_CONFIG_BEGIN
29 CD_CONFIG_RENAME_GROUP ("Module", "Configuration");
30 myConfig.bListDrives = CD_CONFIG_GET_BOOLEAN ("Configuration", "list drives");
31 myConfig.bListNetwork = CD_CONFIG_GET_BOOLEAN ("Configuration", "list network");
32 myConfig.bListBookmarks = CD_CONFIG_GET_BOOLEAN ("Configuration", "list bookmarks");
33 ///myConfig.bUseSeparator = CD_CONFIG_GET_BOOLEAN ("Configuration", "use separator");
34
35 myConfig.iDisplayType = CD_CONFIG_GET_INTEGER_WITH_DEFAULT ("Configuration", "disk usage", CD_SHOW_USED_SPACE_PERCENT);
36 myConfig.iCheckInterval = CD_CONFIG_GET_INTEGER_WITH_DEFAULT ("Configuration", "check interval", 10);
37 myConfig.bDrawBar = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "draw bar", TRUE);
38
39 myConfig.cRenderer = CD_CONFIG_GET_STRING ("Configuration", "renderer");
40 myConfig.iDeskletRendererType = CD_CONFIG_GET_INTEGER ("Configuration", "desklet renderer");
41 CD_APPLET_GET_CONFIG_END
42
43
44 CD_APPLET_RESET_CONFIG_BEGIN
45 g_free (myConfig.cRenderer);
46 CD_APPLET_RESET_CONFIG_END
47
48
49 void cd_shortcuts_reset_all_datas (GldiModuleInstance *myApplet)
50 {
51 cd_shortcuts_free_disk_periodic_task (myApplet);
52
53 if (myData.pTask != NULL)
54 {
55 gldi_task_discard (myData.pTask);
56 myData.pTask = NULL;
57 }
58
59 if (myData.cDisksURI != NULL)
60 {
61 cairo_dock_fm_remove_monitor_full (myData.cDisksURI, FALSE, NULL);
62 g_free (myData.cDisksURI);
63 myData.cDisksURI = NULL;
64 }
65 if (myData.cNetworkURI != NULL)
66 {
67 cairo_dock_fm_remove_monitor_full (myData.cNetworkURI, FALSE, NULL);
68 g_free (myData.cNetworkURI);
69 myData.cNetworkURI = NULL;
70 }
71 if (myData.cBookmarksURI != NULL)
72 {
73 cairo_dock_fm_remove_monitor_full (myData.cBookmarksURI, FALSE, NULL);
74 g_free (myData.cBookmarksURI);
75 myData.cBookmarksURI = NULL;
76 }
77
78 CD_APPLET_DELETE_MY_ICONS_LIST;
79 }
80
81 CD_APPLET_RESET_DATA_BEGIN
82 cd_shortcuts_reset_all_datas (myApplet);
83 g_free (myData.cLastCreatedUri);
84 g_free (myData.cLastDeletedUri);
85 CD_APPLET_RESET_DATA_END