summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVivien Kraus <vivien@planete-kraus.eu>2021-09-28 21:56:46 +0200
committerVivien Kraus <vivien@planete-kraus.eu>2021-10-04 22:48:42 +0200
commit668aa5736b2709e15e3ea14381e010c8646a4c38 (patch)
tree32d30ec4af73d3cc6acf9ebba0745bec33697627
parent316cddd43a7c04f994bf405035b65b3881fbd531 (diff)
gui: Add a client widget
-rw-r--r--po/POTFILES.in6
-rw-r--r--po/disfluid.pot41
-rw-r--r--po/fr.po51
-rw-r--r--src/Makefile.am1
-rw-r--r--src/inst/webid-oidc/Makefile.am1
-rw-r--r--src/pre-inst/webid-oidc/Makefile.am1
-rw-r--r--src/scm/webid-oidc/client/gui.scm21
-rw-r--r--src/scm/webid-oidc/client/gui/Makefile.am10
-rw-r--r--src/scm/webid-oidc/client/gui/application-hooks.scm46
-rw-r--r--src/scm/webid-oidc/client/gui/application.scm72
-rw-r--r--src/scm/webid-oidc/client/gui/client-widget.scm147
-rw-r--r--src/scm/webid-oidc/client/gui/settings.scm9
-rw-r--r--src/ui/Makefile.am18
-rw-r--r--src/ui/client-widget.glade169
14 files changed, 551 insertions, 42 deletions
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 51cac89..c502f00 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -38,6 +38,9 @@ src/scm/webid-oidc/client/accounts.scm
src/scm/webid-oidc/client/application.scm
src/scm/webid-oidc/client/client.scm
src/scm/webid-oidc/client/gui.scm
+src/scm/webid-oidc/client/gui/application.scm
+src/scm/webid-oidc/client/gui/application-hooks.scm
+src/scm/webid-oidc/client/gui/client-widget.scm
src/scm/webid-oidc/client/gui/settings.scm
src/scm/webid-oidc/dpop-proof.scm
src/scm/webid-oidc/errors.scm
@@ -71,4 +74,5 @@ src/scm/webid-oidc/simulation.scm
src/scm/webid-oidc/stubs.scm
src/scm/webid-oidc/testing.scm
src/scm/webid-oidc/token-endpoint.scm
-src/scm/webid-oidc/web-i18n.scm \ No newline at end of file
+src/scm/webid-oidc/web-i18n.scm
+src/ui/client-widget.glade \ No newline at end of file
diff --git a/po/disfluid.pot b/po/disfluid.pot
index e2ee75a..e744e78 100644
--- a/po/disfluid.pot
+++ b/po/disfluid.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: disfluid SNAPSHOT\n"
"Report-Msgid-Bugs-To: vivien@planete-kraus.eu\n"
-"POT-Creation-Date: 2021-09-29 12:35+0200\n"
+"POT-Creation-Date: 2021-10-04 22:47+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -557,25 +557,22 @@ msgid ""
"pair.."
msgstr ""
-#: src/scm/webid-oidc/client/gui.scm:60
+#: src/scm/webid-oidc/client/gui.scm:61
#, scheme-format
msgid "The client changed: it is now ~a.\n"
msgstr ""
-#: src/scm/webid-oidc/client/gui.scm:64
+#: src/scm/webid-oidc/client/gui.scm:66
#, scheme-format
msgid "The accounts changed: the main account is ~a, and the others are ~a.\n"
msgstr ""
-#: src/scm/webid-oidc/client/gui.scm:68
-msgid "Hello, world!\n"
-msgstr ""
-
-#: src/scm/webid-oidc/client/gui.scm:73
-msgid "Hello, world!"
+#: src/scm/webid-oidc/client/gui/client-widget.scm:86
+#, scheme-format
+msgid "The client cannot be constructed: ~a\n"
msgstr ""
-#: src/scm/webid-oidc/client/gui/settings.scm:205
+#: src/scm/webid-oidc/client/gui/settings.scm:206
msgid "can only store 10 accounts"
msgstr ""
@@ -2146,3 +2143,27 @@ msgid ""
"<p>You want to use <pre>~s</pre> as a grant type, but this is not supported."
"</p>"
msgstr ""
+
+#: src/ui/client-widget.glade:19
+msgid "Client ID:"
+msgstr ""
+
+#: src/ui/client-widget.glade:55
+msgid "Redirection URI:"
+msgstr ""
+
+#: src/ui/client-widget.glade:91
+msgid "Key pair:"
+msgstr ""
+
+#: src/ui/client-widget.glade:112
+msgid "Generate a key pair"
+msgstr ""
+
+#: src/ui/client-widget.glade:136
+msgid "Undo"
+msgstr ""
+
+#: src/ui/client-widget.glade:149
+msgid "Update"
+msgstr ""
diff --git a/po/fr.po b/po/fr.po
index 911f206..66f8ea7 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -2,8 +2,8 @@ msgid ""
msgstr ""
"Project-Id-Version: webid-oidc 0.0.0\n"
"Report-Msgid-Bugs-To: vivien@planete-kraus.eu\n"
-"POT-Creation-Date: 2021-09-29 12:35+0200\n"
-"PO-Revision-Date: 2021-09-29 12:35+0200\n"
+"POT-Creation-Date: 2021-10-04 22:47+0200\n"
+"PO-Revision-Date: 2021-09-29 12:42+0200\n"
"Last-Translator: Vivien Kraus <vivien@planete-kraus.eu>\n"
"Language-Team: French <vivien@planete-kraus.eu>\n"
"Language: fr\n"
@@ -606,26 +606,23 @@ msgstr ""
"L’ID de client et l’URI de redirection doivent être des URIs, et la paire de "
"clés doit être une paire de clés."
-#: src/scm/webid-oidc/client/gui.scm:60
+#: src/scm/webid-oidc/client/gui.scm:61
#, scheme-format
msgid "The client changed: it is now ~a.\n"
msgstr "Le client a changé : c’est maintenant ~a.\n"
-#: src/scm/webid-oidc/client/gui.scm:64
+#: src/scm/webid-oidc/client/gui.scm:66
#, scheme-format
msgid "The accounts changed: the main account is ~a, and the others are ~a.\n"
msgstr ""
"Les comptes ont changé : le compte principal est ~a, et les autres sont ~a.\n"
-#: src/scm/webid-oidc/client/gui.scm:68
-msgid "Hello, world!\n"
-msgstr "Bonjour, le monde !\n"
-
-#: src/scm/webid-oidc/client/gui.scm:73
-msgid "Hello, world!"
-msgstr "Bonjour, le monde !"
+#: src/scm/webid-oidc/client/gui/client-widget.scm:86
+#, scheme-format
+msgid "The client cannot be constructed: ~a\n"
+msgstr "Le client ne peut pas être construit : ~a\n"
-#: src/scm/webid-oidc/client/gui/settings.scm:205
+#: src/scm/webid-oidc/client/gui/settings.scm:206
msgid "can only store 10 accounts"
msgstr "on ne peut stocker que 10 comptes"
@@ -2530,6 +2527,36 @@ msgstr ""
"<p>Vous voulez utiliser <pre>~s</pre> comme type d’offre, mais ce n’est pas "
"supporté.</p>"
+#: src/ui/client-widget.glade:19
+msgid "Client ID:"
+msgstr "Identifiant client :"
+
+#: src/ui/client-widget.glade:55
+msgid "Redirection URI:"
+msgstr "URI de redirection :"
+
+#: src/ui/client-widget.glade:91
+msgid "Key pair:"
+msgstr "Paire de clés :"
+
+#: src/ui/client-widget.glade:112
+msgid "Generate a key pair"
+msgstr "Générer une paire de clés"
+
+#: src/ui/client-widget.glade:136
+msgid "Undo"
+msgstr "Annuler"
+
+#: src/ui/client-widget.glade:149
+msgid "Update"
+msgstr "Mettre à jour"
+
+#~ msgid "Hello, world!\n"
+#~ msgstr "Bonjour, le monde !\n"
+
+#~ msgid "Hello, world!"
+#~ msgstr "Bonjour, le monde !"
+
#~ msgid "cannot parse a token"
#~ msgstr "impossible d’analyser le jeton"
diff --git a/src/Makefile.am b/src/Makefile.am
index eedfe4a..e25a2e6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -73,6 +73,7 @@ include %reldir%/jws/Makefile.am
include %reldir%/pre-inst/Makefile.am
include %reldir%/inst/Makefile.am
include %reldir%/scm/Makefile.am
+include %reldir%/ui/Makefile.am
CLEANFILES += $(go_DATA) $(webidoidcgo_DATA) $(mod_DATA) $(webidoidcmod_DATA) \
$(serverwebidoidcgo_DATA) $(clientwebidoidcgo_DATA) $(resourceserverwebidoidcgo_DATA) \
diff --git a/src/inst/webid-oidc/Makefile.am b/src/inst/webid-oidc/Makefile.am
index d6f3c6f..280cf96 100644
--- a/src/inst/webid-oidc/Makefile.am
+++ b/src/inst/webid-oidc/Makefile.am
@@ -25,6 +25,7 @@ webidoidcgo_DATA += %reldir%/config.go
echo "(define-public version \"$(VERSION)\")" ; \
echo "(define-public release-date (time-utc->date (make-time time-utc 0 $$(date -d '$(RELEASE_DATE)' '+%s'))))" ; \
echo "(define-public package \"$(PACKAGE)\")" ; \
+ echo "(define-public uidir \"$(uipkgdatadir)\")" ; \
echo "(define-public package-bugreport \"$(PACKAGE_BUGREPORT)\")") \
> $@-t \
&& mv $@-t $@
diff --git a/src/pre-inst/webid-oidc/Makefile.am b/src/pre-inst/webid-oidc/Makefile.am
index d2b7fb7..e14c7d4 100644
--- a/src/pre-inst/webid-oidc/Makefile.am
+++ b/src/pre-inst/webid-oidc/Makefile.am
@@ -28,6 +28,7 @@ BUILT_SOURCES += %reldir%/config.scm
echo "(define-public version \"$(VERSION)\")" ; \
echo "(define-public release-date (time-utc->date (make-time time-utc 0 $$(date -d '$(RELEASE_DATE)' '+%s'))))" ; \
echo "(define-public package \"$(PACKAGE)\")" ; \
+ echo "(define-public uidir \"$(abs_top_srcdir)/src/ui\")" ; \
echo "(define-public package-bugreport \"$(PACKAGE_BUGREPORT)\")") \
> $@-t \
&& mv $@-t $@
diff --git a/src/scm/webid-oidc/client/gui.scm b/src/scm/webid-oidc/client/gui.scm
index 45910e3..be557bd 100644
--- a/src/scm/webid-oidc/client/gui.scm
+++ b/src/scm/webid-oidc/client/gui.scm
@@ -36,6 +36,7 @@
#:use-module (webid-oidc client)
#:use-module (webid-oidc client accounts)
#:use-module ((webid-oidc client gui settings) #:prefix settings:)
+ #:use-module ((webid-oidc client gui application) #:prefix app:)
#:use-module (web uri)
#:use-module (web response)
#:use-module (rnrs bytevectors)
@@ -57,27 +58,13 @@
(add-hook! settings:client-changed-hook
(lambda (client)
- (format #t (G_ "The client changed: it is now ~a.\n") client)))
+ (format #t (G_ "The client changed: it is now ~a.\n") client)
+ ((@ (webid-oidc client) client) client)))
(add-hook! settings:accounts-changed-hook
(lambda (main other)
(format #t (G_ "The accounts changed: the main account is ~a, and the others are ~a.\n")
main other)))
-(define (print-hello button)
- (format #t (G_ "Hello, world!\n")))
-
-(define (on-activate application)
- (let ((window (make <GtkApplicationWindow>
- #:application application))
- (button (make <GtkButton> #:label (G_ "Hello, world!"))))
- (connect button clicked print-hello)
- (add window button)
- (show-all window)))
-
(define (main)
- (let ((app (application:new
- "eu.planete_kraus.Disfluid"
- (list->application-flags '(flags-none)))))
- (connect app activate on-activate)
- (run app (command-line))))
+ (run app:application (command-line)))
diff --git a/src/scm/webid-oidc/client/gui/Makefile.am b/src/scm/webid-oidc/client/gui/Makefile.am
index 86d6dd3..64b1870 100644
--- a/src/scm/webid-oidc/client/gui/Makefile.am
+++ b/src/scm/webid-oidc/client/gui/Makefile.am
@@ -15,7 +15,13 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
dist_guiclientwebidoidcmod_DATA += \
- %reldir%/settings.scm
+ %reldir%/settings.scm \
+ %reldir%/client-widget.scm \
+ %reldir%/application-hooks.scm \
+ %reldir%/application.scm
guiclientwebidoidcgo_DATA += \
- %reldir%/settings.go
+ %reldir%/settings.go \
+ %reldir%/client-widget.go \
+ %reldir%/application-hooks.go \
+ %reldir%/application.go
diff --git a/src/scm/webid-oidc/client/gui/application-hooks.scm b/src/scm/webid-oidc/client/gui/application-hooks.scm
new file mode 100644
index 0000000..0d51599
--- /dev/null
+++ b/src/scm/webid-oidc/client/gui/application-hooks.scm
@@ -0,0 +1,46 @@
+;; disfluid, implementation of the Solid specification
+;; Copyright (C) 2021 Vivien Kraus
+
+;; This program is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU Affero General Public License as
+;; published by the Free Software Foundation, either version 3 of the
+;; License, or (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU Affero General Public License for more details.
+
+;; You should have received a copy of the GNU Affero General Public License
+;; along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+(define-module (webid-oidc client gui application-hooks)
+ #:use-module (ice-9 match)
+ #:use-module (ice-9 exceptions)
+ #:use-module (ice-9 i18n)
+ #:use-module (ice-9 receive)
+ #:use-module (ice-9 optargs)
+ #:use-module (ice-9 pretty-print)
+ #:use-module (srfi srfi-9)
+ #:use-module (srfi srfi-19)
+ #:use-module (srfi srfi-26)
+ #:use-module (webid-oidc errors)
+ #:use-module ((webid-oidc stubs) #:prefix stubs:)
+ #:use-module (webid-oidc web-i18n)
+ #:use-module (webid-oidc client client)
+ #:use-module (webid-oidc client accounts)
+ #:use-module (webid-oidc jwk)
+ #:use-module (webid-oidc oidc-id-token)
+ #:use-module (web uri)
+ #:use-module (web response)
+ #:use-module (rnrs bytevectors)
+ #:use-module (oop goops)
+ #:declarative? #t
+ #:duplicates (merge-generics)
+ #:export
+ (
+ application-activated-hook
+ ))
+
+(define application-activated-hook
+ (make-hook 1))
diff --git a/src/scm/webid-oidc/client/gui/application.scm b/src/scm/webid-oidc/client/gui/application.scm
new file mode 100644
index 0000000..361e12d
--- /dev/null
+++ b/src/scm/webid-oidc/client/gui/application.scm
@@ -0,0 +1,72 @@
+;; disfluid, implementation of the Solid specification
+;; Copyright (C) 2021 Vivien Kraus
+
+;; This program is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU Affero General Public License as
+;; published by the Free Software Foundation, either version 3 of the
+;; License, or (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU Affero General Public License for more details.
+
+;; You should have received a copy of the GNU Affero General Public License
+;; along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+(define-module (webid-oidc client gui application)
+ #:use-module (gi)
+ #:use-module (gi types)
+ #:use-module (gi util)
+ #:use-module (ice-9 match)
+ #:use-module (ice-9 exceptions)
+ #:use-module (ice-9 i18n)
+ #:use-module (ice-9 receive)
+ #:use-module (ice-9 optargs)
+ #:use-module (ice-9 pretty-print)
+ #:use-module (srfi srfi-9)
+ #:use-module (srfi srfi-19)
+ #:use-module (webid-oidc errors)
+ #:use-module (webid-oidc web-i18n)
+ #:use-module ((webid-oidc parameters) #:prefix p:)
+ #:use-module ((webid-oidc stubs) #:prefix stubs:)
+ #:use-module ((webid-oidc oidc-id-token) #:prefix id:)
+ #:use-module ((webid-oidc jwk) #:prefix jwk:)
+ #:use-module ((webid-oidc dpop-proof) #:prefix dpop:)
+ #:use-module (webid-oidc client)
+ #:use-module (webid-oidc client accounts)
+ #:use-module ((webid-oidc client gui settings) #:prefix settings:)
+ #:use-module ((webid-oidc client gui client-widget) #:prefix client:)
+ #:use-module (webid-oidc client gui application-hooks)
+ #:use-module (web uri)
+ #:use-module (web response)
+ #:use-module (rnrs bytevectors)
+ #:use-module (oop goops)
+ #:declarative? #t
+ #:export
+ (
+ application
+ ))
+
+(push-duplicate-handler! 'merge-generics)
+
+;; This avoids a crash when compiling the module
+(use-typelibs ("GdkPixbuf" "2.0"))
+
+(use-typelibs (("Gio" "2.0") #:renamer (protect 'application:new))
+ ("Gtk" "3.0"))
+
+(define application
+ (application:new
+ "eu.planete_kraus.Disfluid"
+ (list->application-flags '(flags-none))))
+
+(define (on-activate application)
+ (run-hook application-activated-hook application)
+ (let ((window (make <GtkApplicationWindow>
+ #:application application))
+ (widget client:client-widget))
+ (add window widget)
+ (show-all window)))
+
+(connect application activate on-activate)
diff --git a/src/scm/webid-oidc/client/gui/client-widget.scm b/src/scm/webid-oidc/client/gui/client-widget.scm
new file mode 100644
index 0000000..792b8f8
--- /dev/null
+++ b/src/scm/webid-oidc/client/gui/client-widget.scm
@@ -0,0 +1,147 @@
+;; disfluid, implementation of the Solid specification
+;; Copyright (C) 2021 Vivien Kraus
+
+;; This program is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU Affero General Public License as
+;; published by the Free Software Foundation, either version 3 of the
+;; License, or (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU Affero General Public License for more details.
+
+;; You should have received a copy of the GNU Affero General Public License
+;; along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+(define-module (webid-oidc client gui client-widget)
+ #:use-module (gi)
+ #:use-module (gi types)
+ #:use-module (gi util)
+ #:use-module (gi repository)
+ #:use-module (ice-9 match)
+ #:use-module (ice-9 exceptions)
+ #:use-module (ice-9 i18n)
+ #:use-module (ice-9 receive)
+ #:use-module (ice-9 optargs)
+ #:use-module (ice-9 pretty-print)
+ #:use-module (ice-9 control)
+ #:use-module (srfi srfi-9)
+ #:use-module (srfi srfi-19)
+ #:use-module (webid-oidc errors)
+ #:use-module (webid-oidc web-i18n)
+ #:use-module ((webid-oidc parameters) #:prefix p:)
+ #:use-module ((webid-oidc stubs) #:prefix stubs:)
+ #:use-module ((webid-oidc oidc-id-token) #:prefix id:)
+ #:use-module ((webid-oidc jwk) #:prefix jwk:)
+ #:use-module ((webid-oidc config) #:prefix config:)
+ #:use-module (webid-oidc client)
+ #:use-module (webid-oidc client accounts)
+ #:use-module ((webid-oidc client gui settings) #:prefix settings:)
+ #:use-module (webid-oidc client gui application-hooks)
+ #:use-module (web uri)
+ #:use-module (web response)
+ #:use-module (rnrs bytevectors)
+ #:use-module (oop goops)
+ #:duplicates (merge-generics)
+ #:export
+ (
+ client-widget
+ ))
+
+(push-duplicate-handler! 'merge-generics)
+
+;; This avoids a crash when compiling the module
+(use-typelibs ("GdkPixbuf" "2.0")
+ ("Gtk" "3.0"))
+
+(define builder #f)
+(define client-widget #f)
+
+(define (build-client-widget app)
+ (unless client-widget
+ (set! builder
+ (builder:new-from-file (string-append config:uidir "/client-widget.glade")))
+ (set! client-widget
+ (builder:get-object builder "client_widget"))
+ (let ((client-id-entry
+ (builder:get-object builder "client_id_entry"))
+ (redirect-uri-entry
+ (builder:get-object builder "redirect_uri_entry"))
+ (key-pair-entry
+ (builder:get-object builder "key_pair_entry"))
+ (generate-key-pair-button
+ (builder:get-object builder "generate_key_pair_button"))
+ (undo-button
+ (builder:get-object builder "undo_button"))
+ (update-button
+ (builder:get-object builder "update_button")))
+ (define (current-edition)
+ ;; Return the client based on the edited fields
+ (let/ec return
+ (with-exception-handler
+ (lambda (exn)
+ ((@ (ice-9 format) format)
+ (current-error-port)
+ (G_ "The client cannot be constructed: ~a\n")
+ (if (exception-with-message? exn)
+ (exception-message exn)
+ exn))
+ (return #f))
+ (lambda ()
+ ((@ (oop goops) make) <client>
+ #:client-id (entry:get-text client-id-entry)
+ #:redirect-uri (entry:get-text redirect-uri-entry)
+ #:key-pair
+ (jwk:jwk->key (stubs:json-string->scm (entry:get-text key-pair-entry))))))))
+ (define (on-entry-changed . _)
+ (let ((current-client (settings:client))
+ (edited (current-edition)))
+ (receive (can-undo? can-update?)
+ (cond
+ ((and edited (equal? edited current-client))
+ ;; The undo button is disabled and the update button too
+ (values #f #f))
+ (edited
+ ;; We have changed something and it’s valid
+ (values #t #t))
+ (else
+ ;; We have changed something, but it’s invalid
+ (values #t #f)))
+ (widget:set-sensitive undo-button can-undo?)
+ (widget:set-sensitive update-button can-update?))))
+ (define (set-client client)
+ (entry:set-text client-id-entry (uri->string (client-id client)))
+ (entry:set-text redirect-uri-entry (uri->string (redirect-uri client)))
+ (entry:set-text key-pair-entry
+ (stubs:scm->json-string
+ (jwk:key->jwk (key-pair client))))
+ (on-entry-changed))
+ ((@ (gi) connect) client-id-entry activate on-entry-changed)
+ ((@ (gi) connect) redirect-uri-entry activate on-entry-changed)
+ ((@ (gi) connect) key-pair-entry activate on-entry-changed)
+ ((@ (gi) connect)
+ generate-key-pair-button clicked
+ (lambda _
+ (entry:set-text key-pair-entry
+ (stubs:scm->json-string
+ (jwk:key->jwk
+ (jwk:generate-key #:n-size 2048))))
+ (on-entry-changed)))
+ ((@ (gi) connect) undo-button clicked
+ (lambda _
+ (set-client (settings:client))
+ (on-entry-changed)))
+ ((@ (gi) connect) update-button clicked
+ (lambda _
+ (settings:client (current-edition))
+ (widget:set-sensitive undo-button #f)
+ (widget:set-sensitive update-button #f)))
+ (set-client (settings:client))
+ (add-hook! settings:client-changed-hook
+ (lambda (c)
+ (unless (widget:get-sensitive? undo-button)
+ ;; If we were doing an edition, ignore
+ (set-client c)))))))
+
+(add-hook! application-activated-hook build-client-widget)
diff --git a/src/scm/webid-oidc/client/gui/settings.scm b/src/scm/webid-oidc/client/gui/settings.scm
index 57ebbfb..8f97b2e 100644
--- a/src/scm/webid-oidc/client/gui/settings.scm
+++ b/src/scm/webid-oidc/client/gui/settings.scm
@@ -32,6 +32,7 @@
#:use-module (webid-oidc web-i18n)
#:use-module (webid-oidc client client)
#:use-module (webid-oidc client accounts)
+ #:use-module (webid-oidc client gui application-hooks)
#:use-module (webid-oidc jwk)
#:use-module (webid-oidc oidc-id-token)
#:use-module (web uri)
@@ -234,3 +235,11 @@
(lambda (settings)
(connect settings change-event run-accounts-changed-hook))
other-accounts-settings)
+
+(add-hook! application-activated-hook
+ (lambda (app)
+ (run-hook client-changed-hook (client))
+ (run-hook accounts-changed-hook
+ (main-account)
+ (other-accounts)))
+ #t)
diff --git a/src/ui/Makefile.am b/src/ui/Makefile.am
new file mode 100644
index 0000000..4d2ec3d
--- /dev/null
+++ b/src/ui/Makefile.am
@@ -0,0 +1,18 @@
+# disfluid, implementation of the Solid specification
+# Copyright (C) 2021 Vivien Kraus
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+uipkgdatadir = $(pkgdatadir)/ui
+dist_uipkgdata_DATA = %reldir%/client-widget.glade
diff --git a/src/ui/client-widget.glade b/src/ui/client-widget.glade
new file mode 100644
index 0000000..07e2fa0
--- /dev/null
+++ b/src/ui/client-widget.glade
@@ -0,0 +1,169 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.36.0 -->
+<interface>
+ <requires lib="gtk+" version="3.22"/>
+ <object class="GtkBox" id="client_widget">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Client ID:</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="client_id_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="input_purpose">url</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Redirection URI:</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="redirect_uri_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="input_purpose">url</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Key pair:</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="key_pair_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="generate_key_pair_button">
+ <property name="label" translatable="yes">Generate a key pair</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkButton" id="undo_button">
+ <property name="label" translatable="yes">Undo</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="update_button">
+ <property name="label" translatable="yes">Update</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ </object>
+</interface>