~ubuntu-branches/ubuntu/quantal/compiz/quantal

« back to all changes in this revision

Viewing changes to compizconfig/libcompizconfig/include/ccs-backend.h

  • Committer: Sebastien Bacher
  • Date: 2012-08-23 15:45:49 UTC
  • mfrom: (3269.2.21 gsettings-transition)
  • Revision ID: seb128@ubuntu.com-20120823154549-llj2223vo54js0li
  - Restore the fix for avoiding re-entering the glib event loop and 
    crashing. (LP: #1036490)
  - Including rsvg-cairo.h is now deprecated. (LP: #1039482)
  - Add keybinding integration for gnome-control-center
  - Separate the configuration for the minimize and unminimize animations.
    (LP: #1036739)
  - Ignore mouse press and release if it does not happen inside of the expo
    screen. (LP: #1036542). 
  - Additional keys from metacity to convert to GSettings
  - Maximize vertically if pointer reaches top or bottom edges.
  - Explicitly depend on resize-options. (LP: #1039834)
  - Add some docstring warnings about using those classes directly.
  - Fix some memory management issues on the mock objects, namely:
    Make destructor functions virtual where appropriate, so that we can add 
    them to lists polymorphically. Support polymorphic ccs*Unref function.
    Also make some other necessary changes to libcompizconfig.
  - Detect if rsvg 2.36.2 is installed (LP: #1039843)
  - GSettings integration backend, created a testsuite for it. Refactors a 
    bunch of the backend code, adds appropriate testsuites and refactors 
    the integration code to make it more flexible. (LP: #1035261)
* Add support for disabling gconf schemas installation
  - However, not enabled because of gtk-window-decorator for now
* Add libcompizconfig_gsettings_backend.so
* Workaround to install xml files

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
#ifndef CCS_BACKEND_H
23
23
#define CCS_BACKEND_H
24
24
 
25
 
#include <ccs.h>
26
 
 
 
25
#include <ccs-object.h>
 
26
#include <ccs-string.h>
 
27
#include <ccs-list.h>
 
28
#include <ccs-setting-types.h>
 
29
 
 
30
COMPIZCONFIG_BEGIN_DECLS
 
31
 
 
32
typedef struct _CCSSetting        CCSSetting;
 
33
typedef struct _CCSPlugin         CCSPlugin;
 
34
typedef struct _CCSContext        CCSContext;
27
35
typedef struct _CCSBackend        CCSBackend;
28
 
typedef struct _CCSBackendVTable  CCSBackendVTable;
29
 
 
 
36
typedef struct _CCSBackendInfo    CCSBackendInfo;
 
37
typedef struct _CCSBackendPrivate CCSBackendPrivate;
 
38
typedef struct _CCSBackendInterface  CCSBackendInterface;
 
39
typedef struct _CCSIntegration    CCSIntegration;
 
40
 
 
41
typedef struct _CCSSettingValue CCSSettingValue;
 
42
typedef enum _CCSSettingType CCSSettingType;
 
43
 
 
44
typedef struct _CCSIntegratedSettingInfo CCSIntegratedSettingInfo;
 
45
typedef struct _CCSIntegratedSettingInfoInterface CCSIntegratedSettingInfoInterface;
 
46
 
 
47
typedef const char * (*CCSIntegratedSettingInfoPluginName) (CCSIntegratedSettingInfo *);
 
48
typedef const char * (*CCSIntegratedSettingInfoSettingName) (CCSIntegratedSettingInfo *);
 
49
typedef CCSSettingType (*CCSIntegratedSettingInfoGetType) (CCSIntegratedSettingInfo *);
 
50
typedef void (*CCSIntegratedSettingInfoFree) (CCSIntegratedSettingInfo *);
 
51
 
 
52
struct _CCSIntegratedSettingInfoInterface
 
53
{
 
54
    CCSIntegratedSettingInfoPluginName pluginName;
 
55
    CCSIntegratedSettingInfoSettingName settingName;
 
56
    CCSIntegratedSettingInfoGetType       getType;
 
57
    CCSIntegratedSettingInfoFree          free;
 
58
};
 
59
 
 
60
/**
 
61
 * @brief The _CCSIntegratedSettingInfo struct
 
62
 *
 
63
 * This interface represents some basic information about a DE
 
64
 * integrated setting, it cannot be operated upon itself
 
65
 */
 
66
struct _CCSIntegratedSettingInfo
 
67
{
 
68
    CCSObject object;
 
69
};
 
70
 
 
71
typedef struct _CCSIntegratedSetting CCSIntegratedSetting;
 
72
typedef struct _CCSIntegratedSettingInterface CCSIntegratedSettingInterface;
 
73
 
 
74
typedef CCSSettingValue * (*CCSIntegratedSettingReadValue) (CCSIntegratedSetting *, CCSSettingType);
 
75
typedef void (*CCSIntegratedSettingWriteValue) (CCSIntegratedSetting *, CCSSettingValue *, CCSSettingType);
 
76
typedef void (*CCSIntegratedSettingFree) (CCSIntegratedSetting *);
 
77
 
 
78
struct _CCSIntegratedSettingInterface
 
79
{
 
80
    CCSIntegratedSettingReadValue readValue;
 
81
    CCSIntegratedSettingWriteValue writeValue;
 
82
    CCSIntegratedSettingFree       free;
 
83
};
 
84
 
 
85
const char * ccsIntegratedSettingInfoPluginName (CCSIntegratedSettingInfo *);
 
86
const char * ccsIntegratedSettingInfoSettingName (CCSIntegratedSettingInfo *);
 
87
CCSSettingType ccsIntegratedSettingInfoGetType (CCSIntegratedSettingInfo *);
 
88
void ccsFreeIntegratedSettingInfo (CCSIntegratedSettingInfo *);
 
89
 
 
90
CCSREF_HDR (IntegratedSettingInfo, CCSIntegratedSettingInfo);
 
91
CCSLIST_HDR (IntegratedSettingInfo, CCSIntegratedSettingInfo);
 
92
 
 
93
unsigned int ccsCCSIntegratedSettingInfoInterfaceGetType ();
 
94
 
 
95
/**
 
96
 * @brief The _CCSIntegratedSetting struct
 
97
 *
 
98
 * A CCSIntegratedSetting represents an desktop environment setting which
 
99
 * we are "integrated" with - its functionality is more or less a subset
 
100
 * of CCSSetting, values can be written and read from it but not much else.
 
101
 */
 
102
struct _CCSIntegratedSetting
 
103
{
 
104
    CCSObject object;
 
105
};
 
106
 
 
107
CCSSettingValue * ccsIntegratedSettingReadValue(CCSIntegratedSetting *, CCSSettingType);
 
108
void ccsIntegratedSettingWriteValue (CCSIntegratedSetting *, CCSSettingValue *, CCSSettingType);
 
109
void ccsFreeIntegratedSetting (CCSIntegratedSetting *);
 
110
 
 
111
CCSREF_HDR (IntegratedSetting, CCSIntegratedSetting);
 
112
CCSLIST_HDR (IntegratedSetting, CCSIntegratedSetting);
 
113
 
 
114
unsigned int ccsCCSIntegratedSettingInterfaceGetType ();
 
115
 
 
116
/**
 
117
 * @brief ccsSharedIntegratedInfoSettingNew
 
118
 * @param pluginName Plugin name of the integrated setting
 
119
 * @param settingName Compiz name of the integrated setting
 
120
 * @param type A CCSSettingType
 
121
 * @param ai A CCSObjectAllocationInterface *
 
122
 * @return a new CCSIntegratedSettingInfo
 
123
 *
 
124
 * ccsSharedIntegratedSettingInfoNew () returns the most fundamental
 
125
 * implementation of a CCSIntegratedSettingInfo *, which is basic
 
126
 * information about it, the plugin name, setting name, and type.
 
127
 */
 
128
CCSIntegratedSettingInfo *
 
129
ccsSharedIntegratedSettingInfoNew (const char *pluginName,
 
130
                                   const char *settingName,
 
131
                                   CCSSettingType type,
 
132
                                   CCSObjectAllocationInterface *ai);
 
133
 
 
134
typedef struct _CCSIntegratedSettingsStorage CCSIntegratedSettingsStorage;
 
135
typedef struct _CCSIntegratedSettingsStorageInterface CCSIntegratedSettingsStorageInterface;
 
136
 
 
137
/**
 
138
 * A predicate definition to find a CCSIntegratedSetting in a
 
139
 * CCSIntegratedSettingStorage object. Returns true if the user
 
140
 * predicate matches. The void * is some user-specified data
 
141
 */
 
142
typedef Bool (*CCSIntegratedSettingsStorageFindPredicate) (CCSIntegratedSetting *, void *);
 
143
 
 
144
typedef CCSIntegratedSettingList (*CCSIntegratedSettingsStorageFindMatchingSettingsByPluginAndSettingName) (CCSIntegratedSettingsStorage *storage,
 
145
                                                                                                            const char *pluginName,
 
146
                                                                                                            const char *settingName);
 
147
typedef void (*CCSIntegratedSettingsStorageAddSetting) (CCSIntegratedSettingsStorage *storage,
 
148
                                                        CCSIntegratedSetting         *setting);
 
149
 
 
150
typedef CCSIntegratedSettingList (*CCSIntegratedSettingsStorageFindMatchingSettingsByPredicate) (CCSIntegratedSettingsStorage *storage,
 
151
                                                                                                 CCSIntegratedSettingsStorageFindPredicate pred,
 
152
                                                                                                 void                        *data);
 
153
 
 
154
typedef Bool (*CCSIntegratedSettingsStorageEmpty) (CCSIntegratedSettingsStorage *storage);
 
155
 
 
156
typedef void (*CCSIntegratedSettingsStorageFree) (CCSIntegratedSettingsStorage *storage);
 
157
 
 
158
struct _CCSIntegratedSettingsStorageInterface
 
159
{
 
160
    CCSIntegratedSettingsStorageFindMatchingSettingsByPredicate findMatchingSettingsByPredicate;
 
161
    CCSIntegratedSettingsStorageFindMatchingSettingsByPluginAndSettingName findMatchingSettingsByPluginAndSettingName;
 
162
    CCSIntegratedSettingsStorageAddSetting           addSetting;
 
163
    CCSIntegratedSettingsStorageEmpty                empty;
 
164
    CCSIntegratedSettingsStorageFree                 free;
 
165
};
 
166
 
 
167
/**
 
168
 * @brief The _CCSIntegratedSettingsStorage struct
 
169
 *
 
170
 * CCSIntegratedSettingsStorage represents a list of currently active integrated
 
171
 * DE settings. Access is restricted such that settings can only be added and
 
172
 * the list can only be searched by predicates.
 
173
 */
 
174
struct _CCSIntegratedSettingsStorage
 
175
{
 
176
    CCSObject object;
 
177
};
 
178
 
 
179
CCSREF_HDR (IntegratedSettingsStorage, CCSIntegratedSettingsStorage);
 
180
 
 
181
/**
 
182
 * @brief ccsIntegratedSettingsStorageFindMatchingSettingsByPredicate
 
183
 * @param storage
 
184
 * @param pred
 
185
 * @param data
 
186
 * @return a CCSIntegratedSettingList of CCSIntegratedSetting objects
 
187
 * matching CCSIntegratedSettingsStorageFindPredicate
 
188
 */
 
189
CCSIntegratedSettingList
 
190
ccsIntegratedSettingsStorageFindMatchingSettingsByPredicate (CCSIntegratedSettingsStorage *storage,
 
191
                                                             CCSIntegratedSettingsStorageFindPredicate pred,
 
192
                                                             void                         *data);
 
193
 
 
194
/**
 
195
 * @brief ccsIntegratedSettingsStorageFindMatchingSettingsByPluginAndSettingName
 
196
 * @param storage
 
197
 * @param pluginName
 
198
 * @param settingName
 
199
 * @return a CCSIntegratedSettingList of CCSIntegratedSetting objects
 
200
 * with the specified plugin and setting names.
 
201
 */
 
202
CCSIntegratedSettingList
 
203
ccsIntegratedSettingsStorageFindMatchingSettingsByPluginAndSettingName (CCSIntegratedSettingsStorage *storage,
 
204
                                                                        const char *pluginName,
 
205
                                                                        const char *settingName);
 
206
 
 
207
void
 
208
ccsIntegratedSettingsStorageAddSetting (CCSIntegratedSettingsStorage *storage,
 
209
                                        CCSIntegratedSetting        *setting);
 
210
 
 
211
Bool
 
212
ccsIntegratedSettingsStorageEmpty (CCSIntegratedSettingsStorage *storage);
 
213
 
 
214
void
 
215
ccsFreeIntegratedSettingsStorage (CCSIntegratedSettingsStorage *storage);
 
216
 
 
217
unsigned int ccsCCSIntegratedSettingsStorageInterfaceGetType ();
 
218
 
 
219
CCSIntegratedSettingsStorage *
 
220
ccsIntegratedSettingsStorageDefaultImplNew (CCSObjectAllocationInterface *ai);
 
221
 
 
222
typedef struct _CCSIntegratedSettingFactory CCSIntegratedSettingFactory;
 
223
typedef struct _CCSIntegratedSettingFactoryInterface CCSIntegratedSettingFactoryInterface;
 
224
 
 
225
typedef CCSIntegratedSetting * (*CCSIntegratedSettingFactoryCreateIntegratedSettingForCCSSettingNameAndType) (CCSIntegratedSettingFactory *factory,
 
226
                                                                                                              CCSIntegration              *integration,
 
227
                                                                                                              const char                  *pluginName,
 
228
                                                                                                              const char                  *settingName,
 
229
                                                                                                              CCSSettingType              type);
 
230
 
 
231
typedef void (*CCSIntegratedSettingFactoryFree) (CCSIntegratedSettingFactory *);
 
232
 
 
233
struct _CCSIntegratedSettingFactoryInterface
 
234
{
 
235
    CCSIntegratedSettingFactoryCreateIntegratedSettingForCCSSettingNameAndType createIntegratedSettingForCCSSettingNameAndType;
 
236
    CCSIntegratedSettingFactoryFree free;
 
237
};
 
238
 
 
239
/**
 
240
 * @brief The _CCSIntegratedSettingFactory struct
 
241
 *
 
242
 * CCSIntegratedSettingFactory is an interface for creating a CCSIntegratedSetting
 
243
 * for a particular integration backend when appropriate. It doesn't make sense to load
 
244
 * such information on startup until we need it as we might never write to these settings
 
245
 * and loading them is an expensive process. In addition, we need to allow a place
 
246
 * for testing code to prevent CCSIntegratedSetting objects from pulling
 
247
 * in dependencies that they shouldn't.
 
248
 */
 
249
struct _CCSIntegratedSettingFactory
 
250
{
 
251
    CCSObject object;
 
252
};
 
253
 
 
254
CCSREF_HDR (IntegratedSettingFactory, CCSIntegratedSettingFactory);
 
255
 
 
256
unsigned int ccsCCSIntegratedSettingFactoryInterfaceGetType ();
 
257
 
 
258
CCSIntegratedSetting *
 
259
ccsIntegratedSettingFactoryCreateIntegratedSettingForCCSSettingNameAndType (CCSIntegratedSettingFactory *factory,
 
260
                                                                            CCSIntegration              *integration,
 
261
                                                                            const char                  *pluginName,
 
262
                                                                            const char                  *settingName,
 
263
                                                                            CCSSettingType              type);
 
264
 
 
265
void
 
266
ccsFreeIntegratedSettingFactory (CCSIntegratedSettingFactory *factory);
 
267
 
 
268
typedef struct _CCSIntegration CCSIntegration;
 
269
typedef struct _CCSIntegrationInterface CCSIntegrationInterface;
 
270
 
 
271
typedef CCSIntegratedSetting * (*CCSIntegrationGetIntegratedSetting) (CCSIntegration *integration,
 
272
                                                                      const char *pluginName,
 
273
                                                                      const char *settingName);
 
274
typedef Bool (*CCSIntegrationReadOptionIntoSetting) (CCSIntegration *integration,
 
275
                                                     CCSContext     *context,
 
276
                                                     CCSSetting     *setting,
 
277
                                                     CCSIntegratedSetting *integratedSetting);
 
278
typedef void (*CCSIntegrationWriteSettingIntoOption) (CCSIntegration *integration,
 
279
                                                      CCSContext     *context,
 
280
                                                      CCSSetting     *setting,
 
281
                                                      CCSIntegratedSetting *integratedSetting);
 
282
typedef void (*CCSIntegrationUpdateIntegratedSettings) (CCSIntegration *integration,
 
283
                                                        CCSContext *context,
 
284
                                                        CCSIntegratedSettingList integratedSettings);
 
285
typedef void (*CCSIntegrationDisallowIntegratedWrites) (CCSIntegration *integration);
 
286
typedef void (*CCSIntegrationAllowIntegratedWrites) (CCSIntegration *integration);
 
287
typedef void (*CCSFreeIntegrationBackend) (CCSIntegration *integration);
 
288
 
 
289
struct _CCSIntegrationInterface
 
290
{
 
291
    CCSIntegrationGetIntegratedSetting getIntegratedSetting;
 
292
    CCSIntegrationReadOptionIntoSetting readOptionIntoSetting;
 
293
    CCSIntegrationWriteSettingIntoOption writeSettingIntoOption;
 
294
    CCSIntegrationUpdateIntegratedSettings updateIntegratedSettings;
 
295
    CCSIntegrationDisallowIntegratedWrites disallowIntegratedWrites;
 
296
    CCSIntegrationAllowIntegratedWrites allowIntegratedWrites;
 
297
    CCSFreeIntegrationBackend                   freeIntegrationBackend;
 
298
};
 
299
 
 
300
/**
 
301
 * @brief The _CCSIntegration struct
 
302
 *
 
303
 * An object that represents integration with a desktop environment. Generally
 
304
 * these objects store a list of hardcoded settings that can be retrieved using
 
305
 * ccsIntegrationGetIntegratedOptionIndex and then written to and read
 
306
 * from using the readOptionIntoSetting and writeOptionIntoSetting.
 
307
 */
 
308
struct _CCSIntegration
 
309
{
 
310
    CCSObject object;
 
311
};
 
312
 
 
313
CCSREF_HDR (Integration, CCSIntegration)
 
314
 
 
315
unsigned int ccsCCSIntegrationInterfaceGetType ();
 
316
 
 
317
CCSIntegratedSetting * ccsIntegrationGetIntegratedSetting (CCSIntegration *integration,
 
318
                                                           const char *pluginName,
 
319
                                                           const char *settingName);
 
320
Bool ccsIntegrationReadOptionIntoSetting (CCSIntegration *integration,
 
321
                                          CCSContext              *context,
 
322
                                          CCSSetting              *setting,
 
323
                                          CCSIntegratedSetting    *integratedSetting);
 
324
void ccsIntegrationWriteSettingIntoOption (CCSIntegration *integration,
 
325
                                           CCSContext              *context,
 
326
                                           CCSSetting              *setting,
 
327
                                           CCSIntegratedSetting *integratedSetting);
 
328
 
 
329
void ccsIntegrationUpdateIntegratedSettings (CCSIntegration *integration,
 
330
                                             CCSContext     *context,
 
331
                                             CCSIntegratedSettingList integratedSettings);
 
332
 
 
333
void ccsIntegrationDisallowIntegratedWrites (CCSIntegration *integration);
 
334
void ccsIntegrationAllowIntegratedWrites (CCSIntegration *integration);
 
335
 
 
336
void ccsFreeIntegration (CCSIntegration *integration);
 
337
 
 
338
CCSIntegration *
 
339
ccsNullIntegrationBackendNew (CCSObjectAllocationInterface *ai);
 
340
 
 
341
/**
 
342
 * @brief CCSBackend
 
343
 *
 
344
 * This object represents CCSBackend directly in memory. It does
 
345
 * not represent the details that come with a loaded backend.
 
346
 *
 
347
 * Backends are capable of reading, writing and updating settings
 
348
 * from intergrated locations. Clients should check if these functions
 
349
 * are supported first as the function pointers are permitted to be NULL.
 
350
 */
30
351
struct _CCSBackend
31
352
{
32
 
    void             *dlhand;
33
 
    CCSBackendVTable *vTable;
34
 
};
35
 
 
36
 
typedef CCSBackendVTable * (*BackendGetInfoProc) (void);
37
 
 
38
 
typedef void (*CCSExecuteEventsFunc) (unsigned int flags);
39
 
 
40
 
typedef Bool (*CCSInitBackendFunc) (CCSContext * context);
41
 
typedef Bool (*CCSFiniBackendFunc) (CCSContext * context);
42
 
 
43
 
typedef Bool (*CCSContextReadInitFunc) (CCSContext * context);
44
 
typedef void (*CCSContextReadSettingFunc)
45
 
(CCSContext * context, CCSSetting * setting);
46
 
typedef void (*CCSContextReadDoneFunc) (CCSContext * context);
47
 
 
48
 
typedef Bool (*CCSContextWriteInitFunc) (CCSContext * context);
49
 
typedef void (*CCSContextWriteSettingFunc)
50
 
(CCSContext * context, CCSSetting * setting);
51
 
typedef void (*CCSContextWriteDoneFunc) (CCSContext * context);
52
 
 
53
 
typedef Bool (*CCSGetIsIntegratedFunc) (CCSSetting * setting);
54
 
typedef Bool (*CCSGetIsReadOnlyFunc) (CCSSetting * setting);
55
 
 
56
 
typedef CCSStringList (*CCSGetExistingProfilesFunc) (CCSContext * context);
57
 
typedef Bool (*CCSDeleteProfileFunc) (CCSContext * context, char * name);
58
 
 
59
 
struct _CCSBackendVTable
60
 
{
61
 
    char *name;
62
 
    char *shortDesc;
63
 
    char *longDesc;
64
 
    Bool integrationSupport;
65
 
    Bool profileSupport;
 
353
    CCSObject        object;
 
354
};
 
355
 
 
356
struct _CCSBackendInfo
 
357
{
 
358
    const char *name;              /* name of the backend */
 
359
    const char *shortDesc;         /* backend's short description */
 
360
    const char *longDesc;          /* backend's long description */
 
361
    Bool integrationSupport; /* does the backend support DE integration? */
 
362
    Bool profileSupport;     /* does the backend support profiles? */
 
363
    unsigned int refCount;   /* reference count */
 
364
};
 
365
 
 
366
typedef CCSBackendInterface * (*BackendGetInfoProc) (void);
 
367
 
 
368
typedef void (*CCSBackendExecuteEventsFunc) (CCSBackend *backend, unsigned int flags);
 
369
 
 
370
typedef Bool (*CCSBackendInitFunc) (CCSBackend *, CCSContext * context);
 
371
typedef Bool (*CCSBackendFiniFunc) (CCSBackend *);
 
372
 
 
373
typedef Bool (*CCSBackendReadInitFunc) (CCSBackend *, CCSContext * context);
 
374
typedef void (*CCSBackendReadSettingFunc)
 
375
(CCSBackend *, CCSContext * context, CCSSetting * setting);
 
376
typedef void (*CCSBackendReadDoneFunc) (CCSBackend *backend, CCSContext * context);
 
377
 
 
378
typedef Bool (*CCSBackendWriteInitFunc) (CCSBackend *backend, CCSContext * context);
 
379
typedef void (*CCSBackendWriteSettingFunc)
 
380
(CCSBackend *, CCSContext * context, CCSSetting * setting);
 
381
typedef void (*CCSBackendWriteDoneFunc) (CCSBackend *, CCSContext * context);
 
382
 
 
383
typedef void (*CCSBackendUpdateFunc) (CCSBackend *, CCSContext *, CCSPlugin *, CCSSetting *);
 
384
 
 
385
typedef Bool (*CCSBackendGetSettingIsIntegratedFunc) (CCSBackend *, CCSSetting * setting);
 
386
typedef Bool (*CCSBackendGetSettingIsReadOnlyFunc) (CCSBackend *, CCSSetting * setting);
 
387
 
 
388
typedef CCSStringList (*CCSBackendGetExistingProfilesFunc) (CCSBackend *, CCSContext * context);
 
389
typedef Bool (*CCSBackendDeleteProfileFunc) (CCSBackend *, CCSContext * context, char * name);
 
390
 
 
391
typedef void (*CCSBackendSetIntegration) (CCSBackend *, CCSIntegration *);
 
392
 
 
393
typedef const CCSBackendInfo * (*CCSBackendGetInfoFunc) (CCSBackend *);
 
394
 
 
395
struct _CCSBackendInterface
 
396
{
 
397
    CCSBackendGetInfoFunc      backendGetInfo;
66
398
 
67
399
    /* something like a event loop call for the backend,
68
400
       so it can check for file changes (gconf changes in the gconf backend)
69
401
       no need for reload settings signals anymore */
70
 
    CCSExecuteEventsFunc executeEvents;
71
 
 
72
 
    CCSInitBackendFunc         backendInit;
73
 
    CCSFiniBackendFunc         backendFini;
74
 
 
75
 
    CCSContextReadInitFunc     readInit;
76
 
    CCSContextReadSettingFunc  readSetting;
77
 
    CCSContextReadDoneFunc     readDone;
78
 
 
79
 
    CCSContextWriteInitFunc    writeInit;
80
 
    CCSContextWriteSettingFunc writeSetting;
81
 
    CCSContextWriteDoneFunc    writeDone;
82
 
 
83
 
 
84
 
    CCSGetIsIntegratedFunc     getSettingIsIntegrated;
85
 
    CCSGetIsReadOnlyFunc       getSettingIsReadOnly;
86
 
 
87
 
    CCSGetExistingProfilesFunc getExistingProfiles;
88
 
    CCSDeleteProfileFunc       deleteProfile;
89
 
};
90
 
 
91
 
CCSBackendVTable* getBackendInfo (void);
 
402
    CCSBackendExecuteEventsFunc executeEvents;
 
403
 
 
404
    CCSBackendInitFunc         backendInit;
 
405
    CCSBackendFiniFunc         backendFini;
 
406
 
 
407
    CCSBackendReadInitFunc     readInit;
 
408
    CCSBackendReadSettingFunc  readSetting;
 
409
    CCSBackendReadDoneFunc     readDone;
 
410
 
 
411
    CCSBackendWriteInitFunc    writeInit;
 
412
    CCSBackendWriteSettingFunc writeSetting;
 
413
    CCSBackendWriteDoneFunc    writeDone;
 
414
 
 
415
    CCSBackendUpdateFunc       updateSetting;
 
416
 
 
417
    CCSBackendGetSettingIsIntegratedFunc     getSettingIsIntegrated;
 
418
    CCSBackendGetSettingIsReadOnlyFunc       getSettingIsReadOnly;
 
419
 
 
420
    CCSBackendGetExistingProfilesFunc getExistingProfiles;
 
421
    CCSBackendDeleteProfileFunc       deleteProfile;
 
422
    CCSBackendSetIntegration          setIntegration;
 
423
};
 
424
 
 
425
unsigned int ccsCCSBackendInterfaceGetType ();
 
426
 
 
427
/**
 
428
 * @brief ccsBackendGetInfo
 
429
 * @param backend a CCSBackend *
 
430
 * @return a const CCSBackendInfo * for this backend
 
431
 *
 
432
 * This function returns some basic info about this backend, what its
 
433
 * name is, what it suppoirts etc
 
434
 */
 
435
const CCSBackendInfo * ccsBackendGetInfo (CCSBackend *backend);
 
436
 
 
437
/**
 
438
 * @brief ccsBackendExecuteEvents
 
439
 * @param backend a CCSBackend *
 
440
 * @param flags ProcessEventsGlibMainLoopMask or 0
 
441
 *
 
442
 * something like a event loop call for the backend,
 
443
 * so it can check for file changes (gconf changes in the gconf backend)
 
444
 */
 
445
void ccsBackendExecuteEvents (CCSBackend *backend, unsigned int flags);
 
446
 
 
447
/**
 
448
 * @brief ccsBackendInit
 
449
 * @param backend
 
450
 * @param context
 
451
 * @return
 
452
 *
 
453
 * Initializes a backend for a context
 
454
 */
 
455
Bool ccsBackendInit (CCSBackend *backend, CCSContext *context);
 
456
 
 
457
/**
 
458
 * @brief ccsBackendFini
 
459
 * @param backend
 
460
 * @param context
 
461
 * @return
 
462
 *
 
463
 * Cleans up the backend
 
464
 */
 
465
Bool ccsBackendFini (CCSBackend *backend);
 
466
Bool ccsBackendReadInit (CCSBackend *backend, CCSContext *context);
 
467
void ccsBackendReadSetting (CCSBackend *backend, CCSContext *context, CCSSetting *setting);
 
468
void ccsBackendReadDone (CCSBackend *backend, CCSContext *context);
 
469
Bool ccsBackendWriteInit (CCSBackend *backend, CCSContext *context);
 
470
void ccsBackendWriteSetting (CCSBackend *backend, CCSContext *context, CCSSetting *setting);
 
471
void ccsBackendWriteDone (CCSBackend *backend, CCSContext *context);
 
472
 
 
473
/**
 
474
 * @brief ccsBackendUpdateSetting
 
475
 * @param backend The backend on which the update should be processed
 
476
 * @param context The context on which the backend resides.
 
477
 * @param plugin The plugin for the setting
 
478
 * @param setting The setting itself.
 
479
 *
 
480
 * This causes the specified setting to be re-read from the configuration
 
481
 * database and re-written to any integrated keys. It should genrally
 
482
 * be called by calback functions which know that the value
 
483
 * has changed.
 
484
 */
 
485
void ccsBackendUpdateSetting (CCSBackend *backend, CCSContext *context, CCSPlugin *plugin, CCSSetting *setting);
 
486
Bool ccsBackendGetSettingIsIntegrated (CCSBackend *backend, CCSSetting *setting);
 
487
Bool ccsBackendGetSettingIsReadOnly (CCSBackend *backend, CCSSetting *setting);
 
488
 
 
489
/**
 
490
 * @brief ccsBackendGetExistingProfiles
 
491
 * @param backend
 
492
 * @param context
 
493
 * @return a CCSStringist of available profiles for this backend
 
494
 */
 
495
CCSStringList ccsBackendGetExistingProfiles (CCSBackend *backend, CCSContext *context);
 
496
Bool ccsBackendDeleteProfile (CCSBackend *backend, CCSContext *context, char *name);
 
497
void ccsBackendSetIntegration (CCSBackend *backend, CCSIntegration *integration);
 
498
void ccsFreeBackend (CCSBackend *backend);
 
499
 
 
500
typedef struct _CCSDynamicBackend         CCSDynamicBackend;
 
501
typedef struct _CCSDynamicBackendPrivate CCSDynamicBackendPrivate;
 
502
typedef struct _CCSDynamicBackendInterface  CCSDynamicBackendInterface;
 
503
typedef struct _CCSInterfaceTable         CCSInterfaceTable;
 
504
 
 
505
/**
 
506
 * @brief The _CCSDynamicBackend struct
 
507
 *
 
508
 * This object represents a CCSBackend loaded in memory as a dlopen
 
509
 * object. It implements the CCSBackend interface and provides an
 
510
 * interface of its own for managing the dynamic backend and checking
 
511
 * its capabilities.
 
512
 *
 
513
 * All function pointers are fully implemented and are safe to call
 
514
 */
 
515
struct _CCSDynamicBackend
 
516
{
 
517
    CCSObject object;
 
518
};
 
519
 
 
520
typedef const char * (*CCSDynamicBackendGetBackendName) (CCSDynamicBackend *);
 
521
typedef Bool (*CCSDynamicBackendSupportsRead) (CCSDynamicBackend *);
 
522
typedef Bool (*CCSDynamicBackendSupportsWrite) (CCSDynamicBackend *);
 
523
typedef Bool (*CCSDynamicBackendSupportsProfiles) (CCSDynamicBackend *);
 
524
typedef Bool (*CCSDynamicBackendSupportsIntegration) (CCSDynamicBackend *);
 
525
typedef CCSBackend * (*CCSDynamicBackendGetRawBackend) (CCSDynamicBackend *);
 
526
 
 
527
struct _CCSDynamicBackendInterface
 
528
{
 
529
    CCSDynamicBackendGetBackendName getBackendName;
 
530
    CCSDynamicBackendSupportsRead supportsRead;
 
531
    CCSDynamicBackendSupportsWrite supportsWrite;
 
532
    CCSDynamicBackendSupportsProfiles supportsProfiles;
 
533
    CCSDynamicBackendSupportsIntegration supportsIntegration;
 
534
    CCSDynamicBackendGetRawBackend getRawBackend;
 
535
};
 
536
 
 
537
const char * ccsDynamicBackendGetBackendName (CCSDynamicBackend *);
 
538
Bool ccsDynamicBackendSupportsRead (CCSDynamicBackend *);
 
539
Bool ccsDynamicBackendSupportsWrite (CCSDynamicBackend *);
 
540
Bool ccsDynamicBackendSupportsProfiles (CCSDynamicBackend *);
 
541
Bool ccsDynamicBackendSupportsIntegration (CCSDynamicBackend *);
 
542
CCSBackend * ccsDynamicBackendGetRawBackend (CCSDynamicBackend *);
 
543
 
 
544
unsigned int ccsCCSDynamicBackendInterfaceGetType ();
 
545
 
 
546
void ccsFreeDynamicBackend (CCSDynamicBackend *);
 
547
 
 
548
/**
 
549
 * @brief ccsOpenBackend
 
550
 * @param name the name of the backend to open
 
551
 * @param interface storage for this backend's interface
 
552
 * @return a dlopen handle for this backend
 
553
 */
 
554
CCSBackend * ccsOpenBackend (const CCSInterfaceTable *, CCSContext *context, const char *name);
 
555
 
 
556
/**
 
557
 * @brief ccsBackendNewWithDynamicInterface
 
558
 * @param context
 
559
 * @param interface
 
560
 * @param dlhand
 
561
 * @return
 
562
 *
 
563
 * Creates a new CCSBackend for a CCSBackendInterface and dlopen handle
 
564
 * dlhand
 
565
 */
 
566
CCSBackend *
 
567
ccsBackendNewWithDynamicInterface (CCSContext *context, const CCSBackendInterface *interface);
 
568
 
 
569
CCSBackendInterface* getBackendInfo (void);
 
570
 
 
571
COMPIZCONFIG_END_DECLS
92
572
 
93
573
#endif