diff options
author | Samuel Lidén Borell <samuel@kodafritt.se> | 2014-02-16 00:55:04 +0100 |
---|---|---|
committer | Samuel Lidén Borell <samuel@kodafritt.se> | 2014-02-16 00:55:04 +0100 |
commit | a915f5e100719efddae34f4b085875c9c3321a31 (patch) | |
tree | 993c37d7aeaff00b19b931a7eaae268619b518b5 /client | |
parent | c700ee0af512c04f5bae5b9501fdc5b5607a95ba (diff) | |
download | fribid-a915f5e100719efddae34f4b085875c9c3321a31.tar.gz fribid-a915f5e100719efddae34f4b085875c9c3321a31.tar.bz2 fribid-a915f5e100719efddae34f4b085875c9c3321a31.zip |
Focus password entry again if the password was incorrect
Diffstat (limited to 'client')
-rw-r--r-- | client/gtk.c | 3 | ||||
-rw-r--r-- | client/main.c | 7 | ||||
-rw-r--r-- | client/platform.h | 1 |
3 files changed, 10 insertions, 1 deletions
diff --git a/client/gtk.c b/client/gtk.c index dda8cbb..46b7d6d 100644 --- a/client/gtk.c +++ b/client/gtk.c @@ -699,6 +699,9 @@ bool platform_choosePassword(char *password, long password_maxlen) { } } +void platform_focusPassword() { + gtk_widget_grab_focus(GTK_WIDGET(passwordEntry)); +} void platform_showError(TokenError error) { assert(error != TokenError_Success); diff --git a/client/main.c b/client/main.c index d92d70f..d87aae0 100644 --- a/client/main.c +++ b/client/main.c @@ -178,7 +178,12 @@ void pipeCommand(PipeCommand command, const char *url, const char *hostname, if (error == BIDERR_OK) break; - platform_showError(token_getLastError(token)); + // An error occurred + const TokenError tokenError = token_getLastError(token); + platform_showError(tokenError); + if (tokenError == TokenError_BadPassword || tokenError == TokenError_BadPin) { + platform_focusPassword(); // also removes focus from the Sign button + } error = BIDERR_UserCancel; } diff --git a/client/platform.h b/client/platform.h index 39fc2e5..1159f49 100644 --- a/client/platform.h +++ b/client/platform.h @@ -90,6 +90,7 @@ void platform_startSign(const char *url, const char *hostname, const char *ip, void platform_endSign(void); void platform_setNotifier(BackendNotifier *notifier); void platform_setMessage(const char *message); +void platform_focusPassword(); void platform_addKeyDirectories(void); void platform_addToken(Token *token); void platform_removeToken(Token *token); |