gkeyfile.h File Reference

__G_KEY_FILE_H__

Enum GKeyFileError

G_KEY_FILE_ERROR

g_key_file_error_quark ( void )

IMPORT_C GQuarkg_key_file_error_quark(void)

Typedef GKeyFile

typedef struct _GKeyFileGKeyFile

Enum GKeyFileFlags

g_key_file_new ( void )

IMPORT_C GKeyFile *g_key_file_new(void)

g_key_file_new:

Creates a new empty GKeyFile object. Use g_key_file_load_from_file(), g_key_file_load_from_data(), g_key_file_load_from_dirs() or g_key_file_load_from_data_dirs() to read an existing key file.

Return value: an empty GKeyFile.

Since: 2.6

g_key_file_free ( GKeyFile * )

IMPORT_C voidg_key_file_free(GKeyFile *key_file)

g_key_file_free: : a GKeyFile

Frees a GKeyFile.

Since: 2.6

g_key_file_set_list_separator ( GKeyFile *, gchar )

IMPORT_C voidg_key_file_set_list_separator(GKeyFile *key_file,
gcharseparator
)

g_key_file_set_list_separator: : a GKeyFile : the separator

Sets the character which is used to separate values in lists. Typically ';' or ',' are used as separators. The default list separator is ';'.

Since: 2.6

g_key_file_load_from_file ( GKeyFile *, const gchar *, GKeyFileFlags, GError ** )

IMPORT_C gbooleang_key_file_load_from_file(GKeyFile *key_file,
const gchar *file,
GKeyFileFlagsflags,
GError **error
)

g_key_file_load_from_data ( GKeyFile *, const gchar *, gsize, GKeyFileFlags, GError ** )

IMPORT_C gbooleang_key_file_load_from_data(GKeyFile *key_file,
const gchar *data,
gsizelength,
GKeyFileFlagsflags,
GError **error
)

g_key_file_load_from_data: : an empty GKeyFile struct : key file loaded in memory : the length of in bytes : flags from GKeyFileFlags : return location for a GError, or NULL

Loads a key file from memory into an empty GKeyFile structure. If the object cannot be created then error is set to a GKeyFileError.

Return value: TRUE if a key file could be loaded, FALSE otherwise

Since: 2.6

g_key_file_load_from_dirs ( GKeyFile *, const gchar *, const gchar **, gchar **, GKeyFileFlags, GError ** )

IMPORT_C gbooleang_key_file_load_from_dirs(GKeyFile *key_file,
const gchar *file,
const gchar **search_dirs,
gchar **full_path,
GKeyFileFlagsflags,
GError **error
)

g_key_file_load_from_data_dirs ( GKeyFile *, const gchar *, gchar **, GKeyFileFlags, GError ** )

IMPORT_C gbooleang_key_file_load_from_data_dirs(GKeyFile *key_file,
const gchar *file,
gchar **full_path,
GKeyFileFlagsflags,
GError **error
)

g_key_file_to_data ( GKeyFile *, gsize *, GError ** )

IMPORT_C gchar *g_key_file_to_data(GKeyFile *key_file,
gsize *length,
GError **error
)

g_key_file_to_data: : a GKeyFile : return location for the length of the returned string, or NULL : return location for a GError, or NULL

This function outputs as a string.

Note that this function never reports an error, so it is safe to pass NULL as .

Return value: a newly allocated string holding the contents of the GKeyFile

Since: 2.6

g_key_file_get_start_group ( GKeyFile * )

IMPORT_C gchar *g_key_file_get_start_group(GKeyFile *key_file)

g_key_file_get_start_group: : a GKeyFile

Returns the name of the start group of the file.

Return value: The start group of the key file.

Since: 2.6

g_key_file_get_groups ( GKeyFile *, gsize * )

IMPORT_C gchar **g_key_file_get_groups(GKeyFile *key_file,
gsize *length
)

g_key_file_get_groups: : a GKeyFile : return location for the number of returned groups, or NULL

Returns all groups in the key file loaded with . The array of returned groups will be NULL-terminated, so may optionally be NULL.

Return value: a newly-allocated NULL-terminated array of strings. Use g_strfreev() to free it. Since: 2.6

g_key_file_get_keys ( GKeyFile *, const gchar *, gsize *, GError ** )

IMPORT_C gchar **g_key_file_get_keys(GKeyFile *key_file,
const gchar *group_name,
gsize *length,
GError **error
)

