summaryrefslogtreecommitdiff
path: root/libxklavier/xkl_config_registry.h
blob: a1c108ee07b6005dcf57deb4f80baaaeaa197a32 (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
264
#ifndef __XKL_CONFIG_REGISTRY_H__
#define __XKL_CONFIG_REGISTRY_H__

#include <glib-object.h>
#include <libxklavier/xkl_engine.h>
#include <libxklavier/xkl_config_item.h>

#ifdef __cplusplus
extern "C" {
#endif				/* __cplusplus */

	typedef struct _XklConfigRegistry XklConfigRegistry;
	typedef struct _XklConfigRegistryPrivate XklConfigRegistryPrivate;
	typedef struct _XklConfigRegistryClass XklConfigRegistryClass;

#define XKL_TYPE_CONFIG_REGISTRY             (xkl_config_registry_get_type ())
#define XKL_CONFIG_REGISTRY(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), XKL_TYPE_CONFIG_REGISTRY, XklConfigRegistry))
#define XKL_CONFIG_REGISTRY_CLASS(obj)       (G_TYPE_CHECK_CLASS_CAST ((obj), XKL_TYPE_CONFIG_REGISTRY,  XklConfigRegistryClass))
#define XKL_IS_CONFIG_REGISTRY(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XKL_TYPE_CONFIG_REGISTRY))
#define XKL_IS_CONFIG_REGISTRY_CLASS(obj)    (G_TYPE_CHECK_CLASS_TYPE ((obj), XKL_TYPE_CONFIG_REGISTRY))
#define XKL_CONFIG_REGISTRY_GET_CLASS        (G_TYPE_INSTANCE_GET_CLASS ((obj), XKL_TYPE_CONFIG_REGISTRY, XklConfigRegistryClass))

/**
 * The configuration manager. Corresponds to XML element "configItem".
 */
	struct _XklConfigRegistry {
/**
 * The superclass object
 */
		GObject parent;

		XklConfigRegistryPrivate *priv;
	};

/**
 * The XklConfigRegistry class, derived from GObject
 */
	struct _XklConfigRegistryClass {
    /**
     * The superclass
     */
		GObjectClass parent_class;
	};
/**
 * xkl_config_registry_get_type:
 *
 * Get type info for XConfig
 *
 * Returns: GType for XConfig
 */
	extern GType xkl_config_registry_get_type(void);

/**
 * xkl_config_registry_get_instance:
 * @engine: the engine to use for accessing X in all the operations
 * (like accessing root window properties etc)
 *
 * Create new XklConfig
 *
 * Returns: new instance
 */
	extern XklConfigRegistry
	    * xkl_config_registry_get_instance(XklEngine * engine);

/**
 * xkl_config_registry_load_from_file:
 * @config: the config registry
 * @file_name: file to load
 *
 * Loads XML configuration registry
 *
 * Returns: TRUE on success
 */
	extern gboolean
	    xkl_config_registry_load_from_file(XklConfigRegistry * config,
					       const gchar * file_name);

/**
 * xkl_config_registry_load:
 * @config: the config registry
 *
 * Loads XML configuration registry. The name is taken from X server
 * (for XKB/libxkbfile, from the root window property)
 *
 * Returns: TRUE on success
 */
	extern gboolean xkl_config_registry_load(XklConfigRegistry *
						 config);

/**
 * xkl_config_registry_free:
 * @config: the config registry
 *
 * Frees XML configuration registry
 */
	extern void xkl_config_registry_free(XklConfigRegistry * config);

/**
 * xkl_config_registry_foreach_model:
 * @config: the config registry
 * @func: callback to call for every model
 * @data: anything which can be stored into the pointer
 *
 * Enumerates keyboard models from the XML configuration registry
 */
	extern void xkl_config_registry_foreach_model(XklConfigRegistry *
						      config,
						      ConfigItemProcessFunc
						      func, gpointer data);

/**
 * xkl_config_registry_foreach_layout:
 * @config: the config registry
 * @func: callback to call for every layout
 * @data: anything which can be stored into the pointer
 *
 * Enumerates keyboard layouts from the XML configuration registry
 */
	extern void xkl_config_registry_foreach_layout(XklConfigRegistry *
						       config,
						       ConfigItemProcessFunc
						       func,
						       gpointer data);

/**
 * xkl_config_registry_foreach_layout_variant:
 * @config: the config registry
 * @layout_name: layout name for which variants will be listed
 * @func: callback to call for every layout variant
 * @data: anything which can be stored into the pointer
 *
 * Enumerates keyboard layout variants from the XML configuration registry
 */
	extern void
	 xkl_config_registry_foreach_layout_variant(XklConfigRegistry *
						    config,
						    const gchar *
						    layout_name,
						    ConfigItemProcessFunc
						    func, gpointer data);

/**
 * xkl_config_registry_foreach_option_group:
 * @config: the config registry
 * @func: callback to call for every option group
 * @data: anything which can be stored into the pointer
 *
 * Enumerates keyboard option groups from the XML configuration registry
 */
	extern void
	 xkl_config_registry_foreach_option_group(XklConfigRegistry *
						  config,
						  GroupProcessFunc func,
						  gpointer data);

/**
 * xkl_config_registry_foreach_option:
 * @config: the config registry
 * @option_group_name: option group name for which variants 
 * will be listed
 * @func: callback to call for every option
 * @data: anything which can be stored into the pointer
 *
 * Enumerates keyboard options from the XML configuration registry
 */
	extern void xkl_config_registry_foreach_option(XklConfigRegistry *
						       config,
						       const gchar *
						       option_group_name,
						       ConfigItemProcessFunc
						       func,
						       gpointer data);

/**
 * xkl_config_registry_find_model:
 * @config: the config registry
 * @item: pointer to a XklConfigItem containing the name of the
 * keyboard model. On successfull return, the descriptions are filled.
 *
 * Loads a keyboard model information from the XML configuration registry.
 *
 * Returns: TRUE if appropriate element was found and loaded
 */
	extern gboolean xkl_config_registry_find_model(XklConfigRegistry *
						       config,
						       XklConfigItem *
						       item);

/**
 * xkl_config_registry_find_layout:
 * @config: the config registry
 * @item: pointer to a XklConfigItem containing the name of the
 * keyboard layout. On successfull return, the descriptions are filled.
 *
 * Loads a keyboard layout information from the XML configuration registry.
 *
 * Returns: TRUE if appropriate element was found and loaded
 */
	extern gboolean xkl_config_registry_find_layout(XklConfigRegistry *
							config,
							XklConfigItem *
							item);

/**
 * xkl_config_registry_find_variant:
 * @config: the config registry
 * @layout_name: name of the parent layout
 * @item: pointer to a XklConfigItem containing the name of the
 * keyboard layout variant. On successfull return, the descriptions are filled.
 *
 * Loads a keyboard layout variant information from the XML configuration 
 * registry.
 *
 * Returns: TRUE if appropriate element was found and loaded
 */
	extern gboolean xkl_config_registry_find_variant(XklConfigRegistry
							 * config,
							 const char
							 *layout_name,
							 XklConfigItem *
							 item);

/**
 * xkl_config_registry_find_option_group:
 * @config: the config registry
 * @item: pointer to a XklConfigItem containing the name of the
 * keyboard option group. On successfull return, the descriptions are filled.
 * @allow_multiple_selection: pointer to some gboolean variable to fill 
 * the corresponding attribute of XML element "group".
 *
 * Loads a keyboard option group information from the XML configuration 
 * registry.
 *
 * Returns: TRUE if appropriate element was found and loaded
 */
	extern gboolean
	    xkl_config_registry_find_option_group(XklConfigRegistry *
						  config,
						  XklConfigItem * item,
						  gboolean *
						  allow_multiple_selection);

/**
 * xkl_config_registry_find_option:
 * @config: the config registry
 * @option_group_name: name of the option group
 * @item: pointer to a XklConfigItem containing the name of the
 * keyboard option. On successfull return, the descriptions are filled.
 *
 * Loads a keyboard option information from the XML configuration 
 * registry.
 *
 * Returns: TRUE if appropriate element was found and loaded
 */
	extern gboolean xkl_config_registry_find_option(XklConfigRegistry *
							config,
							const gchar *
							option_group_name,
							XklConfigItem *
							item);
#ifdef __cplusplus
}
#endif				/* __cplusplus */
#endif