~darkxst/ubuntu/saucy/gdm/lp1212408

« back to all changes in this revision

Viewing changes to common/gdm-config.h

  • Committer: Bazaar Package Importer
  • Author(s): Josselin Mouette
  • Date: 2008-09-02 10:37:20 UTC
  • mfrom: (1.4.27 upstream)
  • mto: This revision was merged to the branch mainline in revision 261.
  • Revision ID: james.westby@ubuntu.com-20080902103720-p810vv530hqj45wg
Tags: 2.20.7-3
* Install the debian-moreblue-orbit theme, thanks Andre Luiz Rodrigues 
  Ferreira. Closes: #497440.
* 35_gdm.conf.patch: make it the default.
* copyright: fix encoding.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
 
2
 *
 
3
 * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
 
4
 *
 
5
 * This library is free software; you can redistribute it and/or
 
6
 * modify it under the terms of the GNU Library General Public
 
7
 * License as published by the Free Software Foundation; either
 
8
 * version 2 of the License, or (at your option) any later version.
 
9
 *
 
10
 * This library is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
13
 * Library General Public License for more details.
 
14
 *
 
15
 * You should have received a copy of the GNU Library General Public
 
16
 * License along with this library; if not, write to the
 
17
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
18
 * Boston, MA 02111-1307, USA.
 
19
 */
 
20
 
 
21
#ifndef _GDM_CONFIG_H
 
22
#define _GDM_CONFIG_H
 
23
 
 
24
#include <glib.h>
 
25
 
 
26
G_BEGIN_DECLS
 
27
 
 
28
typedef struct _GdmConfig GdmConfig;
 
29
 
 
30
typedef enum {
 
31
        GDM_CONFIG_VALUE_INVALID,
 
32
        GDM_CONFIG_VALUE_BOOL,
 
33
        GDM_CONFIG_VALUE_INT,
 
34
        GDM_CONFIG_VALUE_STRING,
 
35
        GDM_CONFIG_VALUE_LOCALE_STRING,
 
36
        GDM_CONFIG_VALUE_STRING_ARRAY,
 
37
        GDM_CONFIG_VALUE_LOCALE_STRING_ARRAY,
 
38
} GdmConfigValueType;
 
39
 
 
40
typedef enum {
 
41
        GDM_CONFIG_SOURCE_INVALID,
 
42
        GDM_CONFIG_SOURCE_MANDATORY,
 
43
        GDM_CONFIG_SOURCE_DEFAULT,
 
44
        GDM_CONFIG_SOURCE_CUSTOM,
 
45
        GDM_CONFIG_SOURCE_BUILT_IN,
 
46
        GDM_CONFIG_SOURCE_RUNTIME_USER,
 
47
} GdmConfigSourceType;
 
48
 
 
49
#define GDM_CONFIG_INVALID_ID -1
 
50
 
 
51
struct _GdmConfigValue
 
52
{
 
53
        GdmConfigValueType type;
 
54
};
 
55
 
 
56
typedef struct _GdmConfigValue GdmConfigValue;
 
57
 
 
58
typedef gboolean (* GdmConfigFunc) (GdmConfig          *config,
 
59
                                    GdmConfigSourceType source,
 
60
                                    const char         *group,
 
61
                                    const char         *key,
 
62
                                    GdmConfigValue     *value,
 
63
                                    int                 id,
 
64
                                    gpointer            data);
 
65
 
 
66
typedef struct {
 
67
        char              *group;
 
68
        char              *key;
 
69
        GdmConfigValueType type;
 
70
        char              *default_value;
 
71
        int                id;
 
72
} GdmConfigEntry;
 
73
 
 
74
#define GDM_CONFIG_ERROR (gdm_config_error_quark ())
 
75
 
 
76
typedef enum
 
77
{
 
78
        GDM_CONFIG_ERROR_UNKNOWN_OPTION,
 
79
        GDM_CONFIG_ERROR_BAD_VALUE,
 
80
        GDM_CONFIG_ERROR_PARSE_ERROR,
 
81
        GDM_CONFIG_ERROR_FAILED
 
82
} GdmConfigError;
 
83
 
 
84
GQuark                 gdm_config_error_quark            (void);
 
85
 
 
86
GdmConfig *            gdm_config_new                    (void);
 
87
void                   gdm_config_free                   (GdmConfig       *config);
 
88
 
 
89
void                   gdm_config_set_validate_func      (GdmConfig       *config,
 
90
                                                          GdmConfigFunc    func,
 
91
                                                          gpointer         data);
 
92
void                   gdm_config_set_notify_func        (GdmConfig       *config,
 
93
                                                          GdmConfigFunc    func,
 
94
                                                          gpointer         data);
 
95
void                   gdm_config_set_default_file       (GdmConfig       *config,
 
96
                                                          const char      *name);
 
97
void                   gdm_config_set_mandatory_file     (GdmConfig       *config,
 
98
                                                          const char      *name);
 
99
void                   gdm_config_set_custom_file        (GdmConfig       *config,
 
100
                                                          const char      *name);
 
101
void                   gdm_config_add_entry              (GdmConfig            *config,
 
102
                                                          const GdmConfigEntry *entry);
 
103
void                   gdm_config_add_static_entries     (GdmConfig            *config,
 
104
                                                          const GdmConfigEntry *entries);
 
105
const GdmConfigEntry * gdm_config_lookup_entry           (GdmConfig            *config,
 
106
                                                          const char           *group,
 
107
                                                          const char           *key);
 
108
const GdmConfigEntry * gdm_config_lookup_entry_for_id    (GdmConfig            *config,
 
109
                                                          int                   id);
 
