2
* Modules headers for Cairo-Dock
2
* This file is a part of the Cairo-Dock project
4
* Copyright : (C) 2009 by Fabrice Rey
5
* E-mail : fabounet@users.berlios.de
4
* Copyright : (C) see the 'copyright' file.
5
* E-mail : see the 'copyright' file.
7
7
* This program is free software; you can redistribute it and/or
8
8
* modify it under the terms of the GNU General Public License
13
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
15
* GNU General Public License for more details.
16
* http://www.gnu.org/licenses/licenses.html#GPL
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/>.
19
21
#ifndef __CAIRO_DOCK_MODULES__
20
22
#define __CAIRO_DOCK_MODULES__
30
32
*@file cairo-dock-modules.h This class defines and handles the external and internal modules of Cairo-Dock.
31
34
* A module has an interface and a visit card :
32
35
* - the visit card allows it to define itself (name, category, default icon, etc)
33
36
* - the interface defines the entry points for init, stop, reload, read config, and reset datas.
34
38
* Modules can be instanciated several times; each time they are, an instance is created. This instance will hold all the data used by the module's functions : the icon and its container, the config structure and its conf file, the data structure and a slot to plug datas into containers and icons. All these parameters are optionnal; a module that has an icon is also called an applet.
35
40
* Internal modules are just simplified version of modules, and are used internally by Cairo-Dock. As a special feature, a module can bind itself to an internal module, if its purpose is to complete it.
44
49
CAIRO_DOCK_CATEGORY_APPLET_CONTROLER,
45
50
CAIRO_DOCK_CATEGORY_PLUG_IN,
46
51
CAIRO_DOCK_NB_CATEGORY
47
} CairoDockPluginCategory;
52
} CairoDockModuleCategory;
48
53
#define CAIRO_DOCK_CATEGORY_DESKTOP CAIRO_DOCK_CATEGORY_APPLET_DESKTOP
49
54
#define CAIRO_DOCK_CATEGORY_ACCESSORY CAIRO_DOCK_CATEGORY_APPLET_ACCESSORY
50
55
#define CAIRO_DOCK_CATEGORY_CONTROLER CAIRO_DOCK_CATEGORY_APPLET_CONTROLER
52
57
/// Definition of the visit card of a module.
53
58
struct _CairoDockVisitCard {
54
59
/// nom du module qui servira a l'identifier.
60
const gchar *cModuleName;
56
61
/// numero de version majeure de cairo-dock necessaire au bon fonctionnement du module.
57
62
short iMajorVersionNeeded;
58
63
/// numero de version mineure de cairo-dock necessaire au bon fonctionnement du module.
60
65
/// numero de version micro de cairo-dock necessaire au bon fonctionnement du module.
61
66
short iMicroVersionNeeded;
62
67
/// chemin d'une image de previsualisation.
63
gchar *cPreviewFilePath;
68
const gchar *cPreviewFilePath;
64
69
/// Nom du domaine pour la traduction du module par 'gettext'.
65
gchar *cGettextDomain;
70
const gchar *cGettextDomain;
66
71
/// Version du dock pour laquelle a ete compilee le module.
67
gchar *cDockVersionOnCompilation;
72
const gchar *cDockVersionOnCompilation;
68
73
/// version courante du module.
69
gchar *cModuleVersion;
74
const gchar *cModuleVersion;
70
75
/// repertoire du plug-in cote utilisateur.
76
const gchar *cUserDataDir;
72
77
/// repertoire d'installation du plug-in.
78
const gchar *cShareDataDir;
74
79
/// nom de son fichier de conf.
80
const gchar *cConfFileName;
76
81
/// categorie de l'applet.
77
CairoDockPluginCategory iCategory;
82
CairoDockModuleCategory iCategory;
78
83
/// chemin d'une image pour l'icone du module dans le panneau de conf du dock.
84
const gchar *cIconFilePath;
80
85
/// taille de la structure contenant la config du module.
81
86
gint iSizeOfConfig;
82
87
/// taille de la structure contenant les donnees du module.
84
89
/// VRAI ssi le plug-in peut etre instancie plusiers fois.
85
90
gboolean bMultiInstance;
86
91
/// description et mode d'emploi succint.
92
const gchar *cDescription;
90
95
/// nom d'un module interne auquel ce module se rattache, ou NULL si aucun.
91
96
const gchar *cInternalModule;
92
97
/// octets reserves pour preserver la compatibilite binaire lors de futurs ajouts sur l'interface entre plug-ins et dock.
108
113
/// Definition of an instance of a module.
109
114
struct _CairoDockModuleInstance {
115
/// the module this instance represents.
110
116
CairoDockModule *pModule;
117
/// conf file of the instance.
111
118
gchar *cConfFilePath;
119
/// TRUE if the instance can be detached from docks (desklet mode).
112
120
gboolean bCanDetach;
121
/// the icon holding the instance.
123
/// container of the icon.
114
124
CairoContainer *pContainer;
125
/// this field repeats the 'pContainer' field if the container is a dock, and is NULL otherwise.
115
126
CairoDock *pDock;
127
/// this field repeats the 'pContainer' field if the container is a desklet, and is NULL otherwise.
116
128
CairoDesklet *pDesklet;
129
/// a drawing context on the icon.
117
130
cairo_t *pDrawContext;
131
/// a unique ID to insert external data on icons and containers.
119
/**gpointer *myConfig;
133
/*gpointer *myConfig;
120
134
gpointer *myData;*/
123
/// Fill the visit card and the interface of a module.
137
/// Pre-init function of a module. Fills the visit card and the interface of a module.
124
138
typedef gboolean (* CairoDockModulePreInit) (CairoDockVisitCard *pVisitCard, CairoDockModuleInterface *pInterface);
126
140
/// Definition of an external module.
127
141
struct _CairoDockModule {
142
/// path to the .so file.
129
143
gchar *cSoFilePath;
130
/// structure du module, contenant les pointeurs vers les fonctions du module.
144
/// internal structure of the .so file, containing pointers to the module's functions.
131
145
GModule *pModule;
132
/// fonctions d'interface du module.
146
/// interface of the module.
133
147
CairoDockModuleInterface *pInterface;
134
/// carte de visite du module.
148
/// visit card of the module.
135
149
CairoDockVisitCard *pVisitCard;
136
/// chemin du fichier de conf du module.
150
/// conf file of the module.
137
151
gchar *cConfFilePath;
138
/// TRUE si le module est actif (c'est-a-dire utilise).
140
/// VRAI ssi l'appet est prevue pour pouvoir se detacher.
152
/// TRUE if the appet can be detached from a dock (desklet mode).
141
153
gboolean bCanDetach;
142
/// le container dans lequel va se charger le module, ou NULL.
143
///CairoContainer *pContainer;
144
/// Heure de derniere (re)activation du module.
154
/// last time the module was (re)activated.
145
155
gdouble fLastLoadingTime;
146
/// Liste d'instance du plug-in.
156
/// List of instances of the module.
147
157
GList *pInstancesList;
165
175
typedef gboolean (* CairoDockInternalModuleGetConfigFunc) (GKeyFile *pKeyFile, CairoInternalModuleConfigPtr *pConfig);
166
176
typedef void (* CairoDockInternalModuleResetConfigFunc) (CairoInternalModuleConfigPtr *pConfig);
167
177
typedef void (* CairoDockInternalModuleResetDataFunc) (CairoInternalModuleDataPtr *pData);
168
/// Definition of an internal module.
169
178
struct _CairoDockInternalModule {
170
179
//\_____________ Carte de visite.
171
180
const gchar *cModuleName;
172
181
const gchar *cDescription;
173
182
const gchar *cIcon;
174
183
const gchar *cTitle;
175
CairoDockPluginCategory iCategory;
184
CairoDockModuleCategory iCategory;
176
185
gint iSizeOfConfig;
177
186
gint iSizeOfData;
178
187
const gchar **cDependencies; // NULL terminated.
207
216
CairoDockModule * cairo_dock_load_module (gchar *cSoFilePath, GError **erreur);
209
/** Load all th emodules of a given folder.
218
void cairo_dock_load_manual_module (CairoDockModule *pModule);
220
/** Load all the modules of a given folder.
210
221
*@param cModuleDirPath path to the a folder containing .so files.
211
222
*@param erreur error set if something bad happens.
248
259
void cairo_dock_deactivate_all_modules (void);
250
void cairo_dock_activate_module_and_load (gchar *cModuleName);
261
void cairo_dock_activate_module_and_load (const gchar *cModuleName);
251
262
void cairo_dock_deactivate_module_instance_and_unload (CairoDockModuleInstance *pInstance);
252
263
void cairo_dock_deactivate_module_and_unload (const gchar *cModuleName);
268
279
gchar *cairo_dock_list_active_modules (void);
269
280
void cairo_dock_update_conf_file_with_active_modules (void);
272
int cairo_dock_get_nb_modules (void);
274
282
void cairo_dock_update_module_instance_order (CairoDockModuleInstance *pModuleInstance, double fOrder);
277
285
CairoDockModuleInstance *cairo_dock_instanciate_module (CairoDockModule *pModule, gchar *cConfFilePah);
278
286
void cairo_dock_free_module_instance (CairoDockModuleInstance *pInstance);
287
void cairo_dock_unregister_module (const gchar *cModuleName);
279
288
void cairo_dock_stop_module_instance (CairoDockModuleInstance *pInstance);
280
289
void cairo_dock_deinstanciate_module (CairoDockModuleInstance *pInstance);