| Top |
| GQuark | gwy_app_settings_error_quark () |
| GwyContainer * | gwy_app_settings_get () |
| void | gwy_app_settings_free () |
| gboolean | gwy_app_settings_save () |
| gboolean | gwy_app_settings_load () |
| gboolean | gwy_app_settings_merge_string () |
| gboolean | gwy_app_settings_create_config_dir () |
| gchar ** | gwy_app_settings_get_module_dirs () |
| gchar * | gwy_app_settings_get_settings_filename () |
| gchar * | gwy_app_settings_get_log_filename () |
| gchar * | gwy_app_settings_get_recent_file_list_filename () |
All application and module settings are stored in a one big GwyContainer which can be obtained by
gwy_app_settings_get(). Then you can use GwyContainer functions to get and save settings.
The rest of the setting manipulating functions is normally useful only in the main application.
GQuark
gwy_app_settings_error_quark (void);
Returns error domain for application settings operations.
See and use GWY_APP_SETTINGS_ERROR.
GwyContainer *
gwy_app_settings_get (void);
Gets the Gwyddion settings.
The program settings are a GwyContainer automatically loaded at program startup and saved ad its exit. For
storing persistent module data manually you should use "/module/YOUR_MODULE_NAME/" prefix.
However, in common cases you should use GwyParamDef and GwyParams which can handle the dirty work themselves.
void
gwy_app_settings_free (void);
Frees Gwyddion settings.
Should not be called only by main application.
gboolean gwy_app_settings_save (const gchar *filename,GError **error);
Saves the settings.
Use gwy_app_settings_get_settings_filename() to obtain a suitable default filename.
gboolean gwy_app_settings_load (const gchar *filename,GError **error);
Initialises settings by loading a settings file.
Any existing settings are discarded. Consider gwy_app_settings_merge_string() for piecewise settings creation.
filename |
A filename to read settings from. |
|
error |
Location to store loading error to, or |
Whether it succeeded. In either case you can call gwy_app_settings_get() then to obtain either the loaded
settings or the old ones (if failed), or an empty GwyContainer.
gboolean gwy_app_settings_merge_string (const gchar *s,gboolean overwrite,GError **error);
Loads settings from a string and adds them to the global settings.
The contents of string s
should look like a Gwyddion settings file, including the header line "Gwyddion Settings
1.0", even though it is optional.
If no settings exist when this function is called, they are initialised like calling gwy_app_settings_get().
gboolean
gwy_app_settings_create_config_dir (GError **error);
Create gwyddion config directory.
gchar **
gwy_app_settings_get_module_dirs (void);
Returns a list of directories to search modules in.
gchar *
gwy_app_settings_get_settings_filename
(void);
Returns a suitable human-readable settings file name.
gchar *
gwy_app_settings_get_log_filename (void);
Returns a suitable log file name.
#define GWY_APP_SETTINGS_ERROR gwy_app_settings_error_quark()
Error domain for application settings operations. Errors in this domain will be from the GwyAppSettingsError enumeration. See GError for information on error domains.
Error codes returned by application settings functions.
|
Settings file is not readable or writable. |
||
|
Settings file contents is corrupt. |
||
|
User configuration directory is not readable or writable or it does not exist and its creation failed. |
||
|
Settings file is empty. Unlike corrupt files, which may contain valuable information, empty settings files can be overwritten without losing anything. |