settings — Application and module settings
#define | GWY_APP_SETTINGS_ERROR |
enum | GwyAppSettingsError |
#include <app/gwyapp.h>
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
.
The error domain.
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.
The settings as a GwyContainer.
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.
filename |
A filename to save the settings to. |
|
error |
Location to store loading error to, or |
Whether it succeeded.
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()
.
s |
String contaning a part of Gwyddion settings file. |
|
overwrite |
|
|
error |
Location to store loading error to, or |
Whether it succeeded.
Since: 2.63
gboolean
gwy_app_settings_create_config_dir (GError **error
);
Create gwyddion config directory.
error |
Location to store loading error to, or |
Whether it succeeded (also returns TRUE
if the directory already exists).
gchar **
gwy_app_settings_get_module_dirs (void
);
Returns a list of directories to search modules in.
The list of module directories as a newly allocated array of newly allocated strings, to be freed with
g_strfreev()
when not longer needed.
gchar *
gwy_app_settings_get_settings_filename
(void
);
Returns a suitable human-readable settings file name.
The file name as a newly allocated string.
gchar *
gwy_app_settings_get_log_filename (void
);
Returns a suitable log file name.
The file name as a newly allocated string.
gchar *
gwy_app_settings_get_recent_file_list_filename
(void
);
Returns a suitable recent file list file name.
The file name as a newly allocated string.
gboolean gwy_app_gl_init (int *argc
,char ***argv
);
Checks for working OpenGL and initializes it.
When OpenGL support is not compiled in, this function does not do anything. When OpenGL is supported, it calls
gtk_gl_init_check()
and gwy_widgets_gl_init()
(if the former succeeeds).
argc |
Address of the argc parameter of |
|
argv |
Address of the argv parameter of |
TRUE
if OpenGL initialization succeeeded.
gboolean
gwy_app_gl_is_ok (void
);
Returns OpenGL availability.
The return value is the same as the return value of gwy_app_gl_init()
which needs to be called prior to
this function (until then, the return value is always FALSE
).
#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 corrupted. |
||
User configuration directory is not readable or writable or it does not exist and its creation failed. |
||
Settings file is empty (Since 2.45). This was previously reported as
|
GwyParamDef, GwyParams -- a higher level module settings interface