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(G_DISABLE_SINGLE_INCLUDES) && !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 void g_key_file_free (GKeyFile *key_file);
59 void g_key_file_set_list_separator (GKeyFile *key_file,
61 gboolean g_key_file_load_from_file (GKeyFile *key_file,
65 gboolean g_key_file_load_from_data (GKeyFile *key_file,
70 gboolean g_key_file_load_from_dirs (GKeyFile *key_file,
72 const gchar **search_dirs,
76 gboolean g_key_file_load_from_data_dirs (GKeyFile *key_file,
81 gchar *g_key_file_to_data (GKeyFile *key_file,
83 GError **error) G_GNUC_MALLOC;
84 gchar *g_key_file_get_start_group (GKeyFile *key_file) G_GNUC_MALLOC;
85 gchar **g_key_file_get_groups (GKeyFile *key_file,
86 gsize *length) G_GNUC_MALLOC;
87 gchar **g_key_file_get_keys (GKeyFile *key_file,
88 const gchar *group_name,
90 GError **error) G_GNUC_MALLOC;
91 gboolean g_key_file_has_group (GKeyFile *key_file,
92 const gchar *group_name);
93 gboolean g_key_file_has_key (GKeyFile *key_file,
94 const gchar *group_name,
97 gchar *g_key_file_get_value (GKeyFile *key_file,
98 const gchar *group_name,
100 GError **error) G_GNUC_MALLOC;
101 void g_key_file_set_value (GKeyFile *key_file,
102 const gchar *group_name,
105 gchar *g_key_file_get_string (GKeyFile *key_file,
106 const gchar *group_name,
108 GError **error) G_GNUC_MALLOC;
109 void g_key_file_set_string (GKeyFile *key_file,
110 const gchar *group_name,
112 const gchar *string);
113 gchar *g_key_file_get_locale_string (GKeyFile *key_file,
114 const gchar *group_name,
117 GError **error) G_GNUC_MALLOC;
118 void g_key_file_set_locale_string (GKeyFile *key_file,
119 const gchar *group_name,
122 const gchar *string);
123 gboolean g_key_file_get_boolean (GKeyFile *key_file,
124 const gchar *group_name,
127 void g_key_file_set_boolean (GKeyFile *key_file,
128 const gchar *group_name,
131 gint g_key_file_get_integer (GKeyFile *key_file,
132 const gchar *group_name,
135 void g_key_file_set_integer (GKeyFile *key_file,
136 const gchar *group_name,
139 gint64 g_key_file_get_int64 (GKeyFile *key_file,
140 const gchar *group_name,
143 void g_key_file_set_int64 (GKeyFile *key_file,
144 const gchar *group_name,
147 guint64 g_key_file_get_uint64 (GKeyFile *key_file,
148 const gchar *group_name,
151 void g_key_file_set_uint64 (GKeyFile *key_file,
152 const gchar *group_name,
155 gdouble g_key_file_get_double (GKeyFile *key_file,
156 const gchar *group_name,
159 void g_key_file_set_double (GKeyFile *key_file,
160 const gchar *group_name,
163 gchar **g_key_file_get_string_list (GKeyFile *key_file,
164 const gchar *group_name,
167 GError **error) G_GNUC_MALLOC;
168 void g_key_file_set_string_list (GKeyFile *key_file,
169 const gchar *group_name,
171 const gchar * const list[],
173 gchar **g_key_file_get_locale_string_list (GKeyFile *key_file,
174 const gchar *group_name,
178 GError **error) G_GNUC_MALLOC;
179 void g_key_file_set_locale_string_list (GKeyFile *key_file,
180 const gchar *group_name,
183 const gchar * const list[],
185 gboolean *g_key_file_get_boolean_list (GKeyFile *key_file,
186 const gchar *group_name,
189 GError **error) G_GNUC_MALLOC;
190 void g_key_file_set_boolean_list (GKeyFile *key_file,
191 const gchar *group_name,
195 gint *g_key_file_get_integer_list (GKeyFile *key_file,
196 const gchar *group_name,
199 GError **error) G_GNUC_MALLOC;
200 void g_key_file_set_double_list (GKeyFile *key_file,
201 const gchar *group_name,
205 gdouble *g_key_file_get_double_list (GKeyFile *key_file,
206 const gchar *group_name,
209 GError **error) G_GNUC_MALLOC;
210 void g_key_file_set_integer_list (GKeyFile *key_file,
211 const gchar *group_name,
215 gboolean g_key_file_set_comment (GKeyFile *key_file,
216 const gchar *group_name,
218 const gchar *comment,
220 gchar *g_key_file_get_comment (GKeyFile *key_file,
221 const gchar *group_name,
223 GError **error) G_GNUC_MALLOC;
225 gboolean g_key_file_remove_comment (GKeyFile *key_file,
226 const gchar *group_name,
229 gboolean g_key_file_remove_key (GKeyFile *key_file,
230 const gchar *group_name,
233 gboolean g_key_file_remove_group (GKeyFile *key_file,
234 const gchar *group_name,
237 /* Defines for handling freedesktop.org Desktop files */
238 #define G_KEY_FILE_DESKTOP_GROUP "Desktop Entry"
240 #define G_KEY_FILE_DESKTOP_KEY_TYPE "Type"
241 #define G_KEY_FILE_DESKTOP_KEY_VERSION "Version"
242 #define G_KEY_FILE_DESKTOP_KEY_NAME "Name"
243 #define G_KEY_FILE_DESKTOP_KEY_GENERIC_NAME "GenericName"
244 #define G_KEY_FILE_DESKTOP_KEY_NO_DISPLAY "NoDisplay"
245 #define G_KEY_FILE_DESKTOP_KEY_COMMENT "Comment"
246 #define G_KEY_FILE_DESKTOP_KEY_ICON "Icon"
247 #define G_KEY_FILE_DESKTOP_KEY_HIDDEN "Hidden"
248 #define G_KEY_FILE_DESKTOP_KEY_ONLY_SHOW_IN "OnlyShowIn"
249 #define G_KEY_FILE_DESKTOP_KEY_NOT_SHOW_IN "NotShowIn"
250 #define G_KEY_FILE_DESKTOP_KEY_TRY_EXEC "TryExec"
251 #define G_KEY_FILE_DESKTOP_KEY_EXEC "Exec"
252 #define G_KEY_FILE_DESKTOP_KEY_PATH "Path"
253 #define G_KEY_FILE_DESKTOP_KEY_TERMINAL "Terminal"
254 #define G_KEY_FILE_DESKTOP_KEY_MIME_TYPE "MimeType"
255 #define G_KEY_FILE_DESKTOP_KEY_CATEGORIES "Categories"
256 #define G_KEY_FILE_DESKTOP_KEY_STARTUP_NOTIFY "StartupNotify"
257 #define G_KEY_FILE_DESKTOP_KEY_STARTUP_WM_CLASS "StartupWMClass"
258 #define G_KEY_FILE_DESKTOP_KEY_URL "URL"
260 #define G_KEY_FILE_DESKTOP_TYPE_APPLICATION "Application"
261 #define G_KEY_FILE_DESKTOP_TYPE_LINK "Link"
262 #define G_KEY_FILE_DESKTOP_TYPE_DIRECTORY "Directory"
266 #endif /* __G_KEY_FILE_H__ */