g_key_file_get_keys: : a GKeyFile : a group name : return location for the number of keys returned, or NULL : return location for a GError, or NULL

Returns all keys for the group name . The array of returned keys will be NULL-terminated, so may optionally be NULL. In the event that the cannot be found, NULL is returned and is set to G_KEY_FILE_ERROR_GROUP_NOT_FOUND.

Return value: a newly-allocated NULL-terminated array of strings. Use g_strfreev() to free it.

Since: 2.6

g_key_file_has_group ( GKeyFile *, const gchar * )

IMPORT_C gbooleang_key_file_has_group(GKeyFile *key_file,
const gchar *group_name
)

g_key_file_has_group: : a GKeyFile : a group name

Looks whether the key file has the group .

Return value: TRUE if is a part of , FALSE otherwise. Since: 2.6

g_key_file_has_key ( GKeyFile *, const gchar *, const gchar *, GError ** )

IMPORT_C gbooleang_key_file_has_key(GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
GError **error
)

g_key_file_has_key: : a GKeyFile : a group name : a key name : return location for a GError

Looks whether the key file has the key in the group .

Return value: TRUE if is a part of , FALSE otherwise.

Since: 2.6

g_key_file_get_value ( GKeyFile *, const gchar *, const gchar *, GError ** )

IMPORT_C gchar *g_key_file_get_value(GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
GError **error
)

g_key_file_get_value: : a GKeyFile : a group name : a key : return location for a GError, or NULL

Returns the raw value associated with under . Use g_key_file_get_string() to retrieve an unescaped UTF-8 string.

In the event the key cannot be found, NULL is returned and is set to G_KEY_FILE_ERROR_KEY_NOT_FOUND. In the event that the cannot be found, NULL is returned and is set to G_KEY_FILE_ERROR_GROUP_NOT_FOUND.

Return value: a newly allocated string or NULL if the specified key cannot be found.

Since: 2.6

g_key_file_set_value ( GKeyFile *, const gchar *, const gchar *, const gchar * )

IMPORT_C voidg_key_file_set_value(GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
const gchar *value
)

g_key_file_set_value: : a GKeyFile : a group name : a key : a string

Associates a new value with under .

If cannot be found then it is created. If cannot be found then it is created. To set an UTF-8 string which may contain characters that need escaping (such as newlines or spaces), use g_key_file_set_string().

Since: 2.6

g_key_file_get_string ( GKeyFile *, const gchar *, const gchar *, GError ** )

IMPORT_C gchar *g_key_file_get_string(GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
GError **error
)

g_key_file_get_string: : a GKeyFile : a group name : a key : return location for a GError, or NULL

Returns the string value associated with under . Unlike g_key_file_get_value(), this function handles escape sequences like .

In the event the key cannot be found, NULL is returned and is set to G_KEY_FILE_ERROR_KEY_NOT_FOUND. In the event that the cannot be found, NULL is returned and is set to G_KEY_FILE_ERROR_GROUP_NOT_FOUND.

Return value: a newly allocated string or NULL if the specified key cannot be found.

Since: 2.6

g_key_file_set_string ( GKeyFile *, const gchar *, const gchar *, const gchar * )

IMPORT_C voidg_key_file_set_string(GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
const gchar *string
)

g_key_file_set_string: : a GKeyFile : a group name : a key : a string

Associates a new string value with under . If cannot be found then it is created. If cannot be found then it is created. Unlike g_key_file_set_value(), this function handles characters that need escaping, such as newlines.

Since: 2.6

g_key_file_get_locale_string ( GKeyFile *, const gchar *, const gchar *, const gchar *, GError ** )

IMPORT_C gchar *g_key_file_get_locale_string(GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
const gchar *locale,
GError **error
)

g_key_file_get_locale_string: : a GKeyFile : a group name : a key : a locale identifier or NULL : return location for a GError, or NULL

Returns the value associated with under translated in the given if available. If is NULL then the current locale is assumed.

If cannot be found then NULL is returned and is set to G_KEY_FILE_ERROR_KEY_NOT_FOUND. If the value associated with cannot be interpreted or no suitable translation can be found then the untranslated value is returned.

Return value: a newly allocated string or NULL if the specified key cannot be found.

Since: 2.6

g_key_file_set_locale_string ( GKeyFile *, const gchar *, const gchar *, const gchar *, const gchar * )

IMPORT_C voidg_key_file_set_locale_string(GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
const gchar *locale,
const gchar *string
)

