[Github-comments] [geany/geany] Stash Settings: Add double key type (PR #3004)
xiota
notifications at xxxxx
Mon Nov 15 19:59:34 UTC 2021
Split from #3000.
Adds double key type to stash settings.
Example usage (`stash-example.c`):
```C
StashGroup *group;
gboolean porcelain_enabled;
gchar *potter_name;
gint stock;
gdouble price;
const gchar filename[] = "/path/data.conf";
/* setup the group */
group = stash_group_new("cup");
stash_group_add_boolean(group, &porcelain_enabled, "porcelain", TRUE);
stash_group_add_string(group, &potter_name, "potter_name", "Miss Clay");
stash_group_add_integer(group, &stock, "stock", 5);
stash_group_add_double(group, &price, "price", 1.50);
/* load the settings from a file */
if (!stash_group_load_from_file(group, filename))
g_warning(_("Could not load keyfile %s!"), filename);
/* now use settings porcelain_enabled, potter_name, stock, and price */
/* ... */
/* save settings to file */
if (stash_group_save_to_file(group, filename, G_KEY_FILE_NONE) != 0)
g_error(_("Could not save keyfile %s!"), filename);
/* free memory */
stash_group_free(group);
```
Generated config:
```
[cup]
porcelain=true
potter_name=Miss Clay
stock=5
price=1.5
```
You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany/pull/3004
-- Commit Summary --
* Stash Settings: Add double key type
-- File Changes --
M doc/stash-example.c (12)
M src/plugindata.h (2)
M src/stash.c (35)
M src/stash.h (3)
M src/utils.c (55)
M src/utils.h (2)
-- Patch Links --
https://github.com/geany/geany/pull/3004.patch
https://github.com/geany/geany/pull/3004.diff
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/3004
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20211115/af0787ef/attachment.htm>
More information about the Github-comments
mailing list