2 * Copyright (C) 2010-2011 Robert Ancell.
3 * Author: Robert Ancell <robert.ancell@canonical.com>
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
12 #ifndef CONFIGURATION_H_
13 #define CONFIGURATION_H_
15 #include <glib-object.h>
19 #define CONFIGURATION_TYPE (config_get_type())
20 #define CONFIGURATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CONFIGURATION_TYPE, Configuration));
22 typedef struct ConfigurationPrivate ConfigurationPrivate;
26 GObject parent_instance;
27 ConfigurationPrivate *priv;
32 GObjectClass parent_class;
35 GType config_get_type (void);
37 Configuration *config_get_instance (void);
39 gboolean config_load_from_file (Configuration *config, const gchar *path, GList **messages, GError **error);
41 gboolean config_load_from_standard_locations (Configuration *config, const gchar *config_path, GList **messages);
43 const gchar *config_get_directory (Configuration *config);
45 gchar **config_get_groups (Configuration *config);
47 gchar **config_get_keys (Configuration *config, const gchar *group_name);
49 gboolean config_has_key (Configuration *config, const gchar *section, const gchar *key);
51 GList *config_get_sources (Configuration *config);
53 const gchar *config_get_source (Configuration *config, const gchar *section, const gchar *key);
55 void config_set_string (Configuration *config, const gchar *section, const gchar *key, const gchar *value);
57 gchar *config_get_string (Configuration *config, const gchar *section, const gchar *key);
59 void config_set_string_list (Configuration *config, const gchar *section, const gchar *key, const gchar **value, gsize length);
61 gchar **config_get_string_list (Configuration *config, const gchar *section, const gchar *key);
63 void config_set_integer (Configuration *config, const gchar *section, const gchar *key, gint value);
65 gint config_get_integer (Configuration *config, const gchar *section, const gchar *key);
67 void config_set_boolean (Configuration *config, const gchar *section, const gchar *key, gboolean value);
69 gboolean config_get_boolean (Configuration *config, const gchar *section, const gchar *key);
73 #endif /* CONFIGURATION_H_ */