g_key_file_set_locale_string: : a GKeyFile : a group name : a key : a locale identifier : a string

Associates a string value for and under . If the translation for cannot be found then it is created.

Since: 2.6

g_key_file_get_boolean ( GKeyFile *, const gchar *, const gchar *, GError ** )

IMPORT_C gbooleang_key_file_get_boolean(GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
GError **error
)

g_key_file_get_boolean: : a GKeyFile : a group name : a key : return location for a GError

Returns the value associated with under as a boolean.

If cannot be found then FALSE is returned and is set to G_KEY_FILE_ERROR_KEY_NOT_FOUND. Likewise, if the value associated with cannot be interpreted as a boolean then FALSE is returned and is set to G_KEY_FILE_ERROR_INVALID_VALUE.

Return value: the value associated with the key as a boolean, or FALSE if the key was not found or could not be parsed.

Since: 2.6

g_key_file_set_boolean ( GKeyFile *, const gchar *, const gchar *, gboolean )

IMPORT_C voidg_key_file_set_boolean(GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
gbooleanvalue
)

g_key_file_set_boolean: : a GKeyFile : a group name : a key : TRUE or FALSE

Associates a new boolean value with under . If cannot be found then it is created.

Since: 2.6

g_key_file_get_integer ( GKeyFile *, const gchar *, const gchar *, GError ** )

IMPORT_C gintg_key_file_get_integer(GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
GError **error
)

g_key_file_get_integer: : a GKeyFile : a group name : a key : return location for a GError

Returns the value associated with under as an integer.

If cannot be found then 0 is returned and is set to G_KEY_FILE_ERROR_KEY_NOT_FOUND. Likewise, if the value associated with cannot be interpreted as an integer then 0 is returned and is set to G_KEY_FILE_ERROR_INVALID_VALUE.

Return value: the value associated with the key as an integer, or 0 if the key was not found or could not be parsed.

Since: 2.6

g_key_file_set_integer ( GKeyFile *, const gchar *, const gchar *, gint )

IMPORT_C voidg_key_file_set_integer(GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
gintvalue
)

g_key_file_set_integer: : a GKeyFile : a group name : a key : an integer value

Associates a new integer value with under . If cannot be found then it is created.

Since: 2.6

g_key_file_get_double ( GKeyFile *, const gchar *, const gchar *, GError ** )

IMPORT_C gdoubleg_key_file_get_double(GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
GError **error
)

g_key_file_get_double: : a GKeyFile : a group name : a key : return location for a GError

Returns the value associated with under as a double. If is NULL, the start_group is used.

If cannot be found then 0.0 is returned and is set to G_KEY_FILE_ERROR_KEY_NOT_FOUND. Likewise, if the value associated with cannot be interpreted as a double then 0.0 is returned and is set to G_KEY_FILE_ERROR_INVALID_VALUE.

Return value: the value associated with the key as a double, or 0.0 if the key was not found or could not be parsed.

Since: 2.12

g_key_file_set_double ( GKeyFile *, const gchar *, const gchar *, gdouble )

IMPORT_C voidg_key_file_set_double(GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
gdoublevalue
)

g_key_file_set_double: : a GKeyFile : a group name : a key : an double value

Associates a new double value with under . If cannot be found then it is created.

Since: 2.12

g_key_file_get_string_list ( GKeyFile *, const gchar *, const gchar *, gsize *, GError ** )

IMPORT_C gchar **g_key_file_get_string_list(GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
gsize *length,
GError **error
)

g_key_file_get_string_list: : a GKeyFile : a group name : a key : return location for the number of returned strings, or NULL : return location for a GError, or NULL

Returns the values associated with under .

In the event the key cannot be found, NULL is returned and is set to G_KEY_FILE_ERROR_KEY_NOT_FOUND. In the event that the cannot be found, NULL is returned and is set to G_KEY_FILE_ERROR_GROUP_NOT_FOUND.

Return value: a NULL-terminated string array or NULL if the specified key cannot be found. The array should be freed with g_strfreev().

Since: 2.6

g_key_file_set_string_list ( GKeyFile *, const gchar *, const gchar *, const gchar *const, gsize )

IMPORT_C voidg_key_file_set_string_list(GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
const gchar *constlist,
gsizelength
)

g_key_file_set_string_list: : a GKeyFile : a group name : a key : an array of string values : number of string values in

