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 #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
24 #error "Only <glib.h> can be included directly."
27 #ifndef __G_KEY_FILE_H__
28 #define __G_KEY_FILE_H__
30 #include <glib/gerror.h>
36 G_KEY_FILE_ERROR_UNKNOWN_ENCODING,
37 G_KEY_FILE_ERROR_PARSE,
38 G_KEY_FILE_ERROR_NOT_FOUND,
39 G_KEY_FILE_ERROR_KEY_NOT_FOUND,
40 G_KEY_FILE_ERROR_GROUP_NOT_FOUND,
41 G_KEY_FILE_ERROR_INVALID_VALUE
44 #define G_KEY_FILE_ERROR g_key_file_error_quark()
46 GQuark g_key_file_error_quark (void);
48 typedef struct _GKeyFile GKeyFile;
53 G_KEY_FILE_KEEP_COMMENTS = 1 << 0,
54 G_KEY_FILE_KEEP_TRANSLATIONS = 1 << 1
57 GKeyFile *g_key_file_new (void);
58 GKeyFile *g_key_file_ref (GKeyFile *key_file);
59 void g_key_file_unref (GKeyFile *key_file);
60 void g_key_file_free (GKeyFile *key_file);
61 void g_key_file_set_list_separator (GKeyFile *key_file,
63 gboolean g_key_file_load_from_file (GKeyFile *key_file,
67 gboolean g_key_file_load_from_data (GKeyFile *key_file,
72 gboolean g_key_file_load_from_dirs (GKeyFile *key_file,
74 const gchar **search_dirs,
78 gboolean g_key_file_load_from_data_dirs (GKeyFile *key_file,
83 gchar *g_key_file_to_data (GKeyFile *key_file,
85 GError **error) G_GNUC_MALLOC;
86 gchar *g_key_file_get_start_group (GKeyFile *key_file) G_GNUC_MALLOC;
87 gchar **g_key_file_get_groups (GKeyFile *key_file,
88 gsize *length) G_GNUC_MALLOC;
89 gchar **g_key_file_get_keys (GKeyFile *key_file,
90 const gchar *group_name,
92 GError **error) G_GNUC_MALLOC;
93 gboolean g_key_file_has_group (GKeyFile *key_file,
94 const gchar *group_name);
95 gboolean g_key_file_has_key (GKeyFile *key_file,
96 const gchar *group_name,
99 gchar *g_key_file_get_value (GKeyFile *key_file,
100 const gchar *group_name,
102 GError **error) G_GNUC_MALLOC;
103 void g_key_file_set_value (GKeyFile *key_file,
104 const gchar *group_name,
107 gchar *g_key_file_get_string (GKeyFile *key_file,
108 const gchar *group_name,
110 GError **error) G_GNUC_MALLOC;
111 void g_key_file_set_string (GKeyFile *key_file,
112 const gchar *group_name,
114 const gchar *string);
115 gchar *g_key_file_get_locale_string (GKeyFile *key_file,
116 const gchar *group_name,
119 GError **error) G_GNUC_MALLOC;
120 void g_key_file_set_locale_string (GKeyFile *key_file,
121 const gchar *group_name,
124 const gchar *string);
125 gboolean g_key_file_get_boolean (GKeyFile *key_file,
126 const gchar *group_name,
129 void g_key_file_set_boolean (GKeyFile *key_file,
130 const gchar *group_name,
133 gint g_key_file_get_integer (GKeyFile *key_file,
134 const gchar *group_name,
137 void g_key_file_set_integer (GKeyFile *key_file,
138 const gchar *group_name,
141 gint64 g_key_file_get_int64 (GKeyFile *key_file,
142 const gchar *group_name,
145 void g_key_file_set_int64 (GKeyFile *key_file,
146 const gchar *group_name,
149 guint64 g_key_file_get_uint64 (GKeyFile *key_file,
150 const gchar *group_name,
153 void g_key_file_set_uint64 (GKeyFile *key_file,
154 const gchar *group_name,
157 gdouble g_key_file_get_double (GKeyFile *key_file,
158 const gchar *group_name,
161 void g_key_file_set_double (GKeyFile *key_file,
162 const gchar *group_name,
165 gchar **g_key_file_get_string_list (GKeyFile *key_file,
166 const gchar *group_name,
169 GError **error) G_GNUC_MALLOC;
170 void g_key_file_set_string_list (GKeyFile *key_file,
171 const gchar *group_name,
173 const gchar * const list[],
175 gchar **g_key_file_get_locale_string_list (GKeyFile *key_file,
176 const gchar *group_name,
180 GError **error) G_GNUC_MALLOC;
181 void g_key_file_set_locale_string_list (GKeyFile *key_file,
182 const gchar *group_name,
185 const gchar * const list[],
187 gboolean *g_key_file_get_boolean_list (GKeyFile *key_file,
188 const gchar *group_name,
191 GError **error) G_GNUC_MALLOC;
192 void g_key_file_set_boolean_list (GKeyFile *key_file,
193 const gchar *group_name,
197 gint *g_key_file_get_integer_list (GKeyFile *key_file,
198 const gchar *group_name,
201 GError **error) G_GNUC_MALLOC;
202 void g_key_file_set_double_list (GKeyFile *key_file,
203 const gchar *group_name,
207 gdouble *g_key_file_get_double_list (GKeyFile *key_file,
208 const gchar *group_name,
211 GError **error) G_GNUC_MALLOC;
212 void g_key_file_set_integer_list (GKeyFile *key_file,
213 const gchar *group_name,
217 gboolean g_key_file_set_comment (GKeyFile *key_file,
218 const gchar *group_name,
220 const gchar *comment,
222 gchar *g_key_file_get_comment (GKeyFile *key_file,
223 const gchar *group_name,
225 GError **error) G_GNUC_MALLOC;
227 gboolean g_key_file_remove_comment (GKeyFile *key_file,
228 const gchar *group_name,
231 gboolean g_key_file_remove_key (GKeyFile *key_file,
232 const gchar *group_name,
235 gboolean g_key_file_remove_group (GKeyFile *key_file,
236 const gchar *group_name,
239 /* Defines for handling freedesktop.org Desktop files */
240 #define G_KEY_FILE_DESKTOP_GROUP "Desktop Entry"
242 #define G_KEY_FILE_DESKTOP_KEY_TYPE "Type"
243 #define G_KEY_FILE_DESKTOP_KEY_VERSION "Version"
244 #define G_KEY_FILE_DESKTOP_KEY_NAME "Name"
245 #define G_KEY_FILE_DESKTOP_KEY_GENERIC_NAME "GenericName"
246 #define G_KEY_FILE_DESKTOP_KEY_NO_DISPLAY "NoDisplay"
247 #define G_KEY_FILE_DESKTOP_KEY_COMMENT "Comment"
248 #define G_KEY_FILE_DESKTOP_KEY_ICON "Icon"
249 #define G_KEY_FILE_DESKTOP_KEY_HIDDEN "Hidden"
250 #define G_KEY_FILE_DESKTOP_KEY_ONLY_SHOW_IN "OnlyShowIn"
251 #define G_KEY_FILE_DESKTOP_KEY_NOT_SHOW_IN "NotShowIn"
252 #define G_KEY_FILE_DESKTOP_KEY_TRY_EXEC "TryExec"
253 #define G_KEY_FILE_DESKTOP_KEY_EXEC "Exec"
254 #define G_KEY_FILE_DESKTOP_KEY_PATH "Path"
255 #define G_KEY_FILE_DESKTOP_KEY_TERMINAL "Terminal"
256 #define G_KEY_FILE_DESKTOP_KEY_MIME_TYPE "MimeType"
257 #define G_KEY_FILE_DESKTOP_KEY_CATEGORIES "Categories"
258 #define G_KEY_FILE_DESKTOP_KEY_STARTUP_NOTIFY "StartupNotify"
259 #define G_KEY_FILE_DESKTOP_KEY_STARTUP_WM_CLASS "StartupWMClass"
260 #define G_KEY_FILE_DESKTOP_KEY_URL "URL"
262 #define G_KEY_FILE_DESKTOP_TYPE_APPLICATION "Application"
263 #define G_KEY_FILE_DESKTOP_TYPE_LINK "Link"
264 #define G_KEY_FILE_DESKTOP_TYPE_DIRECTORY "Directory"
268 #endif /* __G_KEY_FILE_H__ */