![]() |
![]() |
![]() |
LibRhythmCat Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
#include <rclib-settings.h> void rclib_settings_apply (); void rclib_settings_exit (); gboolean rclib_settings_get_boolean (const gchar *group_name
,const gchar *key
,GError **error
); gboolean * rclib_settings_get_boolean_list (const gchar *group_name
,const gchar *key
,gsize *length
,GError **error
); gdouble rclib_settings_get_double (const gchar *group_name
,const gchar *key
,GError **error
); gdouble * rclib_settings_get_double_list (const gchar *group_name
,const gchar *key
,gsize *length
,GError **error
); gint rclib_settings_get_integer (const gchar *group_name
,const gchar *key
,GError **error
); gint * rclib_settings_get_integer_list (const gchar *group_name
,const gchar *key
,gsize *length
,GError **error
); gchar * rclib_settings_get_string (const gchar *group_name
,const gchar *key
,GError **error
); gchar ** rclib_settings_get_string_list (const gchar *group_name
,const gchar *key
,gsize *length
,GError **error
); gboolean rclib_settings_has_key (const gchar *group_name
,gchar *key
,GError **error
); gboolean rclib_settings_init (); gboolean rclib_settings_load_from_file (const gchar *filename
); void rclib_settings_set_boolean (const gchar *group_name
,const gchar *key
,gboolean value
); void rclib_settings_set_boolean_list (const gchar *group_name
,const gchar *key
,gboolean list[]
,gsize length
); void rclib_settings_set_double (const gchar *group_name
,const gchar *key
,gdouble value
); void rclib_settings_set_double_list (const gchar *group_name
,const gchar *key
,gdouble list[]
,gsize length
); void rclib_settings_set_integer (const gchar *group_name
,const gchar *key
,gint value
); void rclib_settings_set_integer_list (const gchar *group_name
,const gchar *key
,gint list[]
,gsize length
); void rclib_settings_set_string (const gchar *group_name
,const gchar *key
,const gchar *string
); void rclib_settings_set_string_list (const gchar *group_name
,const gchar *key
,const gchar * const list[]
,gsize length
); void rclib_settings_sync (); void rclib_settings_update ();
Manage the settings in the player. The settings can be used in this library or the frontend UI. This module uses GKeyFile to store settings in .INI file style.
Notice: The settings are only used when the application is starting, or quiting, for load/save the settings. If you want to read or apply settings, you should check if the settings can be applied directly, if the settings are only used when the application is starting, then save them in this module.
void rclib_settings_exit ();
Unload the setings module and save the settings to the settings file.
gboolean rclib_settings_get_boolean (const gchar *group_name
,const gchar *key
,GError **error
);
Returns the value associated with key under group_name as a boolean.
|
a group name |
|
a key |
|
return location for a GError, or NULL |
Returns : |
The value associated with the key as a boolean, or FALSE if the key was not found or could not be parsed. |
gboolean * rclib_settings_get_boolean_list (const gchar *group_name
,const gchar *key
,gsize *length
,GError **error
);
Returns the values associated with key under group_name as booleans.
|
a group name |
|
a key |
|
the number of booleans returned |
|
return location for a GError, or NULL |
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. |
gdouble rclib_settings_get_double (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.
|
a group name |
|
a key |
|
return location for a GError, or NULL |
Returns : |
The value associated with the key as a double, or 0.0 if the key was not found or could not be parsed. |
gdouble * rclib_settings_get_double_list (const gchar *group_name
,const gchar *key
,gsize *length
,GError **error
);
Returns the values associated with key under group_name as doubles.
|
a group name |
|
a key |
|
the number of doubles returned |
|
return location for a GError, or NULL |
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. |
gint rclib_settings_get_integer (const gchar *group_name
,const gchar *key
,GError **error
);
Returns the value associated with key under group_name as an integer.
|
a group name |
|
a key |
|
return location for a GError, or NULL |
Returns : |
The value associated with the key as an integer, or 0 if the key was not found or could not be parsed. |
gint * rclib_settings_get_integer_list (const gchar *group_name
,const gchar *key
,gsize *length
,GError **error
);
Returns the values associated with key under group_name as integers.
|
a group name |
|
a key |
|
the number of integers returned |
|
return location for a GError, or NULL |
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. |
gchar * rclib_settings_get_string (const gchar *group_name
,const gchar *key
,GError **error
);
Returns the string value associated with key under group_name.
|
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. |
gchar ** rclib_settings_get_string_list (const gchar *group_name
,const gchar *key
,gsize *length
,GError **error
);
Returns the values associated with key under group_name.
|
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() . [transfer full][array zero-terminated=1 length=length]
|
gboolean rclib_settings_has_key (const gchar *group_name
,gchar *key
,GError **error
);
Looks whether the key file has the key in the group.
|
a group name |
|
a key |
|
return location for a GError |
Returns : |
TRUE if key is a part of group_name, FALSE otherwise. |
gboolean rclib_settings_init ();
Initialize the settings module.
Returns : |
Whether the initialization succeeded. |
gboolean rclib_settings_load_from_file (const gchar *filename
);
Load settings from file.
|
the path of the settings file |
Returns : |
Whether the settings are loaded successfully. |
void rclib_settings_set_boolean (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. If group_name cannot be found then it is created.
|
a group name |
|
a key |
|
TRUE or FALSE |
void rclib_settings_set_boolean_list (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 group name |
|
a key |
|
an array of boolean values |
|
number of string values in list |
void rclib_settings_set_double (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. If group_name cannot be found then it is created.
|
a group name |
|
a key |
|
an double value |
void rclib_settings_set_double_list (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. If group_name is NULL, the start_group is used.
|
a group name |
|
a key |
|
an array of double values |
|
number of double values in list |
void rclib_settings_set_integer (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. If group_name cannot be found then it is created.
|
a group name |
|
a key |
|
an integer value |
void rclib_settings_set_integer_list (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. If group_name is NULL, the start_group is used.
|
a group name |
|
a key |
|
an array of integer values |
|
number of integer values in list |
void rclib_settings_set_string (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.
|
a group name |
|
a key |
|
a string |
void rclib_settings_set_string_list (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 group name |
|
a key |
|
an array of string values |
|
number of string values in list |
void rclib_settings_sync ();
Save the settings to file if they are changed (become dirty).