summaryrefslogtreecommitdiff
path: root/gconf/GConfX.idl
blob: ae931f22e1eeee6e987a57881f3c54871d2caf2b (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

// 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;
};

interface ConfigDatabase;

interface ConfigListener {
  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);
};

// 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
};

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);
  
  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);
  
  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);

  // Internal use
  void clear_cache();
  
  void synchronous_sync()
    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);

  // Internal use
  long ping();

  void shutdown();
};