commit 7fced55d1634c15843877f28a208db09857435f0
parent 4dc281c0b40cb3ffd4fe5950a88c04f98fc12eb5
Author: lash <dev@holbrook.no>
Date: Thu, 16 May 2024 17:29:45 +0100
Add resolvers to ledger and item imports
Diffstat:
6 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/src/cadir.h b/src/cadir.h
@@ -3,6 +3,8 @@
#include "cadiz.h"
+#define KEE_LOCATOR_LENGTH 1024
+
typedef struct Cadiz Cadir;
diff --git a/src/gtk/context.c b/src/gtk/context.c
@@ -6,6 +6,8 @@
#include "err.h"
#include "gpg.h"
#include "db.h"
+#include "cadiz.h"
+#include "cadir.h"
#define G_LOG_DOMAIN "Kee"
@@ -25,6 +27,9 @@ int kee_context_init(struct kee_context *ctx, struct kee_settings *settings) {
gpg_store_init(&ctx->gpg, (char*)v);
ctx->entry_store = kee_entry_store_new(&ctx->db);
kee_entry_store_set_resolve(ctx->entry_store, (char*)settings->resource);
+
+ //ctx->resolver.locator = malloc(KEE_LOCATOR_LENGTH);
+ ctx->resolver.locator = settings->resource;
return ERR_OK;
}
@@ -33,4 +38,5 @@ int kee_context_state(struct kee_context *ctx) {
}
void kee_context_free(struct kee_context *ctx) {
+ //free(ctx->resolver.locator);
}
diff --git a/src/gtk/context.h b/src/gtk/context.h
@@ -6,6 +6,7 @@
#include "db.h"
#include "camera.h"
#include "gpg.h"
+#include "cadiz.h"
struct kee_context {
@@ -15,6 +16,7 @@ struct kee_context {
struct db_ctx db;
struct gpg_store gpg;
KeeEntryStore *entry_store;
+ struct Cadiz resolver;
int state;
};
diff --git a/src/gtk/kee-entry.c b/src/gtk/kee-entry.c
@@ -332,6 +332,7 @@ static int kee_entry_apply_summary_widget(KeeEntry *o) {
item = kee_entry_item_new(o->db, &o->ledger, 0);
kee_entry_item_set(item, o->ledger.last_item);
+ kee_entry_item_set_resolver(item, o->resolver);
kee_entry_item_apply_summary_widget(item, GTK_BOX(o->display));
o->form = calloc(sizeof(struct kee_entry_form_t), 1);
diff --git a/src/gtk/kee-menu.c b/src/gtk/kee-menu.c
@@ -87,6 +87,7 @@ static void kee_menu_act_import_entry(GAction *act, GVariant *param, KeeMenu *me
return;
}
kee_entry_set_signer(entry, &menu->ctx->gpg);
+ kee_entry_set_resolver(entry, &menu->ctx->resolver);
r = kee_entry_from_ledger(entry, &ledger);
if (r) {
g_log(G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, "fail load entry from ledger");
diff --git a/src/settings.c b/src/settings.c
@@ -131,6 +131,9 @@ int settings_set(struct kee_settings *z, enum SettingsType typ, unsigned char* v
case SETTINGS_RUN:
z->run = v;
break;
+ case SETTINGS_RESOURCE:
+ z->resource = v;
+ break;
case SETTINGS_LOCKTIME:
z->locktime = v;
break;