Top | ![]() |
![]() |
![]() |
![]() |
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.
filename |
A filename to save the settings to. |
|
error |
Location to store loading error to, or |
gboolean gwy_app_settings_load (const gchar *filename
,GError **error
);
Loads settings file.
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_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.
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.
gchar *
gwy_app_settings_get_log_filename (void
);
Returns a suitable log file name.
gchar *
gwy_app_settings_get_recent_file_list_filename
(void
);
Returns a suitable recent file list file name.
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).
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
|