~ubuntu-branches/ubuntu/oneiric/cairo-dock-plug-ins/oneiric-updates

« back to all changes in this revision

Viewing changes to compiz-icon/src/applet-init.c

  • Committer: Kees Cook
  • Date: 2011-08-11 23:17:39 UTC
  • mfrom: (20.1.1 cairo-dock-plug-ins)
  • Revision ID: kees@outflux.net-20110811231739-cteedan51tmdg77v
Tags: 2.4.0~0beta2-0ubuntu1
releasing version 2.4.0~0beta2-0ubuntu1

Show diffs side-by-side

added added

removed removed

Lines of Context:
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 "stdlib.h"
21
 
 
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"
28
 
 
29
 
#define CD_COMPIZ_CHECK_TIME 4
30
 
 
31
 
CD_APPLET_DEFINITION (N_("compiz-icon"),
32
 
        1, 6, 2,
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)")
39
 
 
40
 
 
41
 
CD_APPLET_INIT_BEGIN
42
 
        cd_compiz_build_icons ();
43
 
        
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;
49
 
                
50
 
                myData.pTask = cairo_dock_new_task (CD_COMPIZ_CHECK_TIME,
51
 
                        (CairoDockGetDataAsyncFunc) cd_compiz_read_data,
52
 
                        (CairoDockUpdateSyncFunc) cd_compiz_update_from_data,
53
 
                        myApplet);
54
 
                cairo_dock_launch_task (myData.pTask);
55
 
        }
56
 
        else {
57
 
                CD_APPLET_SET_USER_IMAGE_ON_MY_ICON (myConfig.cUserImage[COMPIZ_DEFAULT], "default.svg");
58
 
        }
59
 
        
60
 
        CD_APPLET_REGISTER_FOR_CLICK_EVENT;
61
 
        CD_APPLET_REGISTER_FOR_MIDDLE_CLICK_EVENT;
62
 
        CD_APPLET_REGISTER_FOR_BUILD_MENU_EVENT;
63
 
CD_APPLET_INIT_END
64
 
 
65
 
 
66
 
CD_APPLET_STOP_BEGIN
67
 
        
68
 
        CD_APPLET_UNREGISTER_FOR_CLICK_EVENT;
69
 
        CD_APPLET_UNREGISTER_FOR_MIDDLE_CLICK_EVENT;
70
 
        CD_APPLET_UNREGISTER_FOR_BUILD_MENU_EVENT;
71
 
CD_APPLET_STOP_END
72
 
 
73
 
 
74
 
CD_APPLET_RELOAD_BEGIN
75
 
        //\_______________ On recharge les donnees qui ont pu changer.
76
 
        if (CD_APPLET_MY_CONFIG_CHANGED) {
77
 
                
78
 
                //\________________ les icones ont pu changer, ainsi que l'inhibition.
79
 
                CD_APPLET_DELETE_MY_ICONS_LIST;
80
 
                
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");
84
 
                }
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;
90
 
                        
91
 
                        cairo_dock_launch_task (myData.pTask);
92
 
                }
93
 
                else {
94
 
                        if (cairo_dock_task_is_active (myData.pTask))
95
 
                                myData.iCompizIcon = -1;
96
 
                        else {
97
 
                                CD_APPLET_SET_USER_IMAGE_ON_MY_ICON (myConfig.cUserImage[COMPIZ_DEFAULT], "default.svg");
98
 
                        }
99
 
                }
100
 
                cd_compiz_build_icons ();
101
 
                
102
 
        }
103
 
CD_APPLET_RELOAD_END