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/>.
20
/******************************************************************************
22
This file is a part of the cairo-dock program,
23
released under the terms of the GNU General Public License.
25
Written by Rémy Robertson (for any bug report, please mail me to changfu@cairo-dock.org)
26
Fabrice Rey <fabounet@users.berlios.de>
28
******************************************************************************/
32
#include "applet-config.h"
33
#include "applet-notifications.h"
34
#include "applet-struct.h"
35
#include "applet-init.h"
36
#include "applet-load-icon.h"
37
#include "applet-compiz.h"
39
#define CD_COMPIZ_CHECK_TIME 4
41
CD_APPLET_DEFINITION ("compiz-icon",
43
CAIRO_DOCK_CATEGORY_DESKTOP,
44
N_("This applet allows you to manage compiz and other windows manager\n"
45
"The sub-dock gives you to acces to CCSM, Emerald and some basic Compiz actions.\n"
46
"You can bind one of these actions with the middle-click.\n"
47
"The configuration panel gives you some options to launch Compiz."),
48
"ChAnGFu (Rémy Robertson) (thanks to Coz for his icons)")
52
cd_compiz_build_icons ();
54
if (myConfig.bAutoReloadDecorator || myConfig.bAutoReloadCompiz) {
55
myData.bDecoratorRestarted = FALSE;
56
myData.iCompizIcon = -1; // force le dessin.
57
if (! myConfig.forceConfig) // on fait comme si c'est nous qui l'avons mis dans l'etat actuel.
58
myData.bCompizRestarted = TRUE;
60
myData.pTask = cairo_dock_new_task (CD_COMPIZ_CHECK_TIME,
61
(CairoDockGetDataAsyncFunc) cd_compiz_read_data,
62
(CairoDockUpdateSyncFunc) cd_compiz_update_from_data,
64
cairo_dock_launch_task (myData.pTask);
67
CD_APPLET_SET_USER_IMAGE_ON_MY_ICON (myConfig.cUserImage[COMPIZ_DEFAULT], "default.svg");
70
CD_APPLET_REGISTER_FOR_CLICK_EVENT;
71
CD_APPLET_REGISTER_FOR_MIDDLE_CLICK_EVENT;
72
CD_APPLET_REGISTER_FOR_BUILD_MENU_EVENT;
78
CD_APPLET_UNREGISTER_FOR_CLICK_EVENT;
79
CD_APPLET_UNREGISTER_FOR_MIDDLE_CLICK_EVENT;
80
CD_APPLET_UNREGISTER_FOR_BUILD_MENU_EVENT;
84
CD_APPLET_RELOAD_BEGIN
85
//\_______________ On recharge les donnees qui ont pu changer.
86
if (CD_APPLET_MY_CONFIG_CHANGED) {
88
//\________________ les icones ont pu changer, ainsi que l'inhibition.
89
if (myIcon->pSubDock != NULL) {
90
cairo_dock_destroy_dock (myIcon->pSubDock, myIcon->acName, NULL, NULL);
91
myIcon->pSubDock = NULL;
93
if (myDesklet && myDesklet->icons != NULL) {
94
g_list_foreach (myDesklet->icons, (GFunc) cairo_dock_free_icon, NULL);
95
g_list_free (myDesklet->icons);
96
myDesklet->icons = NULL;
99
if (cairo_dock_task_is_active (myData.pTask) && ! myConfig.bAutoReloadDecorator && ! myConfig.bAutoReloadCompiz) {
100
cairo_dock_stop_task (myData.pTask);
101
CD_APPLET_SET_USER_IMAGE_ON_MY_ICON (myConfig.cUserImage[COMPIZ_DEFAULT], "default.svg");
103
else if (! cairo_dock_task_is_active (myData.pTask) && (myConfig.bAutoReloadDecorator || myConfig.bAutoReloadCompiz)) {
104
myData.iCompizIcon = -1;
105
myData.bDecoratorRestarted = FALSE;
106
if (! myConfig.forceConfig) // on fait comme si c'est nous qui l'avons mis dans l'etat actuel.
107
myData.bCompizRestarted = TRUE;
109
cairo_dock_launch_task (myData.pTask);
112
if (cairo_dock_task_is_active (myData.pTask))
113
myData.iCompizIcon = -1;
115
CD_APPLET_SET_USER_IMAGE_ON_MY_ICON (myConfig.cUserImage[COMPIZ_DEFAULT], "default.svg");
118
cd_compiz_build_icons ();
121
else if (myDesklet != NULL) {
122
gpointer pConfig[2] = {GINT_TO_POINTER (FALSE), GINT_TO_POINTER (FALSE)};
123
CD_APPLET_SET_DESKLET_RENDERER_WITH_DATA ("Caroussel", pConfig);