Associates a list of string values for under . If cannot be found then it is created. If cannot be found then it is created.

Since: 2.6

g_key_file_get_locale_string_list ( GKeyFile *, const gchar *, const gchar *, const gchar *, gsize *, GError ** )

IMPORT_C gchar **g_key_file_get_locale_string_list(GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
const gchar *locale,
gsize *length,
GError **error
)

g_key_file_get_locale_string_list: : a GKeyFile : a group name : a key : a locale identifier or NULL : return location for the number of returned strings or NULL : return location for a GError or NULL

Returns the values associated with under translated in the given if available. If is NULL then the current locale is assumed.

If cannot be found then NULL is returned and is set to G_KEY_FILE_ERROR_KEY_NOT_FOUND. If the values associated with cannot be interpreted or no suitable translations can be found then the untranslated values are returned. The returned array is NULL-terminated, so may optionally be NULL.

Return value: a newly allocated NULL-terminated string array or NULL if the key isn't found. The string array should be freed with g_strfreev().

Since: 2.6

g_key_file_set_locale_string_list ( GKeyFile *, const gchar *, const gchar *, const gchar *, const gchar *const, gsize )

IMPORT_C voidg_key_file_set_locale_string_list(GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
const gchar *locale,
const gchar *constlist,
gsizelength
)

g_key_file_set_locale_string_list: : a GKeyFile : a group name : a key : a locale identifier : a NULL-terminated array of locale string values : the length of

Associates a list of string values for and under . If the translation for cannot be found then it is created.

Since: 2.6

g_key_file_get_boolean_list ( GKeyFile *, const gchar *, const gchar *, gsize *, GError ** )

IMPORT_C gboolean *g_key_file_get_boolean_list(GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
gsize *length,
GError **error
)

g_key_file_get_boolean_list: : a GKeyFile : a group name : a key : the number of booleans returned : return location for a GError

Returns the values associated with under as booleans.

If cannot be found then NULL is returned and is set to G_KEY_FILE_ERROR_KEY_NOT_FOUND. Likewise, if the values associated with cannot be interpreted as booleans then NULL is returned and is set to G_KEY_FILE_ERROR_INVALID_VALUE.

Return value: the values associated with the key as a list of booleans, or NULL if the key was not found or could not be parsed.

Since: 2.6

g_key_file_set_boolean_list ( GKeyFile *, const gchar *, const gchar *, gboolean, gsize )

IMPORT_C voidg_key_file_set_boolean_list(GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
gbooleanlist,
gsizelength
)

g_key_file_set_boolean_list: : a GKeyFile : a group name : a key : an array of boolean values : length of

Associates a list of boolean values with under . If cannot be found then it is created. If is NULL, the start_group is used.

Since: 2.6

g_key_file_get_integer_list ( GKeyFile *, const gchar *, const gchar *, gsize *, GError ** )

IMPORT_C gint *g_key_file_get_integer_list(GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
gsize *length,
GError **error
)

g_key_file_get_integer_list: : a GKeyFile : a group name : a key : the number of integers returned : return location for a GError

Returns the values associated with under as integers.

If cannot be found then NULL is returned and is set to G_KEY_FILE_ERROR_KEY_NOT_FOUND. Likewise, if the values associated with cannot be interpreted as integers then NULL is returned and is set to G_KEY_FILE_ERROR_INVALID_VALUE.

Return value: the values associated with the key as a list of integers, or NULL if the key was not found or could not be parsed.

Since: 2.6

g_key_file_set_double_list ( GKeyFile *, const gchar *, const gchar *, gdouble, gsize )

IMPORT_C voidg_key_file_set_double_list(GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
gdoublelist,
gsizelength
)

g_key_file_set_double_list: : a GKeyFile : a group name : a key : an array of double values : number of double values in

Associates a list of double values with under . If cannot be found then it is created.

Since: 2.12

g_key_file_get_double_list ( GKeyFile *, const gchar *, const gchar *, gsize *, GError ** )

IMPORT_C gdouble *g_key_file_get_double_list(GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
gsize *length,
GError **error
)

g_key_file_get_double_list: : a GKeyFile : a group name : a key : the number of doubles returned : return location for a GError

Returns the values associated with under as doubles.

If cannot be found then NULL is returned and is set to G_KEY_FILE_ERROR_KEY_NOT_FOUND. Likewise, if the values associated with cannot be interpreted as doubles then NULL is returned and is set to G_KEY_FILE_ERROR_INVALID_VALUE.

