LibMB 1.12
xsettings-common.h
1/*
2 * Copyright © 2001 Red Hat, Inc.
3 *
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that
7 * copyright notice and this permission notice appear in supporting
8 * documentation, and that the name of Red Hat not be used in advertising or
9 * publicity pertaining to distribution of the software without specific,
10 * written prior permission. Red Hat makes no representations about the
11 * suitability of this software for any purpose. It is provided "as is"
12 * without express or implied warranty.
13 *
14 * RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL RED HAT
16 * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
18 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
19 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 *
21 * Author: Owen Taylor, Red Hat, Inc.
22 */
23#ifndef XSETTINGS_COMMON_H
24#define XSETTINGS_COMMON_H
25
26#ifdef __cplusplus
27extern "C" {
28#endif /* __cplusplus */
29
30typedef struct _XSettingsBuffer XSettingsBuffer;
31typedef struct _XSettingsColor XSettingsColor;
32typedef struct _XSettingsList XSettingsList;
33typedef struct _XSettingsSetting XSettingsSetting;
34
35/* Types of settings possible. Enum values correspond to
36 * protocol values.
37 */
38typedef enum
39{
40 XSETTINGS_TYPE_INT = 0,
41 XSETTINGS_TYPE_STRING = 1,
42 XSETTINGS_TYPE_COLOR = 2
43} XSettingsType;
44
45typedef enum
46{
47 XSETTINGS_SUCCESS,
48 XSETTINGS_NO_MEM,
49 XSETTINGS_ACCESS,
50 XSETTINGS_FAILED,
51 XSETTINGS_NO_ENTRY,
52 XSETTINGS_DUPLICATE_ENTRY
53} XSettingsResult;
54
55struct _XSettingsBuffer
56{
57 char byte_order;
58 size_t len;
59 unsigned char *data;
60 unsigned char *pos;
61};
62
63struct _XSettingsColor
64{
65 unsigned short red, green, blue, alpha;
66};
67
68struct _XSettingsList
69{
70 XSettingsSetting *setting;
71 XSettingsList *next;
72};
73
74struct _XSettingsSetting
75{
76 char *name;
77 XSettingsType type;
78
79 union {
80 int v_int;
81 char *v_string;
82 XSettingsColor v_color;
83 } data;
84
85 unsigned long last_change_serial;
86};
87
88XSettingsSetting *xsettings_setting_copy (XSettingsSetting *setting);
89void xsettings_setting_free (XSettingsSetting *setting);
90int xsettings_setting_equal (XSettingsSetting *setting_a,
91 XSettingsSetting *setting_b);
92
93void xsettings_list_free (XSettingsList *list);
94XSettingsList *xsettings_list_copy (XSettingsList *list);
95XSettingsResult xsettings_list_insert (XSettingsList **list,
96 XSettingsSetting *setting);
97XSettingsSetting *xsettings_list_lookup (XSettingsList *list,
98 const char *name);
99XSettingsResult xsettings_list_delete (XSettingsList **list,
100 const char *name);
101
102char xsettings_byte_order (void);
103
104#define XSETTINGS_PAD(n,m) ((n + m - 1) & (~(m-1)))
105
106#ifdef __cplusplus
107}
108#endif /* __cplusplus */
109
110#endif /* XSETTINGS_COMMON_H */