![]() |
![]() |
Gwyddion Application Library Reference Manual | ![]() |
|
---|---|---|---|---|
Top | Description |
#include <app/gwyapp.h> #define GWY_APP_SETTINGS_ERROR enum GwyAppSettingsError; GQuark gwy_app_settings_error_quark (void
); GwyContainer * gwy_app_settings_get (void
); void gwy_app_settings_free (void
); gboolean gwy_app_settings_save (const gchar *filename
,GError **error
); gboolean gwy_app_settings_load (const gchar *filename
,GError **error
); gboolean gwy_app_settings_create_config_dir (GError **error
); gchar ** gwy_app_settings_get_module_dirs (void
); gchar * gwy_app_settings_get_settings_filename (void
); gchar * gwy_app_settings_get_log_filename (void
); gchar * gwy_app_settings_get_recent_file_list_filename (void
); gboolean gwy_app_gl_init (int *argc
,char ***argv
); gboolean gwy_app_gl_is_ok (void
);
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 main application.
#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.
typedef enum { GWY_APP_SETTINGS_ERROR_FILE, GWY_APP_SETTINGS_ERROR_CORRUPT, GWY_APP_SETTINGS_ERROR_CFGDIR } GwyAppSettingsError;
Error codes returned by application settings functions.
GQuark gwy_app_settings_error_quark (void
);
Returns error domain for application settings operations.
See and use GWY_APP_SETTINGS_ERROR
.
Returns : |
The error domain. |
GwyContainer * gwy_app_settings_get (void
);
Gets the Gwyddion settings.
The settings are a GwyContainer automatically loaded at program startup
and saved ad its exit. For storing persistent module data you should
use "/module/YOUR_MODULE_NAME/"
prefix.
Returns : |
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.
|
A filename to save the settings to. |
|
Location to store loading error to, or NULL . |
Returns : |
Whether it succeeded. |
gboolean gwy_app_settings_load (const gchar *filename
,GError **error
);
Loads settings file.
|
A filename to read settings from. |
|
Location to store loading error to, or NULL . |
Returns : |
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.
Returns : |
The list of module directories as a newly allocated array of
newly allocated strings, to be freed with g_str_freev() when
not longer needed. |
gchar * gwy_app_settings_get_settings_filename
(void
);
Returns a suitable human-readable settings file name.
Returns : |
The file name as a newly allocated string. |
gchar * gwy_app_settings_get_log_filename (void
);
Returns a suitable log file name.
Returns : |
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.
Returns : |
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).
|
Address of the argc parameter of main() . Passed to
gtk_gl_init_check() . |
|
Address of the argv parameter of main() . Passed to
gtk_gl_init_check() . |
Returns : |
TRUE if OpenGL initialization succeeeded. |
gboolean gwy_app_gl_is_ok (void
);
Returns OpenGL availability.
Returns : |
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 ). |