kee

Offline IOU signer with QR as transport
git clone https://holbrook.no/src/kee
Info | Log | Files | Refs | README | LICENSE

commit f03142efc7380de58d43eadf8ac27c39b7ea5f7b
parent 6c2dfb4a966f2f644a865d3fb6c220aa8ef150b1
Author: lash <dev@holbrook.no>
Date:   Sat, 11 May 2024 08:57:13 +0100

Apply settings for environment

Diffstat:
Msrc/gtk/context.c | 4++--
Msrc/settings.c | 8+++++++-
Msrc/settings.h | 2++
3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/gtk/context.c b/src/gtk/context.c @@ -16,11 +16,11 @@ int kee_context_init(struct kee_context *ctx, struct kee_settings *settings) { memset(ctx, 0, sizeof(struct kee_context)); ctx->state = 1; ctx->settings = settings; - db_connect(&ctx->db, "./testdata_mdb"); + db_connect(&ctx->db, (char*)settings->db); v = settings_get(ctx->settings, SETTINGS_KEY); gpg_store_init(&ctx->gpg, (char*)v); ctx->entry_store = kee_entry_store_new(&ctx->db); - kee_entry_store_set_resolve(ctx->entry_store, "./testdata_resource"); + kee_entry_store_set_resolve(ctx->entry_store, (char*)settings->resource); return ERR_OK; } diff --git a/src/settings.c b/src/settings.c @@ -39,6 +39,10 @@ int settings_new_from_xdg(struct kee_settings *z) { z->data = calloc(KEE_SETTINGS_CAP, 1); p = z->data; p += KEE_SETTINGS_ITEM_CAP; + z->db = p; + p += KEE_SETTINGS_ITEM_CAP; + z->resource = p; + p += KEE_SETTINGS_ITEM_CAP; z->run = p; p += KEE_SETTINGS_ITEM_CAP; z->key = p; @@ -48,11 +52,13 @@ int settings_new_from_xdg(struct kee_settings *z) { z->video_device = p; settings_get_path(z); - if (z->data == NULL) { + if (*z->data == 0x0) { s = xdgDataHome(&xdg); sprintf((char*)z->data, "%s/%s", s, KEE_SETTINGS_NAME); } sprintf((char*)z->key, "%s/crypt", z->data); + sprintf((char*)z->db, "%s/mdb", z->data); + sprintf((char*)z->resource, "%s/resource", z->data); s = xdgRuntimeDirectory(&xdg); sprintf((char*)z->run, "%s/%s", s, KEE_SETTINGS_NAME); diff --git a/src/settings.h b/src/settings.h @@ -8,6 +8,8 @@ */ struct kee_settings { unsigned char *data; + unsigned char *db; + unsigned char *resource; unsigned char *run; unsigned char *key; unsigned char *locktime;