2010-03-18 17:04:17 +00:00
|
|
|
StashGroup *group;
|
2010-03-17 17:15:47 +00:00
|
|
|
gboolean china_enabled;
|
2010-03-19 17:38:27 +00:00
|
|
|
gchar *potter_name;
|
|
|
|
const gchar filename[] = "/path/data.conf";
|
2010-03-17 17:15:47 +00:00
|
|
|
|
|
|
|
/* setup the group */
|
2010-09-22 16:33:38 +00:00
|
|
|
group = stash_group_new("cup");
|
2010-03-17 17:15:47 +00:00
|
|
|
stash_group_add_boolean(group, &china_enabled, "china", TRUE);
|
|
|
|
stash_group_add_string(group, &potter_name, "potter_name", "Miss Clay");
|
|
|
|
|
|
|
|
/* load the settings from a file */
|
2010-03-30 16:29:38 +00:00
|
|
|
if (!stash_group_load_from_file(group, filename))
|
2010-03-19 17:38:27 +00:00
|
|
|
g_warning(_("Could not load keyfile %s!"), filename);
|
2010-03-17 17:15:47 +00:00
|
|
|
|
|
|
|
/* now use settings china_enabled and potter_name */
|
|
|
|
...
|
|
|
|
|
|
|
|
/* save settings to file */
|
2010-03-19 17:38:27 +00:00
|
|
|
if (stash_group_save_to_file(group, filename, G_KEY_FILE_NONE) != 0)
|
|
|
|
g_error(_("Could not save keyfile %s!"), filename);
|
2010-03-17 17:15:47 +00:00
|
|
|
|
|
|
|
/* free memory */
|
|
|
|
stash_group_free(group);
|