110
 
 
111
gboolean               gdm_config_load                   (GdmConfig             *config,
 
112
                                                          GError               **error);
 
113
gboolean               gdm_config_process_all            (GdmConfig             *config,
 
114
                                                          GError               **error);
 
115
gboolean               gdm_config_process_entry          (GdmConfig             *config,
 
116
                                                          const GdmConfigEntry  *entry,
 
117
                                                          GError               **error);
 
118
gboolean               gdm_config_process_entries        (GdmConfig             *config,
 
119
                                                          const GdmConfigEntry **entries,
 
120
                                                          gsize                  n_entries,
 
121
                                                          GError               **error);
 
122
 
 
123
gboolean               gdm_config_save_custom_file       (GdmConfig       *config,
 
124
                                                          GError         **error);
 
125
char **                gdm_config_get_keys_for_group     (GdmConfig       *config,
 
126
                                                          const gchar     *group_name,
 
127
                                                          gsize           *length,
 
128
                                                          GError         **error);
 
129
GPtrArray *            gdm_config_get_server_groups      (GdmConfig       *config);
 
130
 
 
131
gboolean               gdm_config_peek_value             (GdmConfig             *config,
 
132
                                                          const char            *group,
 
133
                                                          const char            *key,
 
134
                                                          const GdmConfigValue **value);
 
135
gboolean               gdm_config_get_value              (GdmConfig       *config,
 
136
                                                          const char      *group,
 
137
                                                          const char      *key,
 
138
                                                          GdmConfigValue **value);
 
139
gboolean               gdm_config_set_value              (GdmConfig       *config,
 
140
                                                          const char      *group,
 
141
                                                          const char      *key,
 
142
                                                          GdmConfigValue  *value);
 
143
 
 
144
/* convenience functions */
 
145
gboolean               gdm_config_get_value_for_id       (GdmConfig       *config,
 
146
                                                          int              id,
 
147
                                                          GdmConfigValue **value);
 
148
gboolean               gdm_config_set_value_for_id       (GdmConfig       *config,
 
149
                                                          int              id,
 
150
                                                          GdmConfigValue  *value);
 
151
 
 
152
gboolean               gdm_config_peek_string_for_id     (GdmConfig       *config,
 
153
                                                          int              id,
 
154
                                                          const char     **str);
 
155
gboolean               gdm_config_get_string_for_id      (GdmConfig       *config,
 
156
                                                          int              id,
 
157
                                                          char           **str);
 
158
gboolean               gdm_config_get_bool_for_id        (GdmConfig       *config,
 
159
                                                          int              id,
 
160
                                                          gboolean        *bool);
 
161
gboolean               gdm_config_get_int_for_id         (GdmConfig       *config,
 
162
                                                          int              id,
 
163
                                                          int             *integer);
 
164
gboolean               gdm_config_set_string_for_id      (GdmConfig       *config,
 
165
                                                          int              id,
 
166
                                                          char            *str);
 
167
gboolean               gdm_config_set_bool_for_id        (GdmConfig       *config,
 
168
                                                          int              id,
 
169
                                                          gboolean         bool);
 
170
gboolean               gdm_config_set_int_for_id         (GdmConfig       *config,
 
171
                                                          int              id,
 
172
                                                          int              integer);
 
173
 
 
174
/* Config Values */
 
175
 
 
176
GdmConfigValue *     gdm_config_value_new              (GdmConfigValueType    type);
 
177
void                 gdm_config_value_free             (GdmConfigValue       *value);
 
178
GdmConfigValue *     gdm_config_value_copy             (const GdmConfigValue *value);
 
179
int                  gdm_config_value_compare          (const GdmConfigValue *value_a,
 
180
                                                        const GdmConfigValue *value_b);
 
181
 
 
182
GdmConfigValue *     gdm_config_value_new_from_string  (GdmConfigValueType    type,
 
183
                                                        const char           *str,
 
184
                                                        GError              **error);
 
185
const char *         gdm_config_value_get_string       (const GdmConfigValue *value);
 
186
const char *         gdm_config_value_get_locale_string       (const GdmConfigValue *value);
 
187
const char **        gdm_config_value_get_string_array (const GdmConfigValue *value);
 
188
 
 
189
int                  gdm_config_value_get_int          (const GdmConfigValue *value);
 
190
gboolean             gdm_config_value_get_bool         (const GdmConfigValue *value);
 
191
 
 
192
void                 gdm_config_value_set_string       (GdmConfigValue  *value,
 
193
                                                        const char      *str);
 
194
void                 gdm_config_value_set_locale_string       (GdmConfigValue  *value,
 
195
                                                               const char      *str);
 
196
 
 
197
void                 gdm_config_value_set_string_array (GdmConfigValue  *value,
 
198
                                                        const char     **array);
 
199
void                 gdm_config_value_set_locale_string_array (GdmConfigValue  *value,
 
200
                                                               const char     **array);
 
201
void                 gdm_config_value_set_int          (GdmConfigValue  *value,
 
202
                                                        int              integer);
 
203
void                 gdm_config_value_set_bool         (GdmConfigValue  *value,
 
204
                                                        gboolean         bool);
 
205
char *               gdm_config_value_to_string        (const GdmConfigValue *value);
 
206
 
 
207
/* Config Entries */
 
208
GdmConfigEntry *     gdm_config_entry_copy             (const GdmConfigEntry *entry);
 
209
void                 gdm_config_entry_free             (GdmConfigEntry       *entry);
 
210
 
 
211
G_END_DECLS
 
212
 
 
213
#endif /* _GDM_CONFIG_H */