From e8233ba5c6f6933d6d20e114192934e1145a750e Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Sat, 25 Jul 2020 13:01:06 +0300 Subject: Keep the navbar URL up to date --- src/ui/documentwidget.c | 2 +- src/ui/window.c | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index cb530e9b..4197332a 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c @@ -151,7 +151,7 @@ static void fetch_DocumentWidget_(iDocumentWidget *d) { iRelease(d->request); d->request = NULL; } - postCommand_Widget(as_Widget(d), "document.request.started"); + postCommandf_App("document.request.started url:%s", cstr_String(d->url)); d->state = fetching_DocumentState; set_Atomic(&d->isSourcePending, iFalse); d->request = new_GmRequest(); diff --git a/src/ui/window.c b/src/ui/window.c index a110c5ad..65228f2b 100644 --- a/src/ui/window.c +++ b/src/ui/window.c @@ -98,6 +98,11 @@ static iBool handleNavBarCommands_(iWidget *navBar, const char *cmd) { return iFalse; } else if (equal_Command(cmd, "document.request.started")) { + iInputWidget *url = findChild_Widget(navBar, "url"); + if (isFocused_Widget(as_Widget(url))) { + setFocus_Widget(NULL); + } + setTextCStr_InputWidget(url, valuePtr_Command(cmd, "url")); updateTextCStr_LabelWidget(findChild_Widget(navBar, "reload"), stopCStr_); return iFalse; } -- cgit v1.2.3