1 /* gkeyfile.h - desktop entry file parser
3 * Copyright 2004 Red Hat, Inc.
5 * Ray Strode <halfline@hawaii.rr.com>
7 * GLib is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version.
12 * GLib is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with GLib; see the file COPYING.LIB. If not,
19 * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
23 #ifndef __G_KEY_FILE_H__
24 #define __G_KEY_FILE_H__
26 #include <glib/gerror.h>
32 G_KEY_FILE_ERROR_UNKNOWN_ENCODING,
33 G_KEY_FILE_ERROR_PARSE,
34 G_KEY_FILE_ERROR_NOT_FOUND,
35 G_KEY_FILE_ERROR_KEY_NOT_FOUND,
36 G_KEY_FILE_ERROR_GROUP_NOT_FOUND,
37 G_KEY_FILE_ERROR_INVALID_VALUE
40 #define G_KEY_FILE_ERROR g_key_file_error_quark()
42 GQuark g_key_file_error_quark (void);
44 typedef struct _GKeyFile GKeyFile;
49 G_KEY_FILE_KEEP_COMMENTS = 1 << 0,
50 G_KEY_FILE_KEEP_TRANSLATIONS = 1 << 1
53 GKeyFile *g_key_file_new (void);
54 void g_key_file_free (GKeyFile *key_file);
55 void g_key_file_set_list_separator (GKeyFile *key_file,
57 gboolean g_key_file_load_from_file (GKeyFile *key_file,
61 gboolean g_key_file_load_from_data (GKeyFile *key_file,
66 gboolean g_key_file_load_from_data_dirs (GKeyFile *key_file,
71 gchar *g_key_file_to_data (GKeyFile *key_file,
73 GError **error) G_GNUC_MALLOC;
74 gchar *g_key_file_get_start_group (GKeyFile *key_file) G_GNUC_MALLOC;
75 gchar **g_key_file_get_groups (GKeyFile *key_file,
76 gsize *length) G_GNUC_MALLOC;
77 gchar **g_key_file_get_keys (GKeyFile *key_file,
78 const gchar *group_name,
80 GError **error) G_GNUC_MALLOC;
81 gboolean g_key_file_has_group (GKeyFile *key_file,
82 const gchar *group_name);
83 gboolean g_key_file_has_key (GKeyFile *key_file,
84 const gchar *group_name,
87 gchar *g_key_file_get_value (GKeyFile *key_file,
88 const gchar *group_name,
90 GError **error) G_GNUC_MALLOC;
91 void g_key_file_set_value (GKeyFile *key_file,
92 const gchar *group_name,
95 gchar *g_key_file_get_string (GKeyFile *key_file,
96 const gchar *group_name,
98 GError **error) G_GNUC_MALLOC;
99 void g_key_file_set_string (GKeyFile *key_file,
100 const gchar *group_name,
102 const gchar *string);
103 gchar *g_key_file_get_locale_string (GKeyFile *key_file,
104 const gchar *group_name,
107 GError **error) G_GNUC_MALLOC;
108 void g_key_file_set_locale_string (GKeyFile *key_file,
109 const gchar *group_name,
112 const gchar *string);
113 gboolean g_key_file_get_boolean (GKeyFile *key_file,
114 const gchar *group_name,
117 void g_key_file_set_boolean (GKeyFile *key_file,
118 const gchar *group_name,
121 gint g_key_file_get_integer (GKeyFile *key_file,
122 const gchar *group_name,
125 void g_key_file_set_integer (GKeyFile *key_file,
126 const gchar *group_name,
129 gchar **g_key_file_get_string_list (GKeyFile *key_file,
130 const gchar *group_name,
133 GError **error) G_GNUC_MALLOC;
134 void g_key_file_set_string_list (GKeyFile *key_file,
135 const gchar *group_name,
137 const gchar * const list[],
139 gchar **g_key_file_get_locale_string_list (GKeyFile *key_file,
140 const gchar *group_name,
144 GError **error) G_GNUC_MALLOC;
145 void g_key_file_set_locale_string_list (GKeyFile *key_file,
146 const gchar *group_name,
149 const gchar * const list[],
151 gboolean *g_key_file_get_boolean_list (GKeyFile *key_file,
152 const gchar *group_name,
155 GError **error) G_GNUC_MALLOC;
156 void g_key_file_set_boolean_list (GKeyFile *key_file,
157 const gchar *group_name,
161 gint *g_key_file_get_integer_list (GKeyFile *key_file,
162 const gchar *group_name,
165 GError **error) G_GNUC_MALLOC;
166 void g_key_file_set_integer_list (GKeyFile *key_file,
167 const gchar *group_name,
171 void g_key_file_set_comment (GKeyFile *key_file,
172 const gchar *group_name,
174 const gchar *comment,
176 gchar *g_key_file_get_comment (GKeyFile *key_file,
177 const gchar *group_name,
179 GError **error) G_GNUC_MALLOC;
181 void g_key_file_remove_comment (GKeyFile *key_file,
182 const gchar *group_name,
185 void g_key_file_remove_key (GKeyFile *key_file,
186 const gchar *group_name,
189 void g_key_file_remove_group (GKeyFile *key_file,
190 const gchar *group_name,
195 #endif /* __G_KEY_FILE_H__ */