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/>.
22
#include "applet-config.h"
23
#include "applet-notifications.h"
24
#include "applet-struct.h"
25
#include "applet-init.h"
26
#include "applet-load-icon.h"
27
#include "applet-compiz.h"
29
#define CD_COMPIZ_CHECK_TIME 4
31
CD_APPLET_DEFINITION (N_("compiz-icon"),
33
CAIRO_DOCK_CATEGORY_APPLET_DESKTOP,
34
N_("This applet allows you to manage compiz and other windows manager\n"
35
"The sub-dock gives you to acces to CCSM, Emerald and some basic Compiz actions.\n"
36
"You can bind one of these actions with the middle-click.\n"
37
"The configuration panel gives you some options to launch Compiz."),
38
"ChAnGFu (Rémy Robertson) (thanks to Coz for his icons)")
42
cd_compiz_build_icons ();
44
if (myConfig.bAutoReloadDecorator || myConfig.bAutoReloadCompiz) {
45
myData.bDecoratorRestarted = FALSE;
46
myData.iCompizIcon = -1; // force le dessin.
47
if (! myConfig.forceConfig) // on fait comme si c'est nous qui l'avons mis dans l'etat actuel.
48
myData.bCompizRestarted = TRUE;
50
myData.pTask = cairo_dock_new_task (CD_COMPIZ_CHECK_TIME,
51
(CairoDockGetDataAsyncFunc) cd_compiz_read_data,
52
(CairoDockUpdateSyncFunc) cd_compiz_update_from_data,
54
cairo_dock_launch_task (myData.pTask);
57
CD_APPLET_SET_USER_IMAGE_ON_MY_ICON (myConfig.cUserImage[COMPIZ_DEFAULT], "default.svg");
60
CD_APPLET_REGISTER_FOR_CLICK_EVENT;
61
CD_APPLET_REGISTER_FOR_MIDDLE_CLICK_EVENT;
62
CD_APPLET_REGISTER_FOR_BUILD_MENU_EVENT;
68
CD_APPLET_UNREGISTER_FOR_CLICK_EVENT;
69
CD_APPLET_UNREGISTER_FOR_MIDDLE_CLICK_EVENT;
70
CD_APPLET_UNREGISTER_FOR_BUILD_MENU_EVENT;
74
CD_APPLET_RELOAD_BEGIN
75
//\_______________ On recharge les donnees qui ont pu changer.
76
if (CD_APPLET_MY_CONFIG_CHANGED) {
78
//\________________ les icones ont pu changer, ainsi que l'inhibition.
79
CD_APPLET_DELETE_MY_ICONS_LIST;
81
if (cairo_dock_task_is_active (myData.pTask) && ! myConfig.bAutoReloadDecorator && ! myConfig.bAutoReloadCompiz) {
82
cairo_dock_stop_task (myData.pTask);
83
CD_APPLET_SET_USER_IMAGE_ON_MY_ICON (myConfig.cUserImage[COMPIZ_DEFAULT], "default.svg");
85
else if (! cairo_dock_task_is_active (myData.pTask) && (myConfig.bAutoReloadDecorator || myConfig.bAutoReloadCompiz)) {
86
myData.iCompizIcon = -1;
87
myData.bDecoratorRestarted = FALSE;
88
if (! myConfig.forceConfig) // on fait comme si c'est nous qui l'avons mis dans l'etat actuel.
89
myData.bCompizRestarted = TRUE;
91
cairo_dock_launch_task (myData.pTask);
94
if (cairo_dock_task_is_active (myData.pTask))
95
myData.iCompizIcon = -1;
97
CD_APPLET_SET_USER_IMAGE_ON_MY_ICON (myConfig.cUserImage[COMPIZ_DEFAULT], "default.svg");
100
cd_compiz_build_icons ();