commit 6fcd3d062e2a80fee5e2f7ce4f2952655df1f5c5
parent f082a001ce8274b85ab1795a2bf274265e3432a5
Author: lash <dev@holbrook.no>
Date: Tue, 11 Jun 2024 19:01:15 +0100
Add continue button, logging action
Diffstat:
5 files changed, 34 insertions(+), 4 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -14,3 +14,4 @@ src/asn1/schema_entry_asn1_tab.c
src/asn1/generate_asn1
src/aux/include
src/aux/lib
+__pycache__
diff --git a/Makefile b/Makefile
@@ -23,7 +23,7 @@ run: gtk all
debug: gtk all
#G_DEBUG=all G_MESSAGES_DEBUG=all ./src/gtk/a.out
- G_DEBUG=all G_MESSAGES_DEBUG=Kee ./src/gtk/a.out
+ G_DEBUG=all G_MESSAGES_DEBUG="Kee Gio Glib" ./src/gtk/a.out
gdb: gtk all
G_DEBUG=all G_MESSAGES_DEBUG=all gdb ./src/gtk/a.out
diff --git a/src/gtk/kee-transport.c b/src/gtk/kee-transport.c
@@ -7,6 +7,7 @@
#include "kee-menu.h"
#include "err.h"
#include "qr.h"
+#include "debug.h"
typedef struct {
@@ -41,12 +42,17 @@ static void kee_transport_init(KeeTransport *o) {
o->image_data = malloc(QR_IMAGE_SIZE);
}
+static void kee_transport_handle_continue(GAction *Act, GVariant *v, void *o) {
+ debug_log(DEBUG_DEBUG, "continue");
+}
+
/// \todo find a way to modify underlying bytes and keep the stack from pixbuf to widget
static void kee_transport_render(KeeTransport *o) {
KeeMenu *menu;
GtkWidget *widget;
GdkTexture *texture;
GdkPixbuf *pixbuf;
+ GSimpleAction *act;
GBytes *bytes;
size_t width_bytes;
size_t width_pixels;
@@ -61,12 +67,23 @@ static void kee_transport_render(KeeTransport *o) {
if (widget) {
gtk_box_remove(GTK_BOX(o), widget);
}
+
widget = gtk_picture_new_for_paintable(GDK_PAINTABLE(texture));
gtk_picture_set_content_fit(GTK_PICTURE(widget), GTK_CONTENT_FIT_SCALE_DOWN);
gtk_box_append(GTK_BOX(o), widget);
widget = gtk_widget_get_ancestor(GTK_WIDGET(o), KEE_TYPE_MENU);
menu = KEE_MENU(widget);
+
+ widget = gtk_button_new_with_label("continue");
+ gtk_box_append(GTK_BOX(o), widget);
+
+ act = g_simple_action_new("transport_continue", NULL);
+ gtk_actionable_set_action_name(GTK_ACTIONABLE(widget), "win.transport_continue");
+ g_action_map_add_action(G_ACTION_MAP(menu), G_ACTION(act));
+ g_signal_connect(act, "activate", G_CALLBACK(kee_transport_handle_continue), NULL);
+ g_simple_action_set_enabled(act, true);
+
kee_menu_next(menu, BEAMENU_DST_TRANSPORT);
}
diff --git a/src/gtk/nav.c b/src/gtk/nav.c
@@ -28,6 +28,8 @@ int kee_nav_init(const char *path) {
}
int kee_nav_set(GtkWidget *widget, int menu_id) {
+ char s[256];
+
if (widgets[menu_id]) {
return 1;
}
@@ -35,6 +37,8 @@ int kee_nav_set(GtkWidget *widget, int menu_id) {
beamenu_jump(menu_id);
stack[stack_crsr] = menu_id;
stack_crsr++;
+ sprintf(s, "set nav menu_id %d (%s)", menu_id, beamenu_dst_r[menu_id]);
+ debug_log(DEBUG_INFO, s);
return 0;
}
@@ -47,6 +51,7 @@ int kee_nav_unset(int menu_id) {
}
GtkWidget* kee_nav_back(int force) {
+ char s[64];
GtkWidget *widget;
int r;
@@ -71,6 +76,8 @@ GtkWidget* kee_nav_back(int force) {
kee_nav_unset(r);
stack_crsr--;
r = stack[stack_crsr-1];
+ sprintf(s, "back nav menu_id %d (%s)", r, beamenu_dst_r[r]);
+ debug_log(DEBUG_INFO, s);
}
if (widgets[r] == NULL) {
diff --git a/testdata_asn1.py b/testdata_asn1.py
@@ -162,7 +162,7 @@ class LedgerSigner:
b = wt.getvalue()
filename = to_key_filename(keyname)
- fp = os.path.join(self.crypto_dir, keyname + '.key.sexp')
+ fp = os.path.join(self.crypto_dir, filename + '.key.sexp')
w = open(fp, 'wb')
w.write(b)
w.close()
@@ -180,7 +180,7 @@ class LedgerSigner:
r = cph.encrypt(bl + b)
r = padbytes(r)
- fp = os.path.join(self.crypto_dir, keyname + '.key.bin')
+ fp = os.path.join(self.crypto_dir, filename + '.key.bin')
w = open(fp, 'wb')
w.write(nonce + r)
w.close()
@@ -199,11 +199,16 @@ class LedgerSigner:
wt.write(pubk)
wt.write(b"))))")
b = wt.getvalue()
- fp = os.path.join(self.crypto_dir, keyname + '.pubkey.sexp')
+ fp = os.path.join(self.crypto_dir, filename + '.pubkey.sexp')
w = open(fp, "wb")
w.write(b)
w.close()
+ fp = os.path.join(self.crypto_dir, filename + '.pubkey.txt')
+ w = open(fp, "w")
+ w.write(pubk.hex())
+ w.close()
+
def create_key(self, keyname, outdir=None, pin='1234', alias=None):
k = ECC.generate(curve='Ed25519')