summaryrefslogtreecommitdiff
path: root/libxklavier/xkl_config_item.h
blob: 0aa90edf178a89d8c08a805cfaa8351b42789a39 (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
/*
 * Copyright (C) 2002-2006 Sergey V. Udaltsov <svu@gnome.org>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

#ifndef __XKL_CONFIG_ITEM_H__
#define __XKL_CONFIG_ITEM_H__

#include <glib-object.h>

/*
 * Maximum name length, including '\'0' character
 */
#define XKL_MAX_CI_NAME_LENGTH 32

/*
 * Maximum short description length, including '\\0' character
 * (this length is in bytes, so for UTF-8 encoding in 
 * XML file the actual maximum length can be smaller)
 */
#define XKL_MAX_CI_SHORT_DESC_LENGTH 10

/*
 * Maximum description length, including '\\0' character
 * (this length is in bytes, so for UTF-8 encoding in 
 * XML file the actual maximum length can be smaller)
 */
#define XKL_MAX_CI_DESC_LENGTH 192

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

	typedef struct _XklConfigItem XklConfigItem;
	typedef struct _XklConfigItemClass XklConfigItemClass;

#define XKL_TYPE_CONFIG_ITEM             (xkl_config_item_get_type ())
#define XKL_CONFIG_ITEM(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), XKL_TYPE_CONFIG_ITEM, XklConfigItem))
#define XKL_CONFIG_ITEM_CLASS(obj)       (G_TYPE_CHECK_CLASS_CAST ((obj), XKL_CONFIG_ITEM,  XklConfigItemClass))
#define XKL_IS_CONFIG_ITEM(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XKL_TYPE_CONFIG_ITEM))
#define XKL_IS_CONFIG_ITEM_CLASS(obj)    (G_TYPE_CHECK_CLASS_TYPE ((obj), XKL_TYPE_CONFIG_ITEM))
#define XKL_CONFIG_ITEM_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), XKL_TYPE_CONFIG_ITEM, XklConfigItemClass))

/**
 * _XklConfigItem:
 * @parent: The superclass object
 * @name: The configuration item name. Corresponds to XML element "name".
 * @short_description: The configuration item short description. Corresponds to XML element "shortDescription".
 * @description: The configuration item description. Corresponds to XML element "description".
 *
 * The configuration item. Corresponds to XML element "configItem".
 */
	struct _XklConfigItem {
		GObject parent;

		gchar name[XKL_MAX_CI_NAME_LENGTH];

		gchar short_description[XKL_MAX_CI_DESC_LENGTH];

		gchar description[XKL_MAX_CI_DESC_LENGTH];
	};

/**
 * XCI_PROP_ALLOW_MULTIPLE_SELECTION:
 * Extra property for the XklConfigItem, defining whether the group allows multiple selection
 */
#define XCI_PROP_ALLOW_MULTIPLE_SELECTION "allowMultipleSelection"

/**
 * XCI_PROP_VENDOR:
 * Extra property for the XklConfigItem, defining the vendor (used for models)
 */
#define XCI_PROP_VENDOR "vendor"

/**
 * XCI_PROP_COUNTRY_LIST:
 * Extra property for the XklConfigItem, defining the list of countries (used for layouts/variants)
 */
#define XCI_PROP_COUNTRY_LIST "countryList"

/**
 * XCI_PROP_LANGUAGE_LIST:
 * Extra property for the XklConfigItem, defining the list of languages (used for layouts/variants)
 */
#define XCI_PROP_LANGUAGE_LIST "languageList"

/**
 * XCI_PROP_EXTRA_ITEM:
 * Extra property for the XklConfigItem, defining whether that item is exotic(extra)
 */
#define XCI_PROP_EXTRA_ITEM "extraItem"

/**
 * _XklConfigItemClass:
 * @parent_class: The superclass
 * The XklConfigItem class, derived from GObject
 */
	struct _XklConfigItemClass {
		GObjectClass parent_class;
	};

/**
 * xkl_config_item_get_type:
 *
 * Get type info for XklConfigItem
 *
 * Returns: GType for XklConfigItem
 */
	extern GType xkl_config_item_get_type(void);

/**
 * xkl_config_item_new:
 *
 * Create new XklConfigItem
 *
 * Returns: new instance
 */
	extern XklConfigItem *xkl_config_item_new(void);

/**
 * xkl_config_item_set_name:
 * @item: the XklConfigItem object to be changed
 * @name: (transfer none) (allow-none): Name (max. 32 characters); can be NULL.
 *
 * Change the @name field of a XklConfigItem. This is mostly useful for
 * language bindings, in C you can manipulate the member directly.
 */
	extern void xkl_config_item_set_name(XklConfigItem * item,
					     const gchar * name);

/**
 * xkl_config_item_set_short_description:
 * @item: the XklConfigItem object to be changed
 * @short_description: (transfer none) (allow-none): Short Description (max. 10
 *        characters); can be NULL.
 *
 * Change the @short_description field of a XklConfigItem. This is mostly useful for
 * language bindings, in C you can manipulate the member directly.
 */
	extern void xkl_config_item_set_short_description(XklConfigItem * item,
							  const gchar * short_description);
/**
 * xkl_config_item_set_description:
 * @item: the XklConfigItem object to be changed
 * @description: (transfer none) (allow-none): Description (max. 192
 *        characters); can be NULL.
 *
 * Change the @description field of a XklConfigItem. This is mostly useful for
 * language bindings, in C you can manipulate the member directly.
 */
	extern void xkl_config_item_set_description(XklConfigItem * item,
						    const gchar * description);

/**
 * xkl_get_country_name:
 * @code: ISO 3166 Alpha 2 code: 2 chars, uppercase (US, RU, FR, ...)
 *
 * Get localized country name, from ISO code
 *
 * Returns: localized country name (USA, Russia, France, ... translated)
 */
	extern const gchar * xkl_get_country_name(const gchar * code);

/**
 * xkl_get_language_name:
 * @code: ISO 639 2B or 2T code: 3 chars, lowercase (eng, rus, fra, ...)
 *
 * Get localized language name, from ISO code
 *
 * Returns: localized country name (English, Russiam, French, ... translated)
 */
	extern const gchar * xkl_get_language_name(const gchar * code);

#ifdef __cplusplus
}
#endif				/* __cplusplus */
#endif