~ubuntu-branches/ubuntu/oneiric/cairo-dock/oneiric-201106091216

« back to all changes in this revision

Viewing changes to src/cairo-dock-modules.h

  • Committer: Bazaar Package Importer
  • Author(s): Julien Lavergne, Matthieu Baerts (matttbe), Julien Lavergne
  • Date: 2009-10-04 16:33:52 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20091004163352-ttbbjfmpb8uzl8j4
Tags: 2.0.9-0ubuntu1
[ Matthieu Baerts (matttbe) ]
* New Upstream Version. (LP: #435587)
* Added apport hook in debian/apport
 - Add debian/apport
 - debian/cairo-dock-core.install: Added debian/apport/cairo-dock.py
* Use .desktop provided by upstream
 - Removed debian/*.desktop
 - debian/cairo-dock-core.install: install upstream desktop files. 

[ Julien Lavergne ]
* Adjust debian/changelog with Daniel Holbach suggestions.
* debian/patches/01_rename_cairo-dock-package-theme.patch: drop, 
  merged upstream.
* debian/patches/01-desktop-file-category.patch:
 - Remove Encoding field and set category to Utility.
* debian/patches/02-merge-changelog.patch:
 - Merge ChangeLog and ChangeLog-2.0.9.
* debian/apport: Remove commands with grep, python doesn't like it.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/**
2
 
* Modules headers for Cairo-Dock
 
2
* This file is a part of the Cairo-Dock project
3
3
*
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.
6
6
*
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/>.
17
18
*/
18
19
 
 
20
 
19
21
#ifndef __CAIRO_DOCK_MODULES__
20
22
#define  __CAIRO_DOCK_MODULES__
21
23
 
28
30
 
29
31
/**
30
32
*@file cairo-dock-modules.h This class defines and handles the external and internal modules of Cairo-Dock.
 
33
*
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.
 
37
*
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.
 
39
*
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.
36
41
*/
37
42
 
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.
55
 
        gchar *cModuleName;
 
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.
71
 
        gchar *cUserDataDir;
 
76
        const gchar *cUserDataDir;
72
77
        /// repertoire d'installation du plug-in.
73
 
        gchar *cShareDataDir;
 
78
        const gchar *cShareDataDir;
74
79
        /// nom de son fichier de conf.
75
 
        gchar *cConfFileName;
 
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.
79
 
        gchar *cIconFilePath;
 
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.
87
 
        gchar *cDescription;
 
92
        const gchar *cDescription;
88
93
        /// auteur/pseudo
89
 
        gchar *cAuthor;
 
94
        const gchar *cAuthor;
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.
107
112
 
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.
113
122
        Icon *pIcon;
 
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.
118
132
        gint iSlotID;
119
 
        /**gpointer *myConfig;
 
133
        /*gpointer *myConfig;
120
134
        gpointer *myData;*/
121
135
};
122
136
 
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);
125
139
 
126
140
/// Definition of an external module.
127
141
struct _CairoDockModule {
128
 
        /// chemin du .so
 
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).
139
 
        ///gboolean bActive;
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;
148
158
};
149
159
 
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.
206
215
*/
207
216
CairoDockModule * cairo_dock_load_module (gchar *cSoFilePath, GError **erreur);
208
217
 
209
 
/** Load all th emodules of a given folder.
 
218
void cairo_dock_load_manual_module (CairoDockModule *pModule);
 
219
 
 
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.
212
223
*/
247
258
 
248
259
void cairo_dock_deactivate_all_modules (void);
249
260
 
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);
253
264
 
268
279
gchar *cairo_dock_list_active_modules (void);
269
280
void cairo_dock_update_conf_file_with_active_modules (void);
270
281
 
271
 
 
272
 
int cairo_dock_get_nb_modules (void);
273
 
 
274
282
void cairo_dock_update_module_instance_order (CairoDockModuleInstance *pModuleInstance, double fOrder);
275
283
 
276
284
 
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);
281
290
 
315
324
 
316
325
#define cairo_dock_module_is_auto_loaded(pModule) (pModule->pInterface->initModule == NULL || pModule->pInterface->stopModule == NULL || pModule->pVisitCard->cInternalModule != NULL)
317
326
 
 
327
int cairo_dock_get_nb_modules (void);
318
328
 
319
329
G_END_DECLS
320
330
#endif