2
* This file is a part of the Cairo-Dock project
4
* Copyright : (C) see the 'copyright' file.
5
* E-mail : see the 'copyright' file.
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.
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/>.
21
#include <cairo-dock.h>
23
#include "applet-struct.h"
24
#include "applet-notifications.h"
25
#include "applet-menu.h"
26
#include "applet-config.h"
29
//\_________________ Here you have to get all your parameters from the conf file. Use the macros CD_CONFIG_GET_BOOLEAN, CD_CONFIG_GET_INTEGER, CD_CONFIG_GET_STRING, etc. myConfig has been reseted to 0 at this point. This function is called at the beginning of init and reload.
30
CD_APPLET_GET_CONFIG_BEGIN
31
myConfig.bHasIcons = CD_CONFIG_GET_BOOLEAN ("Configuration", "has icons");
32
myConfig.cMenuShortkey = CD_CONFIG_GET_STRING ("Configuration", "menu shortkey");
33
myConfig.cDirPath = CD_CONFIG_GET_STRING ("Configuration", "dir path");
34
myConfig.bFoldersFirst = CD_CONFIG_GET_BOOLEAN ("Configuration", "folders first");
35
myConfig.bCaseUnsensitive = CD_CONFIG_GET_BOOLEAN ("Configuration", "case unsensitive");
36
myConfig.bShowHiddenFiles = CD_CONFIG_GET_BOOLEAN ("Configuration", "show hidden");
37
myConfig.iNbSubItemsAtOnce = CD_CONFIG_GET_INTEGER ("Configuration", "granularity");
38
if (myConfig.iNbSubItemsAtOnce < 1)
39
myConfig.iNbSubItemsAtOnce = 1;
40
int iIconSize = CD_CONFIG_GET_INTEGER ("Configuration", "icon size");
44
myConfig.iIconSize = 16;
47
myConfig.iIconSize = 24;
50
myConfig.iIconSize = 32;
54
// On gere les chemins relatifs.
55
if (myConfig.cDirPath != NULL && *myConfig.cDirPath == '~')
57
gchar *tmp = myConfig.cDirPath;
58
myConfig.cDirPath = g_strdup_printf ("%s%s", g_getenv ("HOME"), myConfig.cDirPath+1);
61
else if (myConfig.cDirPath != NULL && *myConfig.cDirPath != '/')
63
gchar *tmp = myConfig.cDirPath;
64
myConfig.cDirPath = g_strdup_printf ("%s/%s", g_getenv ("HOME"), myConfig.cDirPath);
68
if (myConfig.cDirPath == NULL || ! g_file_test (myConfig.cDirPath, G_FILE_TEST_IS_DIR))
70
cd_debug ("Quick Browser : this path (%s) is not a valid folder\n We'll use the 'home' instead.", myConfig.cDirPath);
71
g_free (myConfig.cDirPath);
72
myConfig.cDirPath = g_strdup (g_getenv ("HOME"));
74
CD_APPLET_GET_CONFIG_END
77
//\_________________ Here you have to free all ressources allocated for myConfig. This one will be reseted to 0 at the end of this function. This function is called right before you get the applet's config, and when your applet is stopped, in the end.
78
CD_APPLET_RESET_CONFIG_BEGIN
79
g_free (myConfig.cDirPath);
80
if (myConfig.cMenuShortkey)
81
cd_keybinder_unbind (myConfig.cMenuShortkey, (CDBindkeyHandler) cd_quick_browser_on_shortkey_menu);
82
g_free (myConfig.cMenuShortkey);
83
CD_APPLET_RESET_CONFIG_END
86
//\_________________ Here you have to free all ressources allocated for myData. This one will be reseted to 0 at the end of this function. This function is called when your applet is stopped, in the very end.
87
CD_APPLET_RESET_DATA_BEGIN
88
cd_quick_browser_destroy_menu (myApplet);
89
CD_APPLET_RESET_DATA_END