From 71dc5dc43193dae19a68da5832e271b444041b51 Mon Sep 17 00:00:00 2001 From: yggverse Date: Fri, 19 Jul 2024 21:47:50 +0300 Subject: [PATCH] implement page title for history records, write history on request completed only --- src/Entity/Browser/Container/Page.php | 32 +++++++++++++-------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/Entity/Browser/Container/Page.php b/src/Entity/Browser/Container/Page.php index feb5f76a..8bd4576a 100644 --- a/src/Entity/Browser/Container/Page.php +++ b/src/Entity/Browser/Container/Page.php @@ -123,21 +123,6 @@ class Page int $timeout = 5 ): void { - // Update history - if ($history) - { - // Save request in memory - $this->navbar->history->add( - $this->navbar->request->getValue() - ); - - // Save request in database - $this->container->browser->database->renewHistory( - $this->navbar->request->getValue(), - // @TODO title - ); - } - // Update title $this->title->set( _('Loading...') @@ -167,7 +152,7 @@ class Page // Listen response \Gtk::timeout_add( $refresh, - function() use ($connection, $expire) + function() use ($connection, $expire, $history) { // Redirect requested if ($location = $connection->getRedirect()) @@ -251,6 +236,21 @@ class Page // Free shared memory pool $connection->close(); + // Update history + if ($history) + { + // Save request in memory + $this->navbar->history->add( + $this->navbar->request->getValue() + ); + + // Save request in database + $this->container->browser->database->renewHistory( + $this->navbar->request->getValue(), + $this->title->getValue() + ); + } + // Stop return false; }