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-config.h"
28
//\_________________ 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.
29
CD_APPLET_GET_CONFIG_BEGIN
30
myConfig.bShowRecent = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "show recent", TRUE);
31
myConfig.cMenuShortkey = CD_CONFIG_GET_STRING ("Configuration", "menu shortkey");
32
myConfig.cQuickLaunchShortkey = CD_CONFIG_GET_STRING ("Configuration", "quick launch shortkey");
33
myConfig.cConfigureMenuCommand = CD_CONFIG_GET_STRING ("Configuration", "config menu");
34
myConfig.iNbRecentItems = CD_CONFIG_GET_INTEGER_WITH_DEFAULT ("Configuration", "nb recent", 20);
35
myConfig.iShowQuit = CD_CONFIG_GET_INTEGER ("Configuration", "show quit");
36
myConfig.bLoadIconsAtStartup = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "startup load", FALSE);
37
CD_APPLET_GET_CONFIG_END
40
//\_________________ 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.
41
CD_APPLET_RESET_CONFIG_BEGIN
42
g_free (myConfig.cConfigureMenuCommand);
43
g_free (myConfig.cMenuShortkey);
44
g_free (myConfig.cQuickLaunchShortkey);
45
CD_APPLET_RESET_CONFIG_END
48
//\_________________ 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.
49
CD_APPLET_RESET_DATA_BEGIN
50
myData.bIconsLoaded = TRUE;
52
cairo_dock_discard_task (myData.pTask);
53
g_list_free (myData.pPreloadedImagesList);
56
gtk_widget_destroy (myData.pMenu); // detruit aussi pRecentMenuItem.
58
if (myData.loaded_icons != NULL)
60
g_hash_table_destroy (myData.loaded_icons); // wll unref objects inside.
61
myData.loaded_icons = NULL; // set to NULL for the callback
64
if (myData.image_menu_items != NULL)
66
g_slist_free (myData.image_menu_items); // objects inside will be destroyed with the menu.
67
myData.image_menu_items = NULL;
71
g_hash_table_destroy (myData.dir_hash);
74
for (l = myData.possible_executables; l; l = l->next)
76
g_list_free (myData.possible_executables);
78
for (l = myData.completion_items; l; l = l->next)
80
g_list_free (myData.completion_items);
82
if (myData.completion)
83
g_completion_free (myData.completion);
85
if (!cairo_dock_dialog_unreference (myData.pQuickLaunchDialog))
86
cairo_dock_dialog_unreference (myData.pQuickLaunchDialog);
87
CD_APPLET_RESET_DATA_END