~cairo-dock-team/ubuntu/oneiric/cairo-dock/2.3.0-3

« back to all changes in this revision

Viewing changes to src/gldit/cairo-dock-applet-single-instance.h

  • Committer: Bazaar Package Importer
  • Author(s): Matthieu Baerts (matttbe)
  • Date: 2010-08-09 23:26:12 UTC
  • mto: This revision was merged to the branch mainline in revision 13.
  • Revision ID: james.westby@ubuntu.com-20100809232612-pocdxliaxjdetm37
Tags: upstream-2.2.0~0beta4
ImportĀ upstreamĀ versionĀ 2.2.0~0beta4

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
 
 
21
#ifndef __CAIRO_DOCK_APPLET_SINGLE_INSTANCE__
 
22
#define  __CAIRO_DOCK_APPLET_SINGLE_INSTANCE__
 
23
 
 
24
#define myDrawContext myApplet->pDrawContext
 
25
 
 
26
#define CD_APPLET_DEFINE_BEGIN(cName, iMajorVersion, iMinorVersion, iMicroVersion, iAppletCategory, cDescription, cAuthor) \
 
27
Icon *myIcon; \
 
28
CairoContainer *myContainer; \
 
29
CairoDock *myDock; \
 
30
CairoDesklet *myDesklet; \
 
31
AppletConfig *myConfigPtr = NULL; \
 
32
AppletData *myDataPtr = NULL; \
 
33
CairoDockModuleInstance *myApplet = NULL; \
 
34
CD_APPLET_DEFINE_ALL_BEGIN (cName, iMajorVersion, iMinorVersion, iMicroVersion, iAppletCategory, cDescription, cAuthor) \
 
35
pVisitCard->bMultiInstance = FALSE;
 
36
 
 
37
#define CD_APPLET_INIT_BEGIN \
 
38
CD_APPLET_INIT_ALL_BEGIN(pApplet) \
 
39
myApplet = pApplet; \
 
40
myIcon = myApplet->pIcon; \
 
41
myContainer = myApplet->pContainer; \
 
42
myDock = myApplet->pDock; \
 
43
myDesklet = myApplet->pDesklet;
 
44
 
 
45
#define myConfig (* myConfigPtr)
 
46
#define myData (* myDataPtr)
 
47
 
 
48
 
 
49
#define CD_APPLET_RELOAD_BEGIN \
 
50
        CD_APPLET_RELOAD_ALL_BEGIN \
 
51
        myContainer = myApplet->pContainer; \
 
52
        myDock = myApplet->pDock; \
 
53
        myDesklet = myApplet->pDesklet; \
 
54
 
 
55
 
 
56
#define CD_APPLET_RESET_DATA_END \
 
57
        myDock = NULL; \
 
58
        myContainer = NULL; \
 
59
        myIcon = NULL; \
 
60
        if (myDataPtr) memset (myDataPtr, 0, sizeof (AppletData)); \
 
61
        myDataPtr = NULL; \
 
62
        myDesklet = NULL; \
 
63
        myApplet = NULL; \
 
64
        CD_APPLET_RESET_DATA_ALL_END
 
65
 
 
66
 
 
67
#define CD_APPLET_RESET_CONFIG_BEGIN \
 
68
        CD_APPLET_RESET_CONFIG_ALL_BEGIN \
 
69
        if (myConfigPtr == NULL) \
 
70
                return ;
 
71
 
 
72
#define CD_APPLET_RESET_CONFIG_END \
 
73
        myConfigPtr = NULL; \
 
74
        CD_APPLET_RESET_CONFIG_ALL_END
 
75
 
 
76
#define CD_APPLET_GET_CONFIG_BEGIN \
 
77
        CD_APPLET_GET_CONFIG_ALL_BEGIN\
 
78
        if (myConfigPtr == NULL)\
 
79
                myConfigPtr = (((gpointer)myApplet)+sizeof(CairoDockModuleInstance));\
 
80
        if (myDataPtr == NULL)\
 
81
                myDataPtr = (((gpointer)myConfigPtr)+sizeof(AppletConfig));
 
82
 
 
83
 
 
84
extern Icon *myIcon;
 
85
extern CairoContainer *myContainer;
 
86
extern CairoDock *myDock;
 
87
extern CairoDesklet *myDesklet;
 
88
extern AppletConfig *myConfigPtr;
 
89
extern AppletData *myDataPtr;
 
90
extern CairoDockModuleInstance *myApplet;
 
91
 
 
92
#endif