]> rtime.felk.cvut.cz Git - sojka/lightdm.git/blob - common/configuration.h
Move config loading into one function; move that function into libcommon; call it...
[sojka/lightdm.git] / common / configuration.h
1 /*
2  * Copyright (C) 2010-2011 Robert Ancell.
3  * Author: Robert Ancell <robert.ancell@canonical.com>
4  * 
5  * This program is free software: you can redistribute it and/or modify it under
6  * the terms of the GNU General Public License as published by the Free Software
7  * Foundation, either version 3 of the License, or (at your option) any later
8  * version. See http://www.gnu.org/copyleft/gpl.html the full text of the
9  * license.
10  */
11
12 #ifndef CONFIGURATION_H_
13 #define CONFIGURATION_H_
14
15 #include <glib-object.h>
16
17 G_BEGIN_DECLS
18
19 #define CONFIGURATION_TYPE (config_get_type())
20 #define CONFIGURATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CONFIGURATION_TYPE, Configuration));
21
22 typedef struct ConfigurationPrivate ConfigurationPrivate;
23
24 typedef struct
25 {
26     GObject             parent_instance;
27     ConfigurationPrivate *priv;
28 } Configuration;
29
30 typedef struct
31 {
32     GObjectClass parent_class;
33 } ConfigurationClass;
34
35 GType config_get_type (void);
36
37 Configuration *config_get_instance (void);
38
39 gboolean config_load_from_file (Configuration *config, const gchar *path, GError **error);
40
41 gboolean config_load_from_standard_locations (Configuration *config, const gchar *config_path, GList **messages);
42
43 gchar **config_get_groups (Configuration *config);
44
45 gchar **config_get_keys (Configuration *config, const gchar *group_name);
46
47 gboolean config_has_key (Configuration *config, const gchar *section, const gchar *key);
48
49 void config_set_string (Configuration *config, const gchar *section, const gchar *key, const gchar *value);
50
51 gchar *config_get_string (Configuration *config, const gchar *section, const gchar *key);
52
53 void config_set_string_list (Configuration *config, const gchar *section, const gchar *key, const gchar **value, gsize length);
54
55 gchar **config_get_string_list (Configuration *config, const gchar *section, const gchar *key);
56
57 void config_set_integer (Configuration *config, const gchar *section, const gchar *key, gint value);
58
59 gint config_get_integer (Configuration *config, const gchar *section, const gchar *key);
60
61 void config_set_boolean (Configuration *config, const gchar *section, const gchar *key, gboolean value);
62
63 gboolean config_get_boolean (Configuration *config, const gchar *section, const gchar *key);
64
65 G_END_DECLS
66
67 #endif /* CONFIGURATION_H_ */