settings

settings — Module and application settings.

Synopsis




GwyContainer* gwy_app_settings_get          (void);
void        gwy_app_settings_free           (void);
gboolean    gwy_app_settings_save           (const gchar *filename);
gboolean    gwy_app_settings_save_text      (const gchar *filename);
gboolean    gwy_app_settings_save_bin       (const gchar *filename);
gboolean    gwy_app_settings_load           (const gchar *filename);
gboolean    gwy_app_settings_load_text      (const gchar *filename);
gboolean    gwy_app_settings_load_bin       (const gchar *filename);
gboolean    gwy_app_settings_create_config_dir
                                            (void);
gchar**     gwy_app_settings_get_module_dirs
                                            (void);
gchar*      gwy_app_settings_get_config_filename
                                            (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);

Description

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.

Details

gwy_app_settings_get ()

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.

gwy_app_settings_free ()

void        gwy_app_settings_free           (void);

Frees Gwyddion settings.

Should not be called only by main application.


gwy_app_settings_save ()

gboolean    gwy_app_settings_save           (const gchar *filename);

Saves the settings.

Probably useful only in the application.

Since 1.2 it saves settings in human-readable format. Use gwy_app_settings_save_bin() if you specifically require the old binary dump format.

filename : A filename to save the settings to.
Returns : Whether it succeeded.

gwy_app_settings_save_text ()

gboolean    gwy_app_settings_save_text      (const gchar *filename);

Warning

gwy_app_settings_save_text is deprecated and should not be used in newly-written code.

Saves the settings in human-readable text format.

Probably useful only in the application. Use gwy_app_settings_get_settings_filename() to obtain a suitable default filename.

filename : A filename to save the settings to.
Returns : Whether it succeeded.

Since 1.2.


gwy_app_settings_save_bin ()

gboolean    gwy_app_settings_save_bin       (const gchar *filename);

Warning

gwy_app_settings_save_bin is deprecated and should not be used in newly-written code.

Saves the settings in old binary dump format.

Do NOT use any more.

filename : A filename to save the settings to.
Returns : Whether it succeeded.

gwy_app_settings_load ()

gboolean    gwy_app_settings_load           (const gchar *filename);

Loads the old binary-dump config.

Probably useful only in the application.

Since 1.2 no longer tries to create the parent directory when it doesn't exist, and loads the human-readable (text) format.

filename : A filename to read the config from.
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.

gwy_app_settings_load_text ()

gboolean    gwy_app_settings_load_text      (const gchar *filename);

Warning

gwy_app_settings_load_text is deprecated and should not be used in newly-written code.

Loads the human-readable settings file.

Probably useful only in the application.

filename : A filename to read the config from.
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.

Since 1.2.


gwy_app_settings_load_bin ()

gboolean    gwy_app_settings_load_bin       (const gchar *filename);

Warning

gwy_app_settings_load_bin is deprecated and should not be used in newly-written code.

Loads the old binary-dump config.

Probably useful only in the application, and even there only for compatibility. Do NOT use binary configs.

filename : A filename to read the config from.
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.

Since 1.2.


gwy_app_settings_create_config_dir ()

gboolean    gwy_app_settings_create_config_dir
                                            (void);

Create gwyddion config directory.

Returns : Whether it succeeded (also returns TRUE if the directory already exists). Since 1.3 it also creates user module directories (that themselves exist since 1.3).

Since 1.2.


gwy_app_settings_get_module_dirs ()

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.

gwy_app_settings_get_config_filename ()

gchar*      gwy_app_settings_get_config_filename
                                            (void);

Returns a suitable (binary) configuration file name.

Note binary config is deprecated now.

Returns : The file name as a newly allocated string.

gwy_app_settings_get_settings_filename ()

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.

Since 1.2.


gwy_app_settings_get_log_filename ()

gchar*      gwy_app_settings_get_log_filename
                                            (void);

Returns a suitable log file name.

Returns : The file name as a newly allocated string.

gwy_app_settings_get_recent_file_list_filename ()

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.

Since 1.5.