prefs: Pack keybinding-related globals together and avoid much direct access
[geany-mirror.git] / doc / stash-example.c
blob27e88bbff219a76efb4bfee598251c8099277d25
1 StashGroup *group;
2 gboolean china_enabled;
3 gchar *potter_name;
4 const gchar filename[] = "/path/data.conf";
6 /* setup the group */
7 group = stash_group_new("cup");
8 stash_group_add_boolean(group, &china_enabled, "china", TRUE);
9 stash_group_add_string(group, &potter_name, "potter_name", "Miss Clay");
11 /* load the settings from a file */
12 if (!stash_group_load_from_file(group, filename))
13 g_warning(_("Could not load keyfile %s!"), filename);
15 /* now use settings china_enabled and potter_name */
16 ...
18 /* save settings to file */
19 if (stash_group_save_to_file(group, filename, G_KEY_FILE_NONE) != 0)
20 g_error(_("Could not save keyfile %s!"), filename);
22 /* free memory */
23 stash_group_free(group);