![]() |
![]() |
![]() |
GLib Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
#include <glib.h> GKeyFile; #define G_KEY_FILE_ERROR enum GKeyFileError; enum GKeyFileFlags; GKeyFile * g_key_file_new (void); void g_key_file_free (GKeyFile *key_file); void g_key_file_set_list_separator (GKeyFile *key_file, gchar separator); gboolean g_key_file_load_from_file (GKeyFile *key_file, const gchar *file, GKeyFileFlags flags, GError **error); gboolean g_key_file_load_from_data (GKeyFile *key_file, const gchar *data, gsize length, GKeyFileFlags flags, GError **error); gboolean g_key_file_load_from_data_dirs (GKeyFile *key_file, const gchar *file, gchar **full_path, GKeyFileFlags flags, GError **error); gboolean g_key_file_load_from_dirs (GKeyFile *key_file, const gchar *file, const gchar **search_dirs, gchar **full_path, GKeyFileFlags flags, GError **error); gchar * g_key_file_to_data (GKeyFile *key_file, gsize *length, GError **error); gchar * g_key_file_get_start_group (GKeyFile *key_file); gchar ** g_key_file_get_groups (GKeyFile *key_file, gsize *length); gchar ** g_key_file_get_keys (GKeyFile *key_file, const gchar *group_name, gsize *length, GError **error); gboolean g_key_file_has_group (GKeyFile *key_file, const gchar *group_name); gboolean g_key_file_has_key (GKeyFile *key_file, const gchar *group_name, const gchar *key, GError **error); gchar * g_key_file_get_value (GKeyFile *key_file, const gchar *group_name, const gchar *key, GError **error); gchar * g_key_file_get_string (GKeyFile *key_file, const gchar *group_name, const gchar *key, GError **error); gchar * g_key_file_get_locale_string (GKeyFile *key_file, const gchar *group_name, const gchar *key, const gchar *locale, GError **error); gboolean g_key_file_get_boolean (GKeyFile *key_file, const gchar *group_name, const gchar *key, GError **error); gint g_key_file_get_integer (GKeyFile *key_file, const gchar *group_name, const gchar *key, GError **error); gint64 g_key_file_get_int64 (GKeyFile *key_file, const gchar *group_name, const gchar *key, GError **error); guint64 g_key_file_get_uint64 (GKeyFile *key_file, const gchar *group_name, const gchar *key, GError **error); gdouble g_key_file_get_double (GKeyFile *key_file, const gchar *group_name, const gchar *key, GError **error); gchar ** g_key_file_get_string_list (GKeyFile *key_file, const gchar *group_name, const gchar *key, gsize *length, GError **error); 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); gboolean * g_key_file_get_boolean_list (GKeyFile *key_file, const gchar *group_name, const gchar *key, gsize *length, GError **error); gint * g_key_file_get_integer_list (GKeyFile *key_file, const gchar *group_name, const gchar *key, gsize *length, GError **error); gdouble * g_key_file_get_double_list (GKeyFile *key_file, const gchar *group_name, const gchar *key, gsize *length, GError **error); gchar * g_key_file_get_comment (GKeyFile *key_file, const gchar *group_name, const gchar *key, GError **error); void g_key_file_set_value (GKeyFile *key_file, const gchar *group_name, const gchar *key, const gchar *value); void g_key_file_set_string (GKeyFile *key_file, const gchar *group_name, const gchar *key, const gchar *string); void g_key_file_set_locale_string (GKeyFile *key_file, const gchar *group_name, const gchar *key, const gchar *locale, const gchar *string); void g_key_file_set_boolean (GKeyFile *key_file, const gchar *group_name, const gchar *key, gboolean value); void g_key_file_set_integer (GKeyFile *key_file, const gchar *group_name, const gchar *key, gint value); void g_key_file_set_int64 (GKeyFile *key_file, const gchar *group_name, const gchar *key, gint64 value); void g_key_file_set_uint64 (GKeyFile *key_file, const gchar *group_name, const gchar *key, guint64 value); void g_key_file_set_double (GKeyFile *key_file, const gchar *group_name, const gchar *key, gdouble value); void g_key_file_set_string_list (GKeyFile *key_file, const gchar *group_name, const gchar *key, const gchar * const list[], gsize length); void g_key_file_set_locale_string_list (GKeyFile *key_file, const gchar *group_name, const gchar *key, const gchar *locale, const gchar * const list[], gsize length); void g_key_file_set_boolean_list (GKeyFile *key_file, const gchar *group_name, const gchar *key, gboolean list[], gsize length); void g_key_file_set_integer_list (GKeyFile *key_file, const gchar *group_name, const gchar *key, gint list[], gsize length); void g_key_file_set_double_list (GKeyFile *key_file, const gchar *group_name, const gchar *key, gdouble list[], gsize length); gboolean g_key_file_set_comment (GKeyFile *key_file, const gchar *group_name, const gchar *key, const gchar *comment, GError **error); gboolean g_key_file_remove_group (GKeyFile *key_file, const gchar *group_name, GError **error); gboolean g_key_file_remove_key (GKeyFile *key_file, const gchar *group_name, const gchar *key, GError **error); gboolean g_key_file_remove_comment (GKeyFile *key_file, const gchar *group_name, const gchar *key, GError **error); #define G_KEY_FILE_DESKTOP_GROUP #define G_KEY_FILE_DESKTOP_KEY_TYPE #define G_KEY_FILE_DESKTOP_KEY_VERSION #define G_KEY_FILE_DESKTOP_KEY_NAME #define G_KEY_FILE_DESKTOP_KEY_GENERIC_NAME #define G_KEY_FILE_DESKTOP_KEY_NO_DISPLAY #define G_KEY_FILE_DESKTOP_KEY_COMMENT #define G_KEY_FILE_DESKTOP_KEY_ICON #define G_KEY_FILE_DESKTOP_KEY_HIDDEN #define G_KEY_FILE_DESKTOP_KEY_ONLY_SHOW_IN #define G_KEY_FILE_DESKTOP_KEY_NOT_SHOW_IN #define G_KEY_FILE_DESKTOP_KEY_TRY_EXEC #define G_KEY_FILE_DESKTOP_KEY_EXEC #define G_KEY_FILE_DESKTOP_KEY_PATH #define G_KEY_FILE_DESKTOP_KEY_TERMINAL #define G_KEY_FILE_DESKTOP_KEY_MIME_TYPE #define G_KEY_FILE_DESKTOP_KEY_CATEGORIES #define G_KEY_FILE_DESKTOP_KEY_STARTUP_NOTIFY #define G_KEY_FILE_DESKTOP_KEY_STARTUP_WM_CLASS #define G_KEY_FILE_DESKTOP_KEY_URL #define G_KEY_FILE_DESKTOP_TYPE_APPLICATION #define G_KEY_FILE_DESKTOP_TYPE_LINK #define G_KEY_FILE_DESKTOP_TYPE_DIRECTORY
typedef enum { G_KEY_FILE_ERROR_UNKNOWN_ENCODING, G_KEY_FILE_ERROR_PARSE, G_KEY_FILE_ERROR_NOT_FOUND, G_KEY_FILE_ERROR_KEY_NOT_FOUND, G_KEY_FILE_ERROR_GROUP_NOT_FOUND, G_KEY_FILE_ERROR_INVALID_VALUE } GKeyFileError;
typedef enum { G_KEY_FILE_NONE = 0, G_KEY_FILE_KEEP_COMMENTS = 1 << 0, G_KEY_FILE_KEEP_TRANSLATIONS = 1 << 1 } GKeyFileFlags;
GKeyFile * g_key_file_new (void);
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.
Returns : |
an empty GKeyFile. |
Since 2.6
void g_key_file_free (GKeyFile *key_file);
Frees a GKeyFile.
|
a GKeyFile |
Since 2.6
void g_key_file_set_list_separator (GKeyFile *key_file, gchar separator);
Sets the character which is used to separate values in lists. Typically ';' or ',' are used as separators. The default list separator is ';'.
|
a GKeyFile |
|
the separator |
Since 2.6
gboolean g_key_file_load_from_file (GKeyFile *key_file, const gchar *file, GKeyFileFlags flags, GError **error);
Loads a key file into an empty GKeyFile structure.
If the file could not be loaded then error
is set to
either a GFileError or GKeyFileError.
|
an empty GKeyFile struct |
|
the path of a filename to load, in the GLib filename encoding |
|
flags from GKeyFileFlags |
|
return location for a GError, or NULL
|
Returns : |
TRUE if a key file could be loaded, FALSE otherwise
|
Since 2.6
gboolean g_key_file_load_from_data (GKeyFile *key_file, const gchar *data, gsize length, GKeyFileFlags flags, GError **error);
Loads a key file from memory into an empty GKeyFile structure.
If the object cannot be created then error
is set to a GKeyFileError.
|
an empty GKeyFile struct |
|
key file loaded in memory |
|
the length of data in bytes
|
|
flags from GKeyFileFlags |
|
return location for a GError, or NULL
|
Returns : |
TRUE if a key file could be loaded, FALSE otherwise
|
Since 2.6
gboolean g_key_file_load_from_data_dirs (GKeyFile *key_file, const gchar *file, gchar **full_path, GKeyFileFlags flags, GError **error);
This function looks for a key file named file
in the paths
returned from g_get_user_data_dir()
and g_get_system_data_dirs()
,
loads the file into key_file
and returns the file's full path in
full_path
. If the file could not be loaded then an error
is
set to either a GFileError or GKeyFileError.
|
an empty GKeyFile struct |
|
a relative path to a filename to open and parse |
|
return location for a string containing the full path
of the file, or NULL
|
|
flags from GKeyFileFlags |
|
return location for a GError, or NULL
|
Returns : |
TRUE if a key file could be loaded, FALSE othewise
|
Since 2.6
gboolean g_key_file_load_from_dirs (GKeyFile *key_file, const gchar *file, const gchar **search_dirs, gchar **full_path, GKeyFileFlags flags, GError **error);
This function looks for a key file named file
in the paths
specified in search_dirs
, loads the file into key_file
and
returns the file's full path in full_path
. If the file could not
be loaded then an error
is set to either a GFileError or
GKeyFileError.
|
an empty GKeyFile struct |
|
a relative path to a filename to open and parse |
|
NULL -terminated array of directories to search
|
|
return location for a string containing the full path
of the file, or NULL
|
|
flags from GKeyFileFlags |
|
return location for a GError, or NULL
|
Returns : |
TRUE if a key file could be loaded, FALSE otherwise
|
Since 2.14
gchar * g_key_file_to_data (GKeyFile *key_file, gsize *length, GError **error);
This function outputs key_file
as a string.
Note that this function never reports an error,
so it is safe to pass NULL
as error
.
|
a GKeyFile |
|
return location for the length of the
returned string, or NULL
|
|
return location for a GError, or NULL
|
Returns : |
a newly allocated string holding the contents of the GKeyFile |
Since 2.6
gchar * g_key_file_get_start_group (GKeyFile *key_file);
Returns the name of the start group of the file.
|
a GKeyFile |
Returns : |
The start group of the key file. |
Since 2.6
gchar ** g_key_file_get_groups (GKeyFile *key_file, gsize *length);
Returns all groups in the key file loaded with key_file
.
The array of returned groups will be NULL
-terminated, so
length
may optionally be NULL
.
|
a GKeyFile |
|
return location for the number of returned groups, or NULL
|
Returns : |
a newly-allocated NULL -terminated array of strings.
Use g_strfreev() to free it.
|
Since 2.6
gchar ** g_key_file_get_keys (GKeyFile *key_file, const gchar *group_name, gsize *length, GError **error);
Returns all keys for the group name group_name
. The array of
returned keys will be NULL
-terminated, so length
may
optionally be NULL
. In the event that the group_name
cannot
be found, NULL
is returned and error
is set to
G_KEY_FILE_ERROR_GROUP_NOT_FOUND.
|
a GKeyFile |
|
a group name |
|
return location for the number of keys returned, or NULL
|
|
return location for a GError, or NULL
|
Returns : |
a newly-allocated NULL -terminated array of strings.
Use g_strfreev() to free it.
|
Since 2.6
gboolean g_key_file_has_group (GKeyFile *key_file, const gchar *group_name);
Looks whether the key file has the group group_name
.
|
a GKeyFile |
|
a group name |
Returns : |
TRUE if group_name is a part of key_file , FALSE
otherwise.
|
Since 2.6
gboolean g_key_file_has_key (GKeyFile *key_file, const gchar *group_name, const gchar *key, GError **error);
Looks whether the key file has the key key
in the group
group_name
.
|
a GKeyFile |
|
a group name |
|
a key name |
|
return location for a GError |
Returns : |
TRUE if key is a part of group_name , FALSE
otherwise.
|
Since 2.6
gchar * g_key_file_get_value (GKeyFile *key_file, const gchar *group_name, const gchar *key, GError **error);
Returns the raw value associated with key
under group_name
.
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
error
is set to G_KEY_FILE_ERROR_KEY_NOT_FOUND. In the
event that the group_name
cannot be found, NULL
is returned
and error
is set to G_KEY_FILE_ERROR_GROUP_NOT_FOUND.
|
a GKeyFile |
|
a group name |
|
a key |
|
return location for a GError, or NULL
|
Returns : |
a newly allocated string or NULL if the specified
key cannot be found.
|
Since 2.6
gchar * g_key_file_get_string (GKeyFile *key_file, const gchar *group_name, const gchar *key, GError **error);
Returns the string value associated with key
under group_name
.
Unlike g_key_file_get_value()
, this function handles escape sequences
like \s.
In the event the key cannot be found, NULL
is returned and
error
is set to G_KEY_FILE_ERROR_KEY_NOT_FOUND. In the
event that the group_name
cannot be found, NULL
is returned
and error
is set to G_KEY_FILE_ERROR_GROUP_NOT_FOUND.
|
a GKeyFile |
|
a group name |
|
a key |
|
return location for a GError, or NULL
|
Returns : |
a newly allocated string or NULL if the specified
key cannot be found.
|
Since 2.6
gchar * g_key_file_get_locale_string (GKeyFile *key_file, const gchar *group_name, const gchar *key, const gchar *locale, GError **error);
Returns the value associated with key
under group_name
translated in the given locale
if available. If locale
is
NULL
then the current locale is assumed.
If key
cannot be found then NULL
is returned and error
is set
to G_KEY_FILE_ERROR_KEY_NOT_FOUND. If the value associated
with key
cannot be interpreted or no suitable translation can
be found then the untranslated value is returned.
|
a GKeyFile |
|
a group name |
|
a key |
|
a locale identifier or NULL
|
|
return location for a GError, or NULL
|
Returns : |
a newly allocated string or NULL if the specified
key cannot be found.
|
Since 2.6
gboolean g_key_file_get_boolean (GKeyFile *key_file, const gchar *group_name, const gchar *key, GError **error);
Returns the value associated with key
under group_name
as a
boolean.
If key
cannot be found then FALSE
is returned and error
is set
to G_KEY_FILE_ERROR_KEY_NOT_FOUND. Likewise, if the value
associated with key
cannot be interpreted as a boolean then FALSE
is returned and error
is set to G_KEY_FILE_ERROR_INVALID_VALUE.
|
a GKeyFile |
|
a group name |
|
a key |
|
return location for a GError |
Returns : |
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
gint g_key_file_get_integer (GKeyFile *key_file, const gchar *group_name, const gchar *key, GError **error);
Returns the value associated with key
under group_name
as an
integer.
If key
cannot be found then 0 is returned and error
is set to
G_KEY_FILE_ERROR_KEY_NOT_FOUND. Likewise, if the value associated
with key
cannot be interpreted as an integer then 0 is returned
and error
is set to G_KEY_FILE_ERROR_INVALID_VALUE.
|
a GKeyFile |
|
a group name |
|
a key |
|
return location for a GError |
Returns : |
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
gint64 g_key_file_get_int64 (GKeyFile *key_file, const gchar *group_name, const gchar *key, GError **error);
Returns the value associated with key
under group_name
as a signed
64-bit integer. This is similar to g_key_file_get_integer()
but can return
64-bit results without truncation.
|
a non-NULL GKeyFile
|
|
a non-NULL group name
|
|
a non-NULL key
|
|
return location for a GError |
Returns : |
the value associated with the key as a signed 64-bit integer, or 0 if the key was not found or could not be parsed. |
Since 2.26
guint64 g_key_file_get_uint64 (GKeyFile *key_file, const gchar *group_name, const gchar *key, GError **error);
Returns the value associated with key
under group_name
as an unsigned
64-bit integer. This is similar to g_key_file_get_integer()
but can return
large positive results without truncation.
|
a non-NULL GKeyFile
|
|
a non-NULL group name
|
|
a non-NULL key
|
|
return location for a GError |
Returns : |
the value associated with the key as an unsigned 64-bit integer, or 0 if the key was not found or could not be parsed. |
Since 2.26
gdouble g_key_file_get_double (GKeyFile *key_file, const gchar *group_name, const gchar *key, GError **error);
Returns the value associated with key
under group_name
as a
double. If group_name
is NULL
, the start_group is used.
If key
cannot be found then 0.0 is returned and error
is set to
G_KEY_FILE_ERROR_KEY_NOT_FOUND. Likewise, if the value associated
with key
cannot be interpreted as a double then 0.0 is returned
and error
is set to G_KEY_FILE_ERROR_INVALID_VALUE.
|
a GKeyFile |
|
a group name |
|
a key |
|
return location for a GError |
Returns : |
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
gchar ** g_key_file_get_string_list (GKeyFile *key_file, const gchar *group_name, const gchar *key, gsize *length, GError **error);
Returns the values associated with key
under group_name
.
In the event the key cannot be found, NULL
is returned and
error
is set to G_KEY_FILE_ERROR_KEY_NOT_FOUND. In the
event that the group_name
cannot be found, NULL
is returned
and error
is set to G_KEY_FILE_ERROR_GROUP_NOT_FOUND.
|
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 : |
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
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);
Returns the values associated with key
under group_name
translated in the given locale
if available. If locale
is
NULL
then the current locale is assumed.
If key
cannot be found then NULL
is returned and error
is set
to G_KEY_FILE_ERROR_KEY_NOT_FOUND. If the values associated
with key
cannot be interpreted or no suitable translations
can be found then the untranslated values are returned. The
returned array is NULL
-terminated, so length
may optionally
be NULL
.
|
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 : |
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
gboolean * g_key_file_get_boolean_list (GKeyFile *key_file, const gchar *group_name, const gchar *key, gsize *length, GError **error);
Returns the values associated with key
under group_name
as
booleans.
If key
cannot be found then NULL
is returned and error
is set to
G_KEY_FILE_ERROR_KEY_NOT_FOUND. Likewise, if the values associated
with key
cannot be interpreted as booleans then NULL
is returned
and error
is set to G_KEY_FILE_ERROR_INVALID_VALUE.
|
a GKeyFile |
|
a group name |
|
a key |
|
the number of booleans returned |
|
return location for a GError |
Returns : |
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
gint * g_key_file_get_integer_list (GKeyFile *key_file, const gchar *group_name, const gchar *key, gsize *length, GError **error);
Returns the values associated with key
under group_name
as
integers.
If key
cannot be found then NULL
is returned and error
is set to
G_KEY_FILE_ERROR_KEY_NOT_FOUND. Likewise, if the values associated
with key
cannot be interpreted as integers then NULL
is returned
and error
is set to G_KEY_FILE_ERROR_INVALID_VALUE.
|
a GKeyFile |
|
a group name |
|
a key |
|
the number of integers returned |
|
return location for a GError |
Returns : |
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
gdouble * g_key_file_get_double_list (GKeyFile *key_file, const gchar *group_name, const gchar *key, gsize *length, GError **error);
Returns the values associated with key
under group_name
as
doubles.
If key
cannot be found then NULL
is returned and error
is set to
G_KEY_FILE_ERROR_KEY_NOT_FOUND. Likewise, if the values associated
with key
cannot be interpreted as doubles then NULL
is returned
and error
is set to G_KEY_FILE_ERROR_INVALID_VALUE.
|
a GKeyFile |
|
a group name |
|
a key |
|
the number of doubles returned |
|
return location for a GError |
Returns : |
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
gchar * g_key_file_get_comment (GKeyFile *key_file, const gchar *group_name, const gchar *key, GError **error);
Retrieves a comment above key
from group_name
.
If key
is NULL
then comment
will be read from above
group_name
. If both key
and group_name
are NULL
, then
comment
will be read from above the first group in the file.
|
a GKeyFile |
|
a group name, or NULL
|
|
a key |
|
return location for a GError |
Returns : |
a comment that should be freed with g_free()
|
Since 2.6
void g_key_file_set_value (GKeyFile *key_file, const gchar *group_name, const gchar *key, const gchar *value);
Associates a new value with key
under group_name
.
If key
cannot be found then it is created. If group_name
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()
.
|
a GKeyFile |
|
a group name |
|
a key |
|
a string |
Since 2.6
void g_key_file_set_string (GKeyFile *key_file, const gchar *group_name, const gchar *key, const gchar *string);
Associates a new string value with key
under group_name
.
If key
cannot be found then it is created.
If group_name
cannot be found then it is created.
Unlike g_key_file_set_value()
, this function handles characters
that need escaping, such as newlines.
|
a GKeyFile |
|
a group name |
|
a key |
|
a string |
Since 2.6
void g_key_file_set_locale_string (GKeyFile *key_file, const gchar *group_name, const gchar *key, const gchar *locale, const gchar *string);
Associates a string value for key
and locale
under group_name
.
If the translation for key
cannot be found then it is created.
|
a GKeyFile |
|
a group name |
|
a key |
|
a locale identifier |
|
a string |
Since 2.6
void g_key_file_set_boolean (GKeyFile *key_file, const gchar *group_name, const gchar *key, gboolean value);
Associates a new boolean value with key
under group_name
.
If key
cannot be found then it is created.
Since 2.6
void g_key_file_set_integer (GKeyFile *key_file, const gchar *group_name, const gchar *key, gint value);
Associates a new integer value with key
under group_name
.
If key
cannot be found then it is created.
|
a GKeyFile |
|
a group name |
|
a key |
|
an integer value |
Since 2.6
void g_key_file_set_int64 (GKeyFile *key_file, const gchar *group_name, const gchar *key, gint64 value);
Associates a new integer value with key
under group_name
.
If key
cannot be found then it is created.
|
a GKeyFile |
|
a group name |
|
a key |
|
an integer value |
Since 2.26
void g_key_file_set_uint64 (GKeyFile *key_file, const gchar *group_name, const gchar *key, guint64 value);
Associates a new integer value with key
under group_name
.
If key
cannot be found then it is created.
|
a GKeyFile |
|
a group name |
|
a key |
|
an integer value |
Since 2.26
void g_key_file_set_double (GKeyFile *key_file, const gchar *group_name, const gchar *key, gdouble value);
Associates a new double value with key
under group_name
.
If key
cannot be found then it is created.
|
a GKeyFile |
|
a group name |
|
a key |
|
an double value |
Since 2.12
void g_key_file_set_string_list (GKeyFile *key_file, const gchar *group_name, const gchar *key, const gchar * const list[], gsize length);
Associates a list of string values for key
under group_name
.
If key
cannot be found then it is created.
If group_name
cannot be found then it is created.
|
a GKeyFile |
|
a group name |
|
a key |
|
an array of string values |
|
number of string values in list
|
Since 2.6
void g_key_file_set_locale_string_list (GKeyFile *key_file, const gchar *group_name, const gchar *key, const gchar *locale, const gchar * const list[], gsize length);
Associates a list of string values for key
and locale
under
group_name
. If the translation for key
cannot be found then
it is created.
|
a GKeyFile |
|
a group name |
|
a key |
|
a locale identifier |
|
a NULL -terminated array of locale string values
|
|
the length of list
|
Since 2.6
void g_key_file_set_boolean_list (GKeyFile *key_file, const gchar *group_name, const gchar *key, gboolean list[], gsize length);
Associates a list of boolean values with key
under group_name
.
If key
cannot be found then it is created.
If group_name
is NULL
, the start_group is used.
|
a GKeyFile |
|
a group name |
|
a key |
|
an array of boolean values |
|
length of list
|
Since 2.6
void g_key_file_set_integer_list (GKeyFile *key_file, const gchar *group_name, const gchar *key, gint list[], gsize length);
Associates a list of integer values with key
under group_name
.
If key
cannot be found then it is created.
|
a GKeyFile |
|
a group name |
|
a key |
|
an array of integer values |
|
number of integer values in list
|
Since 2.6
void g_key_file_set_double_list (GKeyFile *key_file, const gchar *group_name, const gchar *key, gdouble list[], gsize length);
Associates a list of double values with key
under
group_name
. If key
cannot be found then it is created.
|
a GKeyFile |
|
a group name |
|
a key |
|
an array of double values |
|
number of double values in list
|
Since 2.12
gboolean g_key_file_set_comment (GKeyFile *key_file, const gchar *group_name, const gchar *key, const gchar *comment, GError **error);
Places a comment above key
from group_name
.
If key
is NULL
then comment
will be written above group_name
.
If both key
and group_name
are NULL
, then comment
will be
written above the first group in the file.
|
a GKeyFile |
|
a group name, or NULL
|
|
a key |
|
a comment |
|
return location for a GError |
Returns : |
TRUE if the comment was written, FALSE otherwise
|
Since 2.6
gboolean g_key_file_remove_group (GKeyFile *key_file, const gchar *group_name, GError **error);
Removes the specified group, group_name
,
from the key file.
|
a GKeyFile |
|
a group name |
|
return location for a GError or NULL
|
Returns : |
TRUE if the group was removed, FALSE otherwise
|
Since 2.6
gboolean g_key_file_remove_key (GKeyFile *key_file, const gchar *group_name, const gchar *key, GError **error);
Removes key
in group_name
from the key file.
|
a GKeyFile |
|
a group name |
|
a key name to remove |
|
return location for a GError or NULL
|
Returns : |
TRUE if the key was removed, FALSE otherwise
|
Since 2.6
gboolean g_key_file_remove_comment (GKeyFile *key_file, const gchar *group_name, const gchar *key, GError **error);
Removes a comment above key
from group_name
.
If key
is NULL
then comment
will be removed above group_name
.
If both key
and group_name
are NULL
, then comment
will
be removed above the first group in the file.
|
a GKeyFile |
|
a group name, or NULL
|
|
a key |
|
return location for a GError |
Returns : |
TRUE if the comment was removed, FALSE otherwise
|
Since 2.6
#define G_KEY_FILE_DESKTOP_KEY_STARTUP_WM_CLASS "StartupWMClass"