Return value: the values associated with the key as a list of doubles, or NULL if the key was not found or could not be parsed.

Since: 2.12

g_key_file_set_integer_list ( GKeyFile *, const gchar *, const gchar *, gint, gsize )

IMPORT_C voidg_key_file_set_integer_list(GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
gintlist,
gsizelength
)

g_key_file_set_integer_list: : a GKeyFile : a group name : a key : an array of integer values : number of integer values in

Associates a list of integer values with under . If cannot be found then it is created.

Since: 2.6

g_key_file_set_comment ( GKeyFile *, const gchar *, const gchar *, const gchar *, GError ** )

IMPORT_C gbooleang_key_file_set_comment(GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
const gchar *comment,
GError **error
)

g_key_file_set_comment: : a GKeyFile : a group name, or NULL : a key : a comment : return location for a GError

Places a comment above from . If is NULL then will be written above . If both and are NULL, then will be written above the first group in the file.

Returns: TRUE if the comment was written, FALSE otherwise

Since: 2.6

g_key_file_get_comment ( GKeyFile *, const gchar *, const gchar *, GError ** )

IMPORT_C gchar *g_key_file_get_comment(GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
GError **error
)

g_key_file_get_comment: : a GKeyFile : a group name, or NULL : a key : return location for a GError

Retrieves a comment above from . If is NULL then will be read from above . If both and are NULL, then will be read from above the first group in the file.

Returns: a comment that should be freed with g_free()

Since: 2.6

g_key_file_remove_comment ( GKeyFile *, const gchar *, const gchar *, GError ** )

IMPORT_C gbooleang_key_file_remove_comment(GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
GError **error
)

g_key_file_remove_comment: : a GKeyFile : a group name, or NULL : a key : return location for a GError

Removes a comment above from . If is NULL then will be removed above . If both and are NULL, then will be removed above the first group in the file.

Returns: TRUE if the comment was removed, FALSE otherwise

Since: 2.6

g_key_file_remove_key ( GKeyFile *, const gchar *, const gchar *, GError ** )

IMPORT_C gbooleang_key_file_remove_key(GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
GError **error
)

g_key_file_remove_key: : a GKeyFile : a group name : a key name to remove : return location for a GError or NULL

Removes in from the key file.

Returns: TRUE if the key was removed, FALSE otherwise

Since: 2.6

g_key_file_remove_group ( GKeyFile *, const gchar *, GError ** )

IMPORT_C gbooleang_key_file_remove_group(GKeyFile *key_file,
const gchar *group_name,
GError **error
)

g_key_file_remove_group: : a GKeyFile : a group name : return location for a GError or NULL

Removes the specified group, , from the key file.

Returns: TRUE if the group was removed, FALSE otherwise

Since: 2.6

G_KEY_FILE_DESKTOP_GROUP

G_KEY_FILE_DESKTOP_KEY_TYPE

G_KEY_FILE_DESKTOP_KEY_VERSION

G_KEY_FILE_DESKTOP_KEY_NAME

G_KEY_FILE_DESKTOP_KEY_GENERIC_NAME

G_KEY_FILE_DESKTOP_KEY_NO_DISPLAY

G_KEY_FILE_DESKTOP_KEY_COMMENT

G_KEY_FILE_DESKTOP_KEY_ICON

G_KEY_FILE_DESKTOP_KEY_HIDDEN

G_KEY_FILE_DESKTOP_KEY_ONLY_SHOW_IN

G_KEY_FILE_DESKTOP_KEY_NOT_SHOW_IN

G_KEY_FILE_DESKTOP_KEY_TRY_EXEC

G_KEY_FILE_DESKTOP_KEY_EXEC

G_KEY_FILE_DESKTOP_KEY_PATH

G_KEY_FILE_DESKTOP_KEY_TERMINAL

G_KEY_FILE_DESKTOP_KEY_MIME_TYPE

G_KEY_FILE_DESKTOP_KEY_CATEGORIES

G_KEY_FILE_DESKTOP_KEY_STARTUP_NOTIFY

G_KEY_FILE_DESKTOP_KEY_STARTUP_WM_CLASS

G_KEY_FILE_DESKTOP_KEY_URL

G_KEY_FILE_DESKTOP_TYPE_APPLICATION

G_KEY_FILE_DESKTOP_TYPE_LINK

G_KEY_FILE_DESKTOP_TYPE_DIRECTORY