summaryrefslogtreecommitdiff
path: root/gconf/GConfX.idl
blob: 7a2335510024b2f22da531fb998515540ce703d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263

// Really, this whole interface should be used only via the GConf 
// client library. I reserve the right to change it whenever I feel 
// like it. So there.

enum ConfigBasicValueType { BInvalidVal, BIntVal, BStringVal, BFloatVal, BBoolVal, BSchemaVal };

enum ConfigValueType { InvalidVal, IntVal, StringVal, FloatVal, BoolVal, SchemaVal, ListVal, PairVal };

struct ConfigSchema {
  ConfigValueType value_type;
  ConfigValueType value_list_type;
  ConfigValueType value_car_type;
  ConfigValueType value_cdr_type;
  string locale;
  string short_desc;
  string long_desc;
  string owner;
  // Work around lack of recursive data types
  string encoded_default_value;
};

union ConfigBasicValue switch (ConfigBasicValueType) {
 case BInvalidVal:
   long dummy;
 case BIntVal: 
   long int_value;
 case BStringVal:
   string string_value;
 case BFloatVal:
   float float_value;
 case BBoolVal:
   boolean bool_value;
   // hope this doesn't slow down transmission of smaller types 
 case BSchemaVal:
   ConfigSchema schema_value;
};

typedef sequence<ConfigBasicValue> BasicValueList;

struct ConfigList {
  BasicValueList seq;
  ConfigBasicValueType list_type;
};

union ConfigValue switch (ConfigValueType) {
 case InvalidVal:
   long dummy;
 case IntVal:
   long int_value;
 case StringVal:
   string string_value;
 case FloatVal:
   float float_value;
 case BoolVal:
   boolean bool_value;
 case SchemaVal:
   ConfigSchema schema_value;
 case ListVal:
   ConfigList list_value;
 case PairVal:
   BasicValueList pair_value;
};

struct ConfigStringProperty
{
  string key;
  string value;
};

interface ConfigDatabase;

interface ConfigListener {
  typedef sequence<string> KeyList;
  
  oneway void notify (in ConfigDatabase database,
                      in unsigned long cnxn,
                      in string key,
                      in ConfigValue value,
                      in boolean is_default,
                      in boolean is_writable);

  oneway void ping ();

  /// This should conceivably not be oneway.
  /// I'm worried about the server blocking waiting for
  /// busy clients.

  oneway void update_listener (in ConfigDatabase database,
                               in string db_address,
                               in unsigned long old_cnxn,
                               in string where,
                               in unsigned long new_cnxn);
  
  oneway void invalidate_cached_values (in ConfigDatabase database,
                                        in KeyList keys);
  
  // Called when a new daemon starts up, and we need to drop caches
  // in case the new daemon has a different default database
  oneway void drop_all_caches ();
};

// Sync this with GConfErrNo in gconf.h, when it makes sense
// (e.g. G_CONF_NO_SERVER doesn't make sense here)

enum ConfigErrorType {
  ConfigFailed, ConfigNoPermission,
  ConfigBadAddress, ConfigBadKey,
  ConfigParseError, ConfigCorrupt,
  ConfigTypeMismatch, ConfigIsDir, ConfigIsKey,
  ConfigOverridden, ConfigLockFailed,
  ConfigNoWritableDatabase, ConfigInShutdown
};

exception ConfigException {
  ConfigErrorType err_no;
  string message;
};

interface ConfigDatabase {
  typedef sequence<string> KeyList;
  typedef sequence<ConfigValue> ValueList;
  typedef sequence<boolean> IsDefaultList;
  typedef sequence<boolean> IsWritableList;
  
  // "where" is the portion of the namespace to listen to
  // Returns a connection ID for removal
  unsigned long add_listener(in string where,
                             in ConfigListener who);  

  void remove_listener(in unsigned long cnxn);
  
  ConfigValue lookup(in string key)
    raises (ConfigException);

  // separate from lookup for efficiency
  ConfigValue lookup_with_locale(in string key,
                                 in string locale,
                                 in boolean use_schema_default,
                                 out boolean value_is_default,
                                 out boolean value_is_writable)
    raises (ConfigException);

  // syntactic sugar, semi-hack: should maybe use a get_metainfo()
  // function (which we should have anyway)
  ConfigValue lookup_default_value(in string key,
                                   in string locale)
    raises (ConfigException);

  // Grab lots of values at once
  void batch_lookup (in KeyList keys,
                     in string locale,
                     out ValueList values,
                     out IsDefaultList is_defaults,
                     out IsWritableList is_writables)
    raises (ConfigException);
  
  void set(in string key, in ConfigValue value)
    raises (ConfigException);
  
  void unset(in string key)
    raises (ConfigException);

  void unset_with_locale(in string key, in string locale)
    raises (ConfigException);

  // Setting to InvalidVal does an unset
  void batch_change(in string locale, // only used for unsets 
                    in KeyList keys,
                    in ValueList values)
    raises (ConfigException);
  
  boolean dir_exists(in string dir)
    raises (ConfigException);

  void remove_dir(in string dir)
    raises (ConfigException);

  void all_entries(in string dir,
                   in string locale,
                   out KeyList keys,
                   out ValueList values,
                   out IsDefaultList is_defaults,
                   out IsWritableList is_writables)
    raises (ConfigException);

  void all_dirs(in string dir,
                out KeyList subdirs)
    raises (ConfigException);
  
  // if first arg is a key, second arg should be a key pointing
  //  to a schema. 
  // if first arg is a dir, second arg should be a key pointing 
  //  to a dir full of schemas.
  void set_schema(in string key,
                  in string schema_key)
    raises (ConfigException);

  void sync()
    raises (ConfigException);

  void clear_cache();
  
  void synchronous_sync()
    raises (ConfigException);
};

interface ConfigDatabase2 : ConfigDatabase {

  typedef sequence<string> SchemaNameList;
  
  // Fixed version of lookup_with_locale that gets
  // all the relevant information
  ConfigValue lookup_with_schema_name (in string key,
                                       in string locale,
                                       in boolean use_schema_default,
                                       out string  schema_name,
                                       out boolean value_is_default,
                                       out boolean value_is_writable)
    raises (ConfigException);
  
  void all_entries_with_schema_name (in string dir,
                                     in string locale,
                                     out KeyList keys,
                                     out ValueList values,
                                     out SchemaNameList schema_names,
                                     out IsDefaultList is_defaults,
                                     out IsWritableList is_writables)
    raises (ConfigException);  
};

interface ConfigDatabase3 : ConfigDatabase2 {

  typedef sequence<ConfigStringProperty> PropList;
  typedef long UnsetFlags;
  const UnsetFlags UNSET_INCLUDING_SCHEMA_NAMES = 1;
  
  unsigned long add_listener_with_properties (in string where,
                                              in ConfigListener who,
                                              in PropList properties)
    raises (ConfigException); /* plain add_listener doesn't have this, sadly */
  
  void recursive_unset (in string key,
                        in UnsetFlags flags)
    raises (ConfigException);
};

interface ConfigServer {

  ConfigDatabase get_default_database ();

  // Use a specific address instead of the default database;
  // invalid_context returned on failure.
  ConfigDatabase get_database (in string address);

  void add_client (in ConfigListener client);
  void remove_client (in ConfigListener client);
  
  long ping();

  void shutdown();
};