kee

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

commit cb01d701ed18968d4a1c96d4f33e01d0aed6a011
parent a74ee2055db49534b9b1d63c76d0a8bfc27919b4
Author: lash <dev@holbrook.no>
Date:   Mon, 11 Mar 2024 14:09:11 +0000

Add trigger stub for camera selector

Diffstat:
Msrc/gtk/ui.c | 16++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/gtk/ui.c b/src/gtk/ui.c @@ -23,7 +23,7 @@ int ui_init(struct ui_container *ui) { static void new_item(GtkListItemFactory *factory, GtkListItem *item, gpointer user_data) { } -static void unlock_click(GtkWidget *button, gpointer user_data) { +static void ui_handle_unlock_click(GtkWidget *button, gpointer user_data) { struct ui_container *ui; g_log(G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "click"); @@ -32,6 +32,16 @@ static void unlock_click(GtkWidget *button, gpointer user_data) { gtk_stack_set_visible_child(ui->stack, GTK_WIDGET(ui->front_view)); } +static void ui_handle_camera_change(GtkDropDown *chooser, GParamSpec *spec, struct kee_context *ctx) { + GtkLabel *label; + char *s; + + label = gtk_drop_down_get_selected_item(chooser); + s = g_object_get_data(G_OBJECT(label), "devpath"); + g_log(G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "dropdown changed: %s -> %s", spec->name, s); +} + + GtkWidget* ui_build_unlock(struct ui_container *ui) { GtkWidget *box; GtkWidget *entry; @@ -44,7 +54,7 @@ GtkWidget* ui_build_unlock(struct ui_container *ui) { button = gtk_button_new_with_label("create"); gtk_box_append(GTK_BOX(box), button); - g_signal_connect (button, "clicked", G_CALLBACK (unlock_click), ui); + g_signal_connect (button, "clicked", G_CALLBACK (ui_handle_unlock_click), ui); return GTK_WIDGET(box); } @@ -75,6 +85,8 @@ static GtkWidget* ui_build_scan_videochooser(struct kee_context *ctx) { } camera_device = camera_device->next; } + + g_signal_connect(chooser, "notify::selected-item", G_CALLBACK (ui_handle_camera_change), ctx); return chooser; }