From 3f0a143037f8e74a633190920fabfe0b4d7a1b20 Mon Sep 17 00:00:00 2001 From: Benjamin Berg Date: Thu, 4 Jul 2019 16:38:32 +0200 Subject: [PATCH] demo: Add UI for retry errors --- demo/gtk-libfprint-test.c | 13 +++++++++-- demo/gtk-libfprint-test.ui | 46 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 2 deletions(-) diff --git a/demo/gtk-libfprint-test.c b/demo/gtk-libfprint-test.c index 5610cdd..238dff5 100644 --- a/demo/gtk-libfprint-test.c +++ b/demo/gtk-libfprint-test.c @@ -59,7 +59,8 @@ typedef enum { NOIMAGING_MODE, CAPTURE_MODE, SPINNER_MODE, - ERROR_MODE + ERROR_MODE, + RETRY_MODE } LibfprintDemoMode; static void libfprint_demo_set_mode (LibfprintDemoWindow *win, @@ -221,7 +222,10 @@ dev_capture_start_cb (FpDevice *dev, image = fp_device_capture_finish (dev, res, &error); if (!image) { g_warning ("Error capturing data: %s", error->message); - libfprint_demo_set_mode (win, ERROR_MODE); + if (error->domain == FP_DEVICE_RETRY) + libfprint_demo_set_mode (win, RETRY_MODE); + else + libfprint_demo_set_mode (win, ERROR_MODE); return; } @@ -415,6 +419,11 @@ libfprint_demo_set_mode (LibfprintDemoWindow *win, gtk_widget_set_sensitive (win->capture_button, FALSE); gtk_spinner_stop (GTK_SPINNER (win->spinner)); break; + case RETRY_MODE: + gtk_stack_set_visible_child_name (GTK_STACK (win->mode_stack), "retry-mode"); + gtk_widget_set_sensitive (win->capture_button, TRUE); + gtk_spinner_stop (GTK_SPINNER (win->spinner)); + break; default: g_assert_not_reached (); } diff --git a/demo/gtk-libfprint-test.ui b/demo/gtk-libfprint-test.ui index 0691620..c2bd56a 100644 --- a/demo/gtk-libfprint-test.ui +++ b/demo/gtk-libfprint-test.ui @@ -266,6 +266,52 @@ 2 + + + True + False + center + center + True + True + vertical + 12 + + + True + False + 9 + 192 + dialog-warning-symbolic + + + 1 + 0 + + + + + True + False + 9 + <b><span size="large">Device reported a recoverable error. Please retry!</span></b> + True + + + 1 + 1 + + + + + + retry-mode + retry-mode + 2 + + True