3
* Copyright (C) 1999, 2000 Red Hat Inc.
5
* This library is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU Library General Public
7
* License as published by the Free Software Foundation; either
8
* version 2 of the License, or (at your option) any later version.
10
* This library is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
* Library General Public License for more details.
15
* You should have received a copy of the GNU Library General Public
16
* License along with this library; if not, write to the
17
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18
* Boston, MA 02111-1307, USA.
21
#ifndef GCONF_GCONFBACKEND_H
22
#define GCONF_GCONFBACKEND_H
24
#include <gconf/gconf-internals.h>
26
#include <gconf/gconf-sources.h>
29
* This vtable is more complicated than strictly necessary, hoping
30
* that backends can be smart and optimize some calls
33
typedef struct _GConfBackendVTable GConfBackendVTable;
35
struct _GConfBackendVTable {
36
void (* shutdown) (GError** err);
38
GConfSource* (* resolve_address) (const gchar* address,
41
/* Thread locks. If the backend is thread-safe, then these
42
* can be NULL. If per-source locks are needed, then these
43
* calls should lock a mutex stored in the GConfSource.
44
* If a per-backend lock is needed, then the calls can ignore
45
* their source argument and lock the whole backend.
47
void (* lock) (GConfSource* source,
50
void (* unlock) (GConfSource* source,
53
/* Report whether a given key (and its subkeys) can be read/written.
54
* Sources may not permit reading/writing from/to /foo but forbid
55
* writing to /foo/bar; if a key can be read or written then its
56
* subkeys may also be read/written.
58
* This field allows backends to be configured so that they only
59
* store certain kinds of data in certain sections of the GConf
62
* If these functions return an error, they MUST return FALSE as
66
gboolean (* readable) (GConfSource* source,
70
gboolean (* writable) (GConfSource* source,
74
/* schema_name filled if NULL or GCONF_VALUE_IGNORE_SUBSEQUENT returned.
75
if schema_name is NULL, it isn't filled */
76
GConfValue* (* query_value) (GConfSource* source,
78
const gchar** locales,
82
GConfMetaInfo* (* query_metainfo) (GConfSource* source,
86
void (* set_value) (GConfSource* source,
91
/* Returns list of GConfEntry with key set to a relative
92
* pathname. In the public client-side API the key
93
* is always absolute though.
95
GSList* (* all_entries) (GConfSource* source,
97
const gchar** locales,
100
/* Returns list of allocated strings, relative names */
101
GSList* (* all_subdirs) (GConfSource* source,
105
void (* unset_value) (GConfSource* source,
110
gboolean (* dir_exists) (GConfSource* source,
114
void (* remove_dir) (GConfSource* source,
118
void (* set_schema) (GConfSource* source,
120
const gchar* schema_key,
123
gboolean (* sync_all) (GConfSource* source,
126
void (* destroy_source) (GConfSource* source);
128
/* This is basically used by the test suite */
129
void (* clear_cache) (GConfSource* source);
132
struct _GConfBackend {
135
GConfBackendVTable* vtable;
139
/* Address utility stuff */
141
/* Get the backend name */
142
gchar* gconf_address_backend(const gchar* address);
143
/* Get the resource name understood only by the backend */
144
gchar* gconf_address_resource(const gchar* address);
145
/* Get the backend flags */
146
gchar** gconf_address_flags(const gchar* address);
148
gchar* gconf_backend_file(const gchar* address);
150
/* Obtain the GConfBackend for this address, based on the first part of the
151
* address. The refcount is always incremented, and you must unref() later.
152
* The same backend may be returned by multiple calls to this routine,
153
* but you can assume they are different if you do the refcounting
154
* right. Returns NULL if it fails.
156
GConfBackend* gconf_get_backend(const gchar* address, GError** err);
158
void gconf_backend_ref(GConfBackend* backend);
159
void gconf_backend_unref(GConfBackend* backend);
161
GConfSource* gconf_backend_resolve_address (GConfBackend* backend,
162
const gchar* address,