File indexing completed on 2024-11-15 09:42:00
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023 #ifndef __G_KEY_FILE_H__
0024 #define __G_KEY_FILE_H__
0025
0026 #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
0027 #error "Only <glib.h> can be included directly."
0028 #endif
0029
0030 #include <glib/gbytes.h>
0031 #include <glib/gerror.h>
0032
0033 G_BEGIN_DECLS
0034
0035 typedef enum
0036 {
0037 G_KEY_FILE_ERROR_UNKNOWN_ENCODING,
0038 G_KEY_FILE_ERROR_PARSE,
0039 G_KEY_FILE_ERROR_NOT_FOUND,
0040 G_KEY_FILE_ERROR_KEY_NOT_FOUND,
0041 G_KEY_FILE_ERROR_GROUP_NOT_FOUND,
0042 G_KEY_FILE_ERROR_INVALID_VALUE
0043 } GKeyFileError;
0044
0045 #define G_KEY_FILE_ERROR g_key_file_error_quark()
0046
0047 GLIB_AVAILABLE_IN_ALL
0048 GQuark g_key_file_error_quark (void);
0049
0050 typedef struct _GKeyFile GKeyFile;
0051
0052 typedef enum
0053 {
0054 G_KEY_FILE_NONE = 0,
0055 G_KEY_FILE_KEEP_COMMENTS = 1 << 0,
0056 G_KEY_FILE_KEEP_TRANSLATIONS = 1 << 1
0057 } GKeyFileFlags;
0058
0059 GLIB_AVAILABLE_IN_ALL
0060 GKeyFile *g_key_file_new (void);
0061 GLIB_AVAILABLE_IN_ALL
0062 GKeyFile *g_key_file_ref (GKeyFile *key_file);
0063 GLIB_AVAILABLE_IN_ALL
0064 void g_key_file_unref (GKeyFile *key_file);
0065 GLIB_AVAILABLE_IN_ALL
0066 void g_key_file_free (GKeyFile *key_file);
0067 GLIB_AVAILABLE_IN_ALL
0068 void g_key_file_set_list_separator (GKeyFile *key_file,
0069 gchar separator);
0070 GLIB_AVAILABLE_IN_ALL
0071 gboolean g_key_file_load_from_file (GKeyFile *key_file,
0072 const gchar *file,
0073 GKeyFileFlags flags,
0074 GError **error);
0075 GLIB_AVAILABLE_IN_ALL
0076 gboolean g_key_file_load_from_data (GKeyFile *key_file,
0077 const gchar *data,
0078 gsize length,
0079 GKeyFileFlags flags,
0080 GError **error);
0081 GLIB_AVAILABLE_IN_2_50
0082 gboolean g_key_file_load_from_bytes (GKeyFile *key_file,
0083 GBytes *bytes,
0084 GKeyFileFlags flags,
0085 GError **error);
0086 GLIB_AVAILABLE_IN_ALL
0087 gboolean g_key_file_load_from_dirs (GKeyFile *key_file,
0088 const gchar *file,
0089 const gchar **search_dirs,
0090 gchar **full_path,
0091 GKeyFileFlags flags,
0092 GError **error);
0093 GLIB_AVAILABLE_IN_ALL
0094 gboolean g_key_file_load_from_data_dirs (GKeyFile *key_file,
0095 const gchar *file,
0096 gchar **full_path,
0097 GKeyFileFlags flags,
0098 GError **error);
0099 GLIB_AVAILABLE_IN_ALL
0100 gchar *g_key_file_to_data (GKeyFile *key_file,
0101 gsize *length,
0102 GError **error) G_GNUC_MALLOC;
0103 GLIB_AVAILABLE_IN_2_40
0104 gboolean g_key_file_save_to_file (GKeyFile *key_file,
0105 const gchar *filename,
0106 GError **error);
0107 GLIB_AVAILABLE_IN_ALL
0108 gchar *g_key_file_get_start_group (GKeyFile *key_file) G_GNUC_MALLOC;
0109 GLIB_AVAILABLE_IN_ALL
0110 gchar **g_key_file_get_groups (GKeyFile *key_file,
0111 gsize *length);
0112 GLIB_AVAILABLE_IN_ALL
0113 gchar **g_key_file_get_keys (GKeyFile *key_file,
0114 const gchar *group_name,
0115 gsize *length,
0116 GError **error);
0117 GLIB_AVAILABLE_IN_ALL
0118 gboolean g_key_file_has_group (GKeyFile *key_file,
0119 const gchar *group_name);
0120 GLIB_AVAILABLE_IN_ALL
0121 gboolean g_key_file_has_key (GKeyFile *key_file,
0122 const gchar *group_name,
0123 const gchar *key,
0124 GError **error);
0125 GLIB_AVAILABLE_IN_ALL
0126 gchar *g_key_file_get_value (GKeyFile *key_file,
0127 const gchar *group_name,
0128 const gchar *key,
0129 GError **error) G_GNUC_MALLOC;
0130 GLIB_AVAILABLE_IN_ALL
0131 void g_key_file_set_value (GKeyFile *key_file,
0132 const gchar *group_name,
0133 const gchar *key,
0134 const gchar *value);
0135 GLIB_AVAILABLE_IN_ALL
0136 gchar *g_key_file_get_string (GKeyFile *key_file,
0137 const gchar *group_name,
0138 const gchar *key,
0139 GError **error) G_GNUC_MALLOC;
0140 GLIB_AVAILABLE_IN_ALL
0141 void g_key_file_set_string (GKeyFile *key_file,
0142 const gchar *group_name,
0143 const gchar *key,
0144 const gchar *string);
0145 GLIB_AVAILABLE_IN_ALL
0146 gchar *g_key_file_get_locale_string (GKeyFile *key_file,
0147 const gchar *group_name,
0148 const gchar *key,
0149 const gchar *locale,
0150 GError **error) G_GNUC_MALLOC;
0151 GLIB_AVAILABLE_IN_2_56
0152 gchar *g_key_file_get_locale_for_key (GKeyFile *key_file,
0153 const gchar *group_name,
0154 const gchar *key,
0155 const gchar *locale) G_GNUC_MALLOC;
0156 GLIB_AVAILABLE_IN_ALL
0157 void g_key_file_set_locale_string (GKeyFile *key_file,
0158 const gchar *group_name,
0159 const gchar *key,
0160 const gchar *locale,
0161 const gchar *string);
0162 GLIB_AVAILABLE_IN_ALL
0163 gboolean g_key_file_get_boolean (GKeyFile *key_file,
0164 const gchar *group_name,
0165 const gchar *key,
0166 GError **error);
0167 GLIB_AVAILABLE_IN_ALL
0168 void g_key_file_set_boolean (GKeyFile *key_file,
0169 const gchar *group_name,
0170 const gchar *key,
0171 gboolean value);
0172 GLIB_AVAILABLE_IN_ALL
0173 gint g_key_file_get_integer (GKeyFile *key_file,
0174 const gchar *group_name,
0175 const gchar *key,
0176 GError **error);
0177 GLIB_AVAILABLE_IN_ALL
0178 void g_key_file_set_integer (GKeyFile *key_file,
0179 const gchar *group_name,
0180 const gchar *key,
0181 gint value);
0182 GLIB_AVAILABLE_IN_ALL
0183 gint64 g_key_file_get_int64 (GKeyFile *key_file,
0184 const gchar *group_name,
0185 const gchar *key,
0186 GError **error);
0187 GLIB_AVAILABLE_IN_ALL
0188 void g_key_file_set_int64 (GKeyFile *key_file,
0189 const gchar *group_name,
0190 const gchar *key,
0191 gint64 value);
0192 GLIB_AVAILABLE_IN_ALL
0193 guint64 g_key_file_get_uint64 (GKeyFile *key_file,
0194 const gchar *group_name,
0195 const gchar *key,
0196 GError **error);
0197 GLIB_AVAILABLE_IN_ALL
0198 void g_key_file_set_uint64 (GKeyFile *key_file,
0199 const gchar *group_name,
0200 const gchar *key,
0201 guint64 value);
0202 GLIB_AVAILABLE_IN_ALL
0203 gdouble g_key_file_get_double (GKeyFile *key_file,
0204 const gchar *group_name,
0205 const gchar *key,
0206 GError **error);
0207 GLIB_AVAILABLE_IN_ALL
0208 void g_key_file_set_double (GKeyFile *key_file,
0209 const gchar *group_name,
0210 const gchar *key,
0211 gdouble value);
0212 GLIB_AVAILABLE_IN_ALL
0213 gchar **g_key_file_get_string_list (GKeyFile *key_file,
0214 const gchar *group_name,
0215 const gchar *key,
0216 gsize *length,
0217 GError **error);
0218 GLIB_AVAILABLE_IN_ALL
0219 void g_key_file_set_string_list (GKeyFile *key_file,
0220 const gchar *group_name,
0221 const gchar *key,
0222 const gchar * const list[],
0223 gsize length);
0224 GLIB_AVAILABLE_IN_ALL
0225 gchar **g_key_file_get_locale_string_list (GKeyFile *key_file,
0226 const gchar *group_name,
0227 const gchar *key,
0228 const gchar *locale,
0229 gsize *length,
0230 GError **error);
0231 GLIB_AVAILABLE_IN_ALL
0232 void g_key_file_set_locale_string_list (GKeyFile *key_file,
0233 const gchar *group_name,
0234 const gchar *key,
0235 const gchar *locale,
0236 const gchar * const list[],
0237 gsize length);
0238 GLIB_AVAILABLE_IN_ALL
0239 gboolean *g_key_file_get_boolean_list (GKeyFile *key_file,
0240 const gchar *group_name,
0241 const gchar *key,
0242 gsize *length,
0243 GError **error) G_GNUC_MALLOC;
0244 GLIB_AVAILABLE_IN_ALL
0245 void g_key_file_set_boolean_list (GKeyFile *key_file,
0246 const gchar *group_name,
0247 const gchar *key,
0248 gboolean list[],
0249 gsize length);
0250 GLIB_AVAILABLE_IN_ALL
0251 gint *g_key_file_get_integer_list (GKeyFile *key_file,
0252 const gchar *group_name,
0253 const gchar *key,
0254 gsize *length,
0255 GError **error) G_GNUC_MALLOC;
0256 GLIB_AVAILABLE_IN_ALL
0257 void g_key_file_set_double_list (GKeyFile *key_file,
0258 const gchar *group_name,
0259 const gchar *key,
0260 gdouble list[],
0261 gsize length);
0262 GLIB_AVAILABLE_IN_ALL
0263 gdouble *g_key_file_get_double_list (GKeyFile *key_file,
0264 const gchar *group_name,
0265 const gchar *key,
0266 gsize *length,
0267 GError **error) G_GNUC_MALLOC;
0268 GLIB_AVAILABLE_IN_ALL
0269 void g_key_file_set_integer_list (GKeyFile *key_file,
0270 const gchar *group_name,
0271 const gchar *key,
0272 gint list[],
0273 gsize length);
0274 GLIB_AVAILABLE_IN_ALL
0275 gboolean g_key_file_set_comment (GKeyFile *key_file,
0276 const gchar *group_name,
0277 const gchar *key,
0278 const gchar *comment,
0279 GError **error);
0280 GLIB_AVAILABLE_IN_ALL
0281 gchar *g_key_file_get_comment (GKeyFile *key_file,
0282 const gchar *group_name,
0283 const gchar *key,
0284 GError **error) G_GNUC_MALLOC;
0285
0286 GLIB_AVAILABLE_IN_ALL
0287 gboolean g_key_file_remove_comment (GKeyFile *key_file,
0288 const gchar *group_name,
0289 const gchar *key,
0290 GError **error);
0291 GLIB_AVAILABLE_IN_ALL
0292 gboolean g_key_file_remove_key (GKeyFile *key_file,
0293 const gchar *group_name,
0294 const gchar *key,
0295 GError **error);
0296 GLIB_AVAILABLE_IN_ALL
0297 gboolean g_key_file_remove_group (GKeyFile *key_file,
0298 const gchar *group_name,
0299 GError **error);
0300
0301
0302 #define G_KEY_FILE_DESKTOP_GROUP "Desktop Entry"
0303
0304 #define G_KEY_FILE_DESKTOP_KEY_TYPE "Type"
0305 #define G_KEY_FILE_DESKTOP_KEY_VERSION "Version"
0306 #define G_KEY_FILE_DESKTOP_KEY_NAME "Name"
0307 #define G_KEY_FILE_DESKTOP_KEY_GENERIC_NAME "GenericName"
0308 #define G_KEY_FILE_DESKTOP_KEY_NO_DISPLAY "NoDisplay"
0309 #define G_KEY_FILE_DESKTOP_KEY_COMMENT "Comment"
0310 #define G_KEY_FILE_DESKTOP_KEY_ICON "Icon"
0311 #define G_KEY_FILE_DESKTOP_KEY_HIDDEN "Hidden"
0312 #define G_KEY_FILE_DESKTOP_KEY_ONLY_SHOW_IN "OnlyShowIn"
0313 #define G_KEY_FILE_DESKTOP_KEY_NOT_SHOW_IN "NotShowIn"
0314 #define G_KEY_FILE_DESKTOP_KEY_TRY_EXEC "TryExec"
0315 #define G_KEY_FILE_DESKTOP_KEY_EXEC "Exec"
0316 #define G_KEY_FILE_DESKTOP_KEY_PATH "Path"
0317 #define G_KEY_FILE_DESKTOP_KEY_TERMINAL "Terminal"
0318 #define G_KEY_FILE_DESKTOP_KEY_MIME_TYPE "MimeType"
0319 #define G_KEY_FILE_DESKTOP_KEY_CATEGORIES "Categories"
0320 #define G_KEY_FILE_DESKTOP_KEY_STARTUP_NOTIFY "StartupNotify"
0321 #define G_KEY_FILE_DESKTOP_KEY_STARTUP_WM_CLASS "StartupWMClass"
0322 #define G_KEY_FILE_DESKTOP_KEY_URL "URL"
0323 #define G_KEY_FILE_DESKTOP_KEY_DBUS_ACTIVATABLE "DBusActivatable"
0324 #define G_KEY_FILE_DESKTOP_KEY_ACTIONS "Actions"
0325
0326 #define G_KEY_FILE_DESKTOP_TYPE_APPLICATION "Application"
0327 #define G_KEY_FILE_DESKTOP_TYPE_LINK "Link"
0328 #define G_KEY_FILE_DESKTOP_TYPE_DIRECTORY "Directory"
0329
0330 G_END_DECLS
0331
0